From 19ab740da251b696740dbf7f0d8db0bbdc57b087 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 22 Nov 2023 19:20:57 +0300 Subject: [PATCH] Added channel photo to recent posts in list from statistics info. --- Telegram/Resources/langs/lang.strings | 2 -- .../statistics/info_statistics_recent_message.cpp | 13 +++++++++++-- Telegram/SourceFiles/statistics/statistics.style | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index a5772df70..514a3d929 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4355,8 +4355,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_stats_recent_messages_title" = "Recent posts"; "lng_stats_recent_messages_views#one" = "{count} view"; "lng_stats_recent_messages_views#other" = "{count} views"; -"lng_stats_recent_messages_shares#one" = "{count} share"; -"lng_stats_recent_messages_shares#other" = "{count} shares"; "lng_stats_loading" = "Loading stats..."; "lng_stats_loading_subtext" = "Please wait a few moments while we generate your stats."; diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp index 279b07f92..af2202ed1 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp @@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/statistics/info_statistics_common.h" #include "lang/lang_keys.h" #include "main/main_session.h" +#include "ui/controls/userpic_button.h" #include "ui/effects/outline_segments.h" // UnreadStoryOutlineGradient #include "ui/effects/ripple_animation.h" #include "ui/effects/spoiler_mess.h" @@ -101,8 +102,16 @@ MessagePreview::MessagePreview( _documentMedia = document->createMediaView(); _documentMedia->thumbnailWanted(item->fullId()); } + processPreview(); + } + if (!_photoMedia && !_documentMedia) { + const auto userpic = Ui::CreateChild( + this, + item->history()->peer, + st::statisticsRecentPostUserpic); + userpic->move(st::peerListBoxItem.photoPosition); + userpic->setAttribute(Qt::WA_TransparentForMouseEvents); } - processPreview(); } } @@ -225,7 +234,7 @@ void MessagePreview::paintEvent(QPaintEvent *e) { : 0); const auto rightWidth = std::max(_viewsWidth, rightSubTextWidth) + padding; - const auto left = _preview.isNull() + const auto left = (false && _preview.isNull()) ? st::peerListBoxItem.photoPosition.x() : st::peerListBoxItem.namePosition.x(); if (left) { diff --git a/Telegram/SourceFiles/statistics/statistics.style b/Telegram/SourceFiles/statistics/statistics.style index 2e0b594a4..ccbb46c77 100644 --- a/Telegram/SourceFiles/statistics/statistics.style +++ b/Telegram/SourceFiles/statistics/statistics.style @@ -106,6 +106,10 @@ statisticsRecentPostButton: SettingsButton(defaultSettingsButton) { } statisticsRecentPostShareIcon: icon {{ "menu/forward", windowSubTextFg }}; statisticsRecentPostReactionIcon: icon {{ "menu/group_reactions", windowSubTextFg }}; +statisticsRecentPostUserpic: UserpicButton(defaultUserpicButton) { + size: size(contactsPhotoSize, contactsPhotoSize); + photoSize: contactsPhotoSize; +} statisticsShowMoreButton: SettingsButton(defaultSettingsButton) { textFg: lightButtonFg;