mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-24 14:33:02 +02:00
Added icon to big button in credits settings.
This commit is contained in:
parent
c2cd4fc75f
commit
fda1c8399f
4 changed files with 36 additions and 13 deletions
|
@ -2797,6 +2797,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_credits_balance_me" = "your balance";
|
||||
"lng_credits_balance_me_count" = "Your balance: {emoji} {amount}";
|
||||
"lng_credits_buy_button" = "Top Up Balance";
|
||||
"lng_credits_topup_button" = "{emoji} Top Up Balance";
|
||||
"lng_credits_buy_button_short" = "Top Up";
|
||||
"lng_credits_stats_button_short" = "Stats";
|
||||
"lng_credits_stats_button" = "View Statistics";
|
||||
|
|
|
@ -698,14 +698,7 @@ settingsGiftIconEmoji: IconEmoji {
|
|||
padding: margins(1px, 2px, 1px, 0px);
|
||||
}
|
||||
|
||||
settingsCreditsButtonBuy: RoundButton(inviteLinkCopy) {
|
||||
icon: icon {{ "settings/add", activeButtonFg, point(0px, 7px) }};
|
||||
iconOver: icon {{ "settings/add", activeButtonFgOver, point(0px, 7px) }};
|
||||
}
|
||||
settingsCreditsButtonStats: RoundButton(inviteLinkCopy) {
|
||||
icon: icon {{ "info/edit/links_share", activeButtonFg }};
|
||||
iconOver: icon {{ "info/edit/links_share", activeButtonFgOver }};
|
||||
}
|
||||
settingsCreditsButtonBuyIcon: icon {{ "settings/add", windowBgActive, point(7px, 0px) }};
|
||||
|
||||
settingsCreditsButton: SettingsButton(settingsButton) {
|
||||
padding: margins(62px, 8px, 22px, 8px);
|
||||
|
|
|
@ -405,12 +405,41 @@ void Credits::setupContent() {
|
|||
content,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
rpl::conditional(
|
||||
state->buyStars.loadingValue(),
|
||||
rpl::single(QString()),
|
||||
tr::lng_credits_buy_button()),
|
||||
nullptr,
|
||||
st::creditsSettingsBigBalanceButton)),
|
||||
st::boxRowPadding)->entity();
|
||||
button->setContext([&]() -> Ui::Text::MarkedContext {
|
||||
auto customEmojiFactory = [=](const auto &...) {
|
||||
const auto &icon = st::settingsIconAdd;
|
||||
auto image = QImage(
|
||||
(icon.size() + QSize(st::lineWidth * 4, 0))
|
||||
* style::DevicePixelRatio(),
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
const auto r = Rect(icon.size()) - Margins(st::lineWidth * 2);
|
||||
image.setDevicePixelRatio(style::DevicePixelRatio());
|
||||
image.fill(Qt::transparent);
|
||||
{
|
||||
auto p = QPainter(&image);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(st::activeButtonFg);
|
||||
p.drawEllipse(r);
|
||||
icon.paintInCenter(p, r, st::windowBgActive->c);
|
||||
}
|
||||
return std::make_unique<Ui::Text::StaticCustomEmoji>(
|
||||
std::move(image),
|
||||
u"topup_button"_q);
|
||||
};
|
||||
return { .customEmojiFactory = std::move(customEmojiFactory) };
|
||||
}());
|
||||
button->setText(
|
||||
rpl::conditional(
|
||||
state->buyStars.loadingValue(),
|
||||
rpl::single(TextWithEntities()),
|
||||
tr::lng_credits_topup_button(
|
||||
lt_emoji,
|
||||
rpl::single(Ui::Text::SingleCustomEmoji(u"+"_q)),
|
||||
Ui::Text::WithEntities)));
|
||||
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
const auto show = _controller->uiShow();
|
||||
button->setClickedCallback(state->buyStars.handler(show, paid));
|
||||
|
|
|
@ -20,7 +20,7 @@ creditsSettingsBigBalanceSkip: 4px;
|
|||
creditsSettingsBigBalanceButton: RoundButton(defaultActiveButton) {
|
||||
width: 240px;
|
||||
height: 40px;
|
||||
textTop: 12px;
|
||||
textTop: 11px;
|
||||
style: semiboldTextStyle;
|
||||
}
|
||||
creditsSettingsBigBalanceButtonGift: RoundButton(defaultLightButton) {
|
||||
|
|
Loading…
Add table
Reference in a new issue