mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 23:43:06 +02:00
Added entry point to section of personal currency settings.
This commit is contained in:
parent
70d3061d59
commit
21f5f96d69
2 changed files with 48 additions and 1 deletions
|
@ -1200,6 +1200,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_settings_faq_link" = "https://telegram.org/faq#general-questions";
|
"lng_settings_faq_link" = "https://telegram.org/faq#general-questions";
|
||||||
"lng_settings_features" = "Telegram Features";
|
"lng_settings_features" = "Telegram Features";
|
||||||
"lng_settings_credits" = "My Stars";
|
"lng_settings_credits" = "My Stars";
|
||||||
|
"lng_settings_currency" = "My TON";
|
||||||
"lng_settings_logout" = "Log out";
|
"lng_settings_logout" = "Log out";
|
||||||
"lng_sure_logout" = "Are you sure you want to log out?";
|
"lng_sure_logout" = "Are you sure you want to log out?";
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "settings/settings_main.h"
|
#include "settings/settings_main.h"
|
||||||
|
|
||||||
#include "settings/cloud_password/settings_cloud_password_input.h"
|
|
||||||
#include "api/api_credits.h"
|
#include "api/api_credits.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
|
#include "settings/cloud_password/settings_cloud_password_input.h"
|
||||||
#include "settings/settings_advanced.h"
|
#include "settings/settings_advanced.h"
|
||||||
#include "settings/settings_business.h"
|
#include "settings/settings_business.h"
|
||||||
#include "settings/settings_calls.h"
|
#include "settings/settings_calls.h"
|
||||||
|
@ -43,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/new_badges.h"
|
#include "ui/new_badges.h"
|
||||||
#include "ui/rect.h"
|
#include "ui/rect.h"
|
||||||
#include "ui/vertical_list.h"
|
#include "ui/vertical_list.h"
|
||||||
|
#include "info/channel_statistics/earn/earn_icons.h"
|
||||||
#include "info/profile/info_profile_badge.h"
|
#include "info/profile/info_profile_badge.h"
|
||||||
#include "info/profile/info_profile_emoji_status_panel.h"
|
#include "info/profile/info_profile_emoji_status_panel.h"
|
||||||
#include "data/components/credits.h"
|
#include "data/components/credits.h"
|
||||||
|
@ -72,6 +73,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "base/call_delayed.h"
|
#include "base/call_delayed.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
|
#include "styles/style_chat.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
#include "styles/style_layers.h" // boxLabel
|
#include "styles/style_layers.h" // boxLabel
|
||||||
|
@ -751,6 +753,50 @@ void SetupPremium(
|
||||||
showOther(CreditsId());
|
showOther(CreditsId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const auto wrap = container->add(
|
||||||
|
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
|
container,
|
||||||
|
object_ptr<Ui::VerticalLayout>(container)));
|
||||||
|
wrap->toggleOn(
|
||||||
|
controller->session().credits().tonBalanceValue(
|
||||||
|
) | rpl::map([](CreditsAmount c) -> bool { return !c.empty(); }));
|
||||||
|
wrap->finishAnimating();
|
||||||
|
controller->session().credits().tonLoad();
|
||||||
|
const auto button = AddButtonWithLabel(
|
||||||
|
wrap->entity(),
|
||||||
|
tr::lng_settings_currency(),
|
||||||
|
controller->session().credits().tonBalanceValue(
|
||||||
|
) | rpl::map([=](CreditsAmount c) {
|
||||||
|
return c
|
||||||
|
? Lang::FormatCreditsAmountToShort(c).string
|
||||||
|
: QString();
|
||||||
|
}),
|
||||||
|
st::settingsButton);
|
||||||
|
button->addClickHandler([=] {
|
||||||
|
controller->setPremiumRef("settings");
|
||||||
|
showOther(CurrencyId());
|
||||||
|
});
|
||||||
|
|
||||||
|
const auto badge = Ui::CreateChild<Ui::RpWidget>(button.get());
|
||||||
|
const auto image = Ui::Earn::IconCurrencyColored(
|
||||||
|
st::tonFieldIconSize,
|
||||||
|
st::menuIconColor->c);
|
||||||
|
|
||||||
|
badge->resize(Size(st::tonFieldIconSize));
|
||||||
|
badge->paintRequest(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
auto p = QPainter(badge);
|
||||||
|
p.drawImage(0, 0, image);
|
||||||
|
}, badge->lifetime());
|
||||||
|
|
||||||
|
button->sizeValue() | rpl::start_with_next([=](const QSize &s) {
|
||||||
|
badge->moveToLeft(
|
||||||
|
button->st().iconLeft
|
||||||
|
+ (st::menuIconShop.width() - badge->width()) / 2,
|
||||||
|
(s.height() - badge->height()) / 2);
|
||||||
|
}, badge->lifetime());
|
||||||
|
}
|
||||||
const auto button = AddButtonWithIcon(
|
const auto button = AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::lng_business_title(),
|
tr::lng_business_title(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue