From 545cf93d82fd67b09c6f4673bab7ca43b5bcf9b9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 29 Nov 2022 18:27:56 +0400 Subject: [PATCH] Show nice General icon in an empty topic. --- .../view/history_view_service_message.cpp | 6 ++++- .../info/profile/info_profile_cover.cpp | 24 ++++++++++++++++--- .../info/profile/info_profile_cover.h | 6 +++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp index 9c59795c8..d1d1556dc 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp @@ -678,7 +678,11 @@ EmptyPainter::EmptyPainter( : _history(topic->history()) , _topic(topic) , _icon( - std::make_unique(topic, paused, update)) + std::make_unique( + topic, + paused, + update, + st::msgServiceFg)) , _header(st::msgMinWidth) , _text(st::msgMinWidth) { fillAboutTopic(); diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index b4b896421..a461e3433 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -121,7 +121,20 @@ TopicIconView::TopicIconView( not_null topic, Fn paused, Fn update) +: TopicIconView( + topic, + std::move(paused), + std::move(update), + st::windowSubTextFg) { +} + +TopicIconView::TopicIconView( + not_null topic, + Fn paused, + Fn update, + const style::color &generalIconFg) : _topic(topic) +, _generalIconFg(generalIconFg) , _paused(std::move(paused)) , _update(std::move(update)) { setup(topic); @@ -218,9 +231,14 @@ void TopicIconView::setupPlayer(not_null topic) { void TopicIconView::setupImage(not_null topic) { using namespace Data; if (topic->isGeneral()) { - _image = ForumTopicGeneralIconFrame( - st::infoForumTopicIcon.size, - st::windowSubTextFg); + rpl::single(rpl::empty) | rpl::then( + style::PaletteChanged() + ) | rpl::start_with_next([=] { + _image = ForumTopicGeneralIconFrame( + st::infoForumTopicIcon.size, + _generalIconFg); + _update(); + }, _lifetime); return; } rpl::combine( diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.h b/Telegram/SourceFiles/info/profile/info_profile_cover.h index b15d861eb..8a0fc6174 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.h +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.h @@ -50,6 +50,11 @@ public: not_null topic, Fn paused, Fn update); + TopicIconView( + not_null topic, + Fn paused, + Fn update, + const style::color &generalIconFg); void paintInRect(QPainter &p, QRect rect); @@ -61,6 +66,7 @@ private: void setupImage(not_null topic); const not_null _topic; + const style::color &_generalIconFg; Fn _paused; Fn _update; std::shared_ptr _player;