2023-10-10 22:24:24 +00:00
|
|
|
/*
|
|
|
|
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 "base/object_ptr.h"
|
2023-10-11 01:53:59 +00:00
|
|
|
#include "info/statistics/info_statistics_common.h"
|
2023-10-10 22:24:24 +00:00
|
|
|
#include "ui/widgets/scroll_area.h"
|
|
|
|
#include "ui/wrap/vertical_layout.h"
|
|
|
|
|
|
|
|
namespace Info {
|
|
|
|
class Controller;
|
|
|
|
} // namespace Info
|
|
|
|
|
|
|
|
namespace Info::Statistics {
|
|
|
|
|
2023-10-10 23:40:10 +00:00
|
|
|
class Memento;
|
2023-10-11 01:53:59 +00:00
|
|
|
class MessagePreview;
|
2023-10-10 23:40:10 +00:00
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
class InnerWidget final : public Ui::VerticalLayout {
|
|
|
|
public:
|
|
|
|
struct ShowRequest final {
|
|
|
|
PeerId info = PeerId(0);
|
|
|
|
FullMsgId history;
|
|
|
|
FullMsgId messageStatistic;
|
|
|
|
};
|
|
|
|
|
|
|
|
InnerWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Controller*> controller,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
FullMsgId contextId);
|
|
|
|
|
|
|
|
[[nodiscard]] not_null<PeerData*> peer() const;
|
|
|
|
[[nodiscard]] FullMsgId contextId() const;
|
|
|
|
|
|
|
|
[[nodiscard]] rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<ShowRequest> showRequests() const;
|
|
|
|
|
|
|
|
void showFinished();
|
|
|
|
|
2023-10-10 23:40:10 +00:00
|
|
|
void saveState(not_null<Memento*> memento);
|
|
|
|
void restoreState(not_null<Memento*> memento);
|
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
private:
|
2023-10-10 23:40:10 +00:00
|
|
|
void load();
|
|
|
|
void fill();
|
2023-10-11 01:53:59 +00:00
|
|
|
void fillRecentPosts();
|
2023-10-10 23:40:10 +00:00
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
not_null<Controller*> _controller;
|
|
|
|
not_null<PeerData*> _peer;
|
|
|
|
FullMsgId _contextId;
|
|
|
|
|
2023-10-11 01:53:59 +00:00
|
|
|
std::vector<not_null<MessagePreview*>> _messagePreviews;
|
|
|
|
|
|
|
|
SavedState _state;
|
2023-10-10 23:40:10 +00:00
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
|
|
|
|
rpl::event_stream<ShowRequest> _showRequests;
|
|
|
|
rpl::event_stream<> _showFinished;
|
|
|
|
rpl::event_stream<bool> _loaded;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Info::Statistics
|