diff --git a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp index 151beb72da..625979227d 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/controls/history_view_suggest_options.h" +#include "base/event_filter.h" #include "base/unixtime.h" #include "chat_helpers/compose/compose_show.h" #include "core/ui_integration.h" @@ -80,6 +81,37 @@ void ChooseSuggestTimeBox( }); } +void AddApproximateUsd( + not_null field, + not_null session, + rpl::producer price) { + auto value = std::move(price) | rpl::map([=](CreditsAmount amount) { + if (!amount) { + return QString(); + } + const auto appConfig = &session->appConfig(); + const auto rate = amount.ton() + ? appConfig->currencyWithdrawRate() + : (appConfig->starsWithdrawRate() / 100.); + const auto precise = amount.value() * rate; + return u"~$"_q + QString::number(precise, 'f', 2); + }); + const auto usd = Ui::CreateChild( + field, + std::move(value), + st::suggestPriceEstimate); + const auto move = [=] { + usd->moveToRight(0, st::suggestPriceEstimateTop); + }; + base::install_event_filter(field, [=](not_null e) { + if (e->type() == QEvent::Resize) { + move(); + } + return base::EventFilterResult::Continue; + }); + usd->widthValue() | rpl::start_with_next(move, usd->lifetime()); +} + void ChooseSuggestPriceBox( not_null box, SuggestPriceBoxArgs &&args) { @@ -316,6 +348,8 @@ void ChooseSuggestPriceBox( starsFieldWrap->resize(width, starsField->height()); }, starsFieldWrap->lifetime()); + AddApproximateUsd(starsField, session, starsPrice()); + Ui::AddSkip(starsInner); Ui::AddSkip(starsInner); const auto formatPrice = [peer = args.peer](CreditsAmount amount) { @@ -380,6 +414,8 @@ void ChooseSuggestPriceBox( tonFieldWrap->resize(width, tonField->height()); }, tonFieldWrap->lifetime()); + AddApproximateUsd(tonField, session, tonPrice()); + Ui::AddSkip(tonInner); Ui::AddSkip(tonInner); Ui::AddDividerText( diff --git a/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp b/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp index 357778cd9d..f063510cb9 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp @@ -271,9 +271,9 @@ void TodoList::updateTexts() { _flags = _todolist->flags(); _subtitle.setText( st::msgDateTextStyle, - (parent()->history()->peer->isUser() - ? tr::lng_todo_title(tr::now) - : tr::lng_todo_title_group(tr::now))); + (_todolist->othersCanComplete() + ? tr::lng_todo_title_group(tr::now) + : tr::lng_todo_title(tr::now))); } updateTasks(skipAnimations); } diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 1f8e336290..37a16ad80f 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -1379,6 +1379,10 @@ suggestPriceBox: Box(defaultBox) { } shadowIgnoreTopSkip: true; } +suggestPriceEstimate: FlatLabel(defaultFlatLabel) { + textFg: windowSubTextFg; +} +suggestPriceEstimateTop: 12px; tonInput: InputField(defaultInputField) { textBg: transparent; textMargins: margins(0px, 7px, 0px, 7px);