mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improve gift layout.
This commit is contained in:
parent
e6060ea277
commit
6844f88567
5 changed files with 30 additions and 18 deletions
|
@ -1203,9 +1203,9 @@ void AddStarGiftTable(
|
||||||
const auto peerId = PeerId(entry.barePeerId);
|
const auto peerId = PeerId(entry.barePeerId);
|
||||||
const auto session = &controller->session();
|
const auto session = &controller->session();
|
||||||
const auto unique = entry.uniqueGift.get();
|
const auto unique = entry.uniqueGift.get();
|
||||||
const auto chatPeerId = entry.fromGiftsList
|
const auto selfBareId = session->userPeerId().value;
|
||||||
? entry.bareGiftOwnerId
|
const auto giftToSelf = (peerId == session->userPeerId())
|
||||||
: entry.barePeerId;
|
&& (!entry.fromGiftsList || entry.bareGiftOwnerId == selfBareId);
|
||||||
if (unique) {
|
if (unique) {
|
||||||
const auto ownerId = PeerId(entry.bareGiftOwnerId);
|
const auto ownerId = PeerId(entry.bareGiftOwnerId);
|
||||||
const auto transfer = entry.in
|
const auto transfer = entry.in
|
||||||
|
@ -1224,7 +1224,7 @@ void AddStarGiftTable(
|
||||||
MakePeerTableValue(table, controller, ownerId, send, handler),
|
MakePeerTableValue(table, controller, ownerId, send, handler),
|
||||||
st::giveawayGiftCodePeerMargin);
|
st::giveawayGiftCodePeerMargin);
|
||||||
} else if (peerId) {
|
} else if (peerId) {
|
||||||
if (chatPeerId != session->userPeerId().value) {
|
if (!giftToSelf) {
|
||||||
const auto user = session->data().peer(peerId)->asUser();
|
const auto user = session->data().peer(peerId)->asUser();
|
||||||
const auto withSendButton = entry.in && user && !user->isBot();
|
const auto withSendButton = entry.in && user && !user->isBot();
|
||||||
auto send = withSendButton ? tr::lng_gift_send_small() : nullptr;
|
auto send = withSendButton ? tr::lng_gift_send_small() : nullptr;
|
||||||
|
|
|
@ -25,7 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "settings/settings_credits.h" // Settings::CreditsId
|
#include "settings/settings_credits.h" // Settings::CreditsId
|
||||||
#include "settings/settings_credits_graphics.h"
|
|
||||||
#include "settings/settings_credits_graphics.h" // GiftedCreditsBox
|
#include "settings/settings_credits_graphics.h" // GiftedCreditsBox
|
||||||
#include "settings/settings_premium.h" // Settings::ShowGiftPremium
|
#include "settings/settings_premium.h" // Settings::ShowGiftPremium
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
|
@ -47,13 +46,23 @@ PremiumGift::PremiumGift(
|
||||||
PremiumGift::~PremiumGift() = default;
|
PremiumGift::~PremiumGift() = default;
|
||||||
|
|
||||||
int PremiumGift::top() {
|
int PremiumGift::top() {
|
||||||
return starGift() ? 0 : st::msgServiceGiftBoxStickerTop;
|
return starGift()
|
||||||
|
? st::msgServiceStarGiftStickerTop
|
||||||
|
: st::msgServiceGiftBoxStickerTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PremiumGift::width() {
|
||||||
|
return st::msgServiceStarGiftBoxWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize PremiumGift::size() {
|
QSize PremiumGift::size() {
|
||||||
return QSize(
|
return starGift()
|
||||||
st::msgServiceGiftBoxStickerSize,
|
? QSize(
|
||||||
st::msgServiceGiftBoxStickerSize);
|
st::msgServiceStarGiftStickerSize,
|
||||||
|
st::msgServiceStarGiftStickerSize)
|
||||||
|
: QSize(
|
||||||
|
st::msgServiceGiftBoxStickerSize,
|
||||||
|
st::msgServiceGiftBoxStickerSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PremiumGift::title() {
|
QString PremiumGift::title() {
|
||||||
|
@ -400,7 +409,7 @@ void PremiumGift::ensureStickerCreated() const {
|
||||||
Assert(sticker != nullptr);
|
Assert(sticker != nullptr);
|
||||||
_sticker.emplace(_parent, document, false, _parent);
|
_sticker.emplace(_parent, document, false, _parent);
|
||||||
_sticker->setPlayingOnce(true);
|
_sticker->setPlayingOnce(true);
|
||||||
_sticker->initSize(st::msgServiceGiftBoxStickerSize);
|
_sticker->initSize(st::msgServiceStarGiftStickerSize);
|
||||||
_parent->repaint();
|
_parent->repaint();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
~PremiumGift();
|
~PremiumGift();
|
||||||
|
|
||||||
int top() override;
|
int top() override;
|
||||||
|
int width() override;
|
||||||
QSize size() override;
|
QSize size() override;
|
||||||
QString title() override;
|
QString title() override;
|
||||||
TextWithEntities subtitle() override;
|
TextWithEntities subtitle() override;
|
||||||
|
|
|
@ -1006,10 +1006,9 @@ void ReceiptCreditsBox(
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto selfPeerId = session->userPeerId().value;
|
const auto selfPeerId = session->userPeerId().value;
|
||||||
const auto chatPeerId = e.fromGiftsList
|
const auto giftToSelf = isStarGift
|
||||||
? e.bareGiftOwnerId
|
&& (e.barePeerId == selfPeerId)
|
||||||
: e.barePeerId;
|
&& (!e.fromGiftsList || e.bareGiftOwnerId == selfPeerId);
|
||||||
const auto giftToSelf = isStarGift && (selfPeerId == chatPeerId);
|
|
||||||
|
|
||||||
if (!uniqueGift) {
|
if (!uniqueGift) {
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
|
|
|
@ -917,9 +917,12 @@ msgServiceGiftBoxTopSkip: 4px;
|
||||||
msgServiceGiftBoxButtonHeight: 32px;
|
msgServiceGiftBoxButtonHeight: 32px;
|
||||||
msgServiceGiftBoxButtonPadding: margins(2px, 0px, 2px, 0px);
|
msgServiceGiftBoxButtonPadding: margins(2px, 0px, 2px, 0px);
|
||||||
msgServiceGiftBoxButtonMargins: margins(0px, 13px, 0px, 17px);
|
msgServiceGiftBoxButtonMargins: margins(0px, 13px, 0px, 17px);
|
||||||
msgServiceGiftBoxTitlePadding: margins(0px, 5px, 0px, 2px);
|
msgServiceGiftBoxTitlePadding: margins(0px, 20px, 0px, 6px);
|
||||||
msgServiceGiftBoxStickerTop: -19px;
|
msgServiceGiftBoxStickerTop: -19px;
|
||||||
msgServiceGiftBoxStickerSize: 140px;
|
msgServiceGiftBoxStickerSize: 140px;
|
||||||
|
msgServiceStarGiftBoxWidth: 224px;
|
||||||
|
msgServiceStarGiftStickerTop: 24px;
|
||||||
|
msgServiceStarGiftStickerSize: 100px;
|
||||||
|
|
||||||
historySponsorInfoItem: FlatLabel(defaultFlatLabel) {
|
historySponsorInfoItem: FlatLabel(defaultFlatLabel) {
|
||||||
style: TextStyle(defaultTextStyle) {
|
style: TextStyle(defaultTextStyle) {
|
||||||
|
@ -1207,13 +1210,13 @@ botDownloadCancel: IconButton {
|
||||||
}
|
}
|
||||||
chatUniqueGiftBorder: 4px;
|
chatUniqueGiftBorder: 4px;
|
||||||
|
|
||||||
chatUniqueStickerPadding: margins(10px, 12px, 10px, 8px);
|
chatUniqueStickerPadding: margins(10px, 30px, 10px, 9px);
|
||||||
chatUniqueTitle: TextStyle(defaultTextStyle) {
|
chatUniqueTitle: TextStyle(defaultTextStyle) {
|
||||||
font: font(16px semibold);
|
font: font(16px semibold);
|
||||||
}
|
}
|
||||||
chatUniqueTitlePadding: margins(12px, 4px, 12px, 2px);
|
chatUniqueTitlePadding: margins(12px, 12px, 12px, 2px);
|
||||||
chatUniqueTextPadding: margins(12px, 2px, 12px, 8px);
|
chatUniqueTextPadding: margins(12px, 2px, 12px, 8px);
|
||||||
chatUniqueTableSkip: 10px;
|
chatUniqueTableSkip: 9px;
|
||||||
chatUniqueTableAtBottomPadding: margins(12px, 2px, 12px, 20px);
|
chatUniqueTableAtBottomPadding: margins(12px, 2px, 12px, 20px);
|
||||||
chatUniqueRowSkip: 4px;
|
chatUniqueRowSkip: 4px;
|
||||||
chatUniqueButtonPadding: margins(12px, 4px, 12px, 16px);
|
chatUniqueButtonPadding: margins(12px, 4px, 12px, 16px);
|
||||||
|
|
Loading…
Add table
Reference in a new issue