Added channel photo to recent posts in list from statistics info.

This commit is contained in:
23rd 2023-11-22 19:20:57 +03:00 committed by John Preston
parent 11ea5e61cf
commit 19ab740da2
3 changed files with 15 additions and 4 deletions

View file

@ -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.";

View file

@ -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<Ui::UserpicButton>(
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) {

View file

@ -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;