mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Improve suggested photo service message.
This commit is contained in:
parent
5ebea97ded
commit
14f113266f
7 changed files with 25 additions and 12 deletions
|
@ -1563,9 +1563,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_action_webview_data_done" = "You have just successfully transferred data from the «{text}» button to the bot.";
|
||||
"lng_action_gift_received" = "{user} sent you a gift for {cost}";
|
||||
"lng_action_gift_received_me" = "You sent to {user} a gift for {cost}";
|
||||
"lng_action_suggested_photo_title" = "Suggested Photo";
|
||||
"lng_action_suggested_photo_me" = "You suggested {user} to use this photo for their account.";
|
||||
"lng_action_suggested_photo" = "{user} suggests you to use this photo for your account.";
|
||||
"lng_action_suggested_photo_me" = "You suggested {user} to use this profile photo.";
|
||||
"lng_action_suggested_photo" = "{user} suggests you to use this profile photo.";
|
||||
"lng_action_suggested_photo_button" = "View Photo";
|
||||
"lng_action_attach_menu_bot_allowed" = "You allowed this bot to message you when you added it in the attachment menu.";
|
||||
"lng_action_topic_created_inside" = "Topic created";
|
||||
"lng_action_topic_closed_inside" = "Topic closed";
|
||||
|
@ -2330,7 +2330,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_context_animated_reactions_many#one" = "Reactions contain emoji from **{count} pack**.";
|
||||
"lng_context_animated_reactions_many#other" = "Reactions contain emoji from **{count} packs**.";
|
||||
|
||||
"lng_context_spoiler_effect" = "Spoiler Effect";
|
||||
"lng_context_spoiler_effect" = "Hide with Spoiler";
|
||||
"lng_context_disable_spoiler" = "Disable Spoiler Effect";
|
||||
|
||||
"lng_downloads_section" = "Downloads";
|
||||
|
|
|
@ -58,6 +58,10 @@ QString PremiumGift::subtitle() {
|
|||
return FormatGiftMonths(_gift->months());
|
||||
}
|
||||
|
||||
QString PremiumGift::button() {
|
||||
return tr::lng_sticker_premium_view(tr::now);
|
||||
}
|
||||
|
||||
ClickHandlerPtr PremiumGift::createViewLink() {
|
||||
const auto from = _gift->from();
|
||||
const auto to = _parent->history()->peer;
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
QSize size() override;
|
||||
QString title() override;
|
||||
QString subtitle() override;
|
||||
QString button() override;
|
||||
void draw(
|
||||
Painter &p,
|
||||
const PaintContext &context,
|
||||
|
|
|
@ -28,9 +28,7 @@ ServiceBox::ServiceBox(
|
|||
, _button([&] {
|
||||
auto result = Button();
|
||||
result.repaint = [=] { repaint(); };
|
||||
result.text.setText(
|
||||
st::semiboldTextStyle,
|
||||
tr::lng_sticker_premium_view(tr::now));
|
||||
result.text.setText(st::semiboldTextStyle, _content->button());
|
||||
|
||||
const auto height = st::msgServiceGiftBoxButtonHeight;
|
||||
const auto &padding = st::msgServiceGiftBoxButtonPadding;
|
||||
|
@ -64,8 +62,10 @@ ServiceBox::ServiceBox(
|
|||
+ _content->top()
|
||||
+ _content->size().height()
|
||||
+ st::msgServiceGiftBoxTitlePadding.top()
|
||||
+ _title.countHeight(_maxWidth)
|
||||
+ st::msgServiceGiftBoxTitlePadding.bottom()
|
||||
+ (_title.isEmpty()
|
||||
? 0
|
||||
: (_title.countHeight(_maxWidth)
|
||||
+ st::msgServiceGiftBoxTitlePadding.bottom()))
|
||||
+ _subtitle.countHeight(_maxWidth)
|
||||
+ st::msgServiceGiftBoxButtonMargins.top()
|
||||
+ _button.size.height()
|
||||
|
@ -98,8 +98,10 @@ void ServiceBox::draw(Painter &p, const PaintContext &context) const {
|
|||
p.setPen(context.st->msgServiceFg());
|
||||
const auto &padding = st::msgServiceGiftBoxTitlePadding;
|
||||
top += padding.top();
|
||||
_title.draw(p, st::msgPadding.left(), top, _maxWidth, style::al_top);
|
||||
top += _title.countHeight(_maxWidth) + padding.bottom();
|
||||
if (!_title.isEmpty()) {
|
||||
_title.draw(p, st::msgPadding.left(), top, _maxWidth, style::al_top);
|
||||
top += _title.countHeight(_maxWidth) + padding.bottom();
|
||||
}
|
||||
_subtitle.draw(p, st::msgPadding.left(), top, _maxWidth, style::al_top);
|
||||
top += _subtitle.countHeight(_maxWidth) + padding.bottom();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
[[nodiscard]] virtual QSize size() = 0;
|
||||
[[nodiscard]] virtual QString title() = 0;
|
||||
[[nodiscard]] virtual QString subtitle() = 0;
|
||||
[[nodiscard]] virtual QString button() = 0;
|
||||
virtual void draw(
|
||||
Painter &p,
|
||||
const PaintContext &context,
|
||||
|
|
|
@ -52,7 +52,11 @@ QSize UserpicSuggestion::size() {
|
|||
}
|
||||
|
||||
QString UserpicSuggestion::title() {
|
||||
return tr::lng_action_suggested_photo_title(tr::now);
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString UserpicSuggestion::button() {
|
||||
return tr::lng_action_suggested_photo_button(tr::now);
|
||||
}
|
||||
|
||||
QString UserpicSuggestion::subtitle() {
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
QSize size() override;
|
||||
QString title() override;
|
||||
QString subtitle() override;
|
||||
QString button() override;
|
||||
void draw(
|
||||
Painter &p,
|
||||
const PaintContext &context,
|
||||
|
|
Loading…
Add table
Reference in a new issue