Files
tdesktop/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.h
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
init
2026-02-16 15:50:16 +03:00

74 lines
1.5 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "ui/rp_widget.h"
class HistoryItem;
namespace Data {
class DocumentMedia;
class PhotoMedia;
class Story;
} // namespace Data
namespace Ui {
class SpoilerAnimation;
} // namespace Ui
namespace Info::Statistics {
struct SavedState;
class MessagePreview final : public Ui::RpWidget {
public:
MessagePreview(
not_null<Ui::RpWidget*> parent,
not_null<HistoryItem*> item,
QImage cachedPreview);
MessagePreview(
not_null<Ui::RpWidget*> parent,
not_null<Data::Story*> story,
QImage cachedPreview);
void setInfo(int views, int shares, int reactions);
void saveState(SavedState &state) const;
protected:
void paintEvent(QPaintEvent *e) override;
int resizeGetHeight(int newWidth) override;
private:
void processPreview();
FullMsgId _messageId;
FullStoryId _storyId;
Ui::Text::String _text;
Ui::Text::String _date;
Ui::Text::String _views;
Ui::Text::String _shares;
Ui::Text::String _reactions;
int _viewsWidth = 0;
int _sharesWidth = 0;
int _reactionsWidth = 0;
QImage _cornerCache;
QImage _preview;
std::shared_ptr<Data::PhotoMedia> _photoMedia;
std::shared_ptr<Data::DocumentMedia> _documentMedia;
std::unique_ptr<Ui::SpoilerAnimation> _spoiler;
rpl::lifetime _lifetimeDownload;
};
} // namespace Info::Statistics