Added message preview to message statistics.
This commit is contained in:
parent
0be2e8b672
commit
d4db838d43
|
@ -542,6 +542,14 @@ void InnerWidget::fill() {
|
|||
lifetime().make_state<Api::Statistics>(&_peer->session().api()),
|
||||
_controller->uiShow()->toastParent(),
|
||||
};
|
||||
if (_state.stats.message) {
|
||||
if (const auto i = _peer->owner().message(_contextId)) {
|
||||
::Settings::AddSkip(inner);
|
||||
inner->add(object_ptr<MessagePreview>(this, i, -1, -1, QImage()));
|
||||
::Settings::AddSkip(inner);
|
||||
::Settings::AddDivider(inner);
|
||||
}
|
||||
}
|
||||
FillOverview(inner, _state.stats);
|
||||
FillStatistic(inner, descriptor, _state.stats);
|
||||
const auto &channel = _state.stats.channel;
|
||||
|
@ -553,8 +561,7 @@ void InnerWidget::fill() {
|
|||
const auto showPeerInfo = [=](not_null<PeerData*> peer) {
|
||||
_showRequests.fire({ .info = peer->id });
|
||||
};
|
||||
const auto addSkip = [&](
|
||||
not_null<Ui::VerticalLayout*> c) {
|
||||
const auto addSkip = [&](not_null<Ui::VerticalLayout*> c) {
|
||||
::Settings::AddSkip(c);
|
||||
::Settings::AddDivider(c);
|
||||
::Settings::AddSkip(c);
|
||||
|
|
|
@ -79,16 +79,20 @@ MessagePreview::MessagePreview(
|
|||
Ui::FormatDateTime(ItemDateTime(item)))
|
||||
, _views(
|
||||
st::defaultPeerListItem.nameStyle,
|
||||
tr::lng_stats_recent_messages_views(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
views))
|
||||
(views >= 0)
|
||||
? tr::lng_stats_recent_messages_views(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
views)
|
||||
: QString())
|
||||
, _shares(
|
||||
st::statisticsHeaderTitleTextStyle,
|
||||
tr::lng_stats_recent_messages_shares(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
shares))
|
||||
(shares >= 0)
|
||||
? tr::lng_stats_recent_messages_shares(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
shares)
|
||||
: QString())
|
||||
, _viewsWidth(_views.maxWidth())
|
||||
, _sharesWidth(_shares.maxWidth())
|
||||
, _preview(std::move(cachedPreview)) {
|
||||
|
|
Loading…
Reference in New Issue