diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index ae4d0dd72c..445ee34062 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_changes.h" #include "data/data_channel.h" #include "data/data_emoji_statuses.h" +#include "data/data_forum_topic.h" #include "data/data_peer_values.h" #include "data/data_peer.h" #include "data/data_photo.h" @@ -74,6 +75,7 @@ TopBar::TopBar( Descriptor descriptor) : RpWidget(parent) , _peer(descriptor.controller->key().peer()) +, _topic(descriptor.controller->key().topic()) , _st(st::infoTopBar) , _badgeTooltipHide( std::make_unique([=] { hideBadgeTooltip(); })) @@ -195,7 +197,17 @@ TopBar::TopBar( setupUniqueBadgeTooltip(); setupButtons(controller, descriptor.backToggles.value()); setupUserpicButton(controller); - updateVideoUserpic(); + if (_topic) { + _topicIconView = std::make_unique( + _topic, + [controller = controller->parentController()] { + return controller->isGifPausedAtLeastFor( + Window::GifPauseReason::Layer); + }, + [=] { update(); }); + } else { + updateVideoUserpic(); + } } void TopBar::setupUserpicButton(not_null controller) { @@ -467,6 +479,10 @@ QRect TopBar::userpicGeometry() const { void TopBar::paintUserpic(QPainter &p) { const auto geometry = userpicGeometry(); + if (_topicIconView) { + _topicIconView->paintInRect(p, geometry); + return; + } if (_videoUserpicPlayer && _videoUserpicPlayer->ready()) { const auto size = st::infoLayerProfileTopBarPhotoSize; const auto frame = _videoUserpicPlayer->frame(Size(size), _peer); diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h index 3b4a928ff1..f9a6939f53 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h @@ -12,8 +12,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/profile/info_profile_badge.h" #include "ui/userpic_view.h" +namespace Data { +class ForumTopic; +} // namespace Data + namespace Info::Profile { class BadgeTooltip; +class TopicIconView; } // namespace Info::Profile namespace Ui { @@ -100,6 +105,7 @@ private: void hideBadgeTooltip(); const not_null _peer; + Data::ForumTopic *_topic = nullptr; const style::InfoTopBar &_st; std::unique_ptr _badgeTooltipHide; @@ -128,6 +134,7 @@ private: QImage _cachedUserpic; QImage _monoforumMask; std::unique_ptr _videoUserpicPlayer; + std::unique_ptr _topicIconView; base::unique_qptr _close; base::unique_qptr> _back;