2023-10-02 15:36:25 +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 "info/info_content_widget.h"
|
2023-10-11 01:53:59 +00:00
|
|
|
#include "info/statistics/info_statistics_common.h"
|
2023-10-02 15:36:25 +00:00
|
|
|
|
|
|
|
namespace Info::Statistics {
|
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
class InnerWidget;
|
|
|
|
|
2023-10-02 15:36:25 +00:00
|
|
|
class Memento final : public ContentMemento {
|
|
|
|
public:
|
|
|
|
Memento(not_null<Controller*> controller);
|
2023-10-08 20:17:45 +00:00
|
|
|
Memento(not_null<PeerData*> peer, FullMsgId contextId);
|
2023-10-02 15:36:25 +00:00
|
|
|
~Memento();
|
|
|
|
|
|
|
|
object_ptr<ContentWidget> createWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Controller*> controller,
|
|
|
|
const QRect &geometry) override;
|
|
|
|
|
|
|
|
Section section() const override;
|
|
|
|
|
2023-10-11 01:53:59 +00:00
|
|
|
void setState(SavedState states);
|
|
|
|
[[nodiscard]] SavedState state();
|
2023-10-10 23:40:10 +00:00
|
|
|
|
|
|
|
private:
|
2023-10-11 01:53:59 +00:00
|
|
|
SavedState _state;
|
2023-10-10 23:40:10 +00:00
|
|
|
|
2023-10-02 15:36:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Widget final : public ContentWidget {
|
|
|
|
public:
|
|
|
|
Widget(QWidget *parent, not_null<Controller*> controller);
|
|
|
|
|
|
|
|
bool showInternal(not_null<ContentMemento*> memento) override;
|
|
|
|
rpl::producer<QString> title() override;
|
|
|
|
rpl::producer<bool> desiredShadowVisibility() const override;
|
|
|
|
void showFinished() override;
|
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
[[nodiscard]] not_null<PeerData*> peer() const;
|
|
|
|
[[nodiscard]] FullMsgId contextId() const;
|
|
|
|
|
2023-10-10 23:40:10 +00:00
|
|
|
void setInternalState(
|
|
|
|
const QRect &geometry,
|
|
|
|
not_null<Memento*> memento);
|
|
|
|
|
2023-10-02 15:36:25 +00:00
|
|
|
private:
|
2023-10-10 23:40:10 +00:00
|
|
|
void saveState(not_null<Memento*> memento);
|
|
|
|
void restoreState(not_null<Memento*> memento);
|
|
|
|
|
2023-10-02 15:36:25 +00:00
|
|
|
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
|
|
|
|
2023-10-10 22:24:24 +00:00
|
|
|
const not_null<InnerWidget*> _inner;
|
2023-10-02 15:36:25 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2023-10-08 20:17:45 +00:00
|
|
|
[[nodiscard]] std::shared_ptr<Info::Memento> Make(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
FullMsgId contextId);
|
2023-10-02 15:36:25 +00:00
|
|
|
|
|
|
|
} // namespace Info::Statistics
|