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