2017-09-13 17:01:23 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-09-13 17:01:23 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-09-13 17:01:23 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui/rp_widget.h"
|
2017-09-30 18:26:45 +00:00
|
|
|
#include "info/info_wrap_widget.h"
|
2018-01-22 19:51:38 +00:00
|
|
|
#include "dialogs/dialogs_key.h"
|
2017-09-30 18:26:45 +00:00
|
|
|
#include "window/section_memento.h"
|
2019-09-13 12:22:54 +00:00
|
|
|
#include "base/object_ptr.h"
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
namespace Storage {
|
2018-03-09 20:48:47 +00:00
|
|
|
enum class SharedMediaType : signed char;
|
2017-09-13 17:01:23 +00:00
|
|
|
} // namespace Storage
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ScrollArea;
|
2017-09-26 17:57:01 +00:00
|
|
|
struct ScrollToRequest;
|
2017-09-13 17:01:23 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Info {
|
2018-09-05 19:05:49 +00:00
|
|
|
namespace Settings {
|
|
|
|
struct Tag;
|
|
|
|
} // namespace Settings
|
2017-09-13 17:01:23 +00:00
|
|
|
|
2022-02-24 15:04:24 +00:00
|
|
|
namespace Downloads {
|
|
|
|
struct Tag;
|
|
|
|
} // namespace Downloads
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
class ContentMemento;
|
2017-09-30 18:26:45 +00:00
|
|
|
class WrapWidget;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
class Memento final : public Window::SectionMemento {
|
|
|
|
public:
|
2020-06-08 09:06:50 +00:00
|
|
|
explicit Memento(not_null<PeerData*> peer);
|
|
|
|
Memento(not_null<PeerData*> peer, Section section);
|
2018-09-05 19:05:49 +00:00
|
|
|
Memento(Settings::Tag settings, Section section);
|
2020-01-15 11:53:42 +00:00
|
|
|
Memento(not_null<PollData*> poll, FullMsgId contextId);
|
2020-12-14 14:48:10 +00:00
|
|
|
explicit Memento(std::vector<std::shared_ptr<ContentMemento>> stack);
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
object_ptr<Window::SectionWidget> createWidget(
|
|
|
|
QWidget *parent,
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::Column column,
|
2017-09-13 17:01:23 +00:00
|
|
|
const QRect &geometry) override;
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
object_ptr<Ui::LayerWidget> createLayer(
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-30 18:26:45 +00:00
|
|
|
const QRect &geometry) override;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
2017-11-03 18:26:14 +00:00
|
|
|
int stackSize() const {
|
|
|
|
return int(_stack.size());
|
|
|
|
}
|
2020-12-14 14:48:10 +00:00
|
|
|
std::vector<std::shared_ptr<ContentMemento>> takeStack();
|
2017-11-03 18:26:14 +00:00
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
not_null<ContentMemento*> content() {
|
2017-11-03 18:26:14 +00:00
|
|
|
Expects(!_stack.empty());
|
2018-09-05 19:05:49 +00:00
|
|
|
|
2017-11-03 18:26:14 +00:00
|
|
|
return _stack.back().get();
|
2017-09-13 17:01:23 +00:00
|
|
|
}
|
|
|
|
|
2019-04-15 11:54:03 +00:00
|
|
|
static Section DefaultSection(not_null<PeerData*> peer);
|
2020-12-14 14:48:10 +00:00
|
|
|
static std::shared_ptr<Memento> Default(not_null<PeerData*> peer);
|
2017-12-05 14:07:01 +00:00
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
~Memento();
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
private:
|
2020-12-14 14:48:10 +00:00
|
|
|
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
2020-06-08 09:06:50 +00:00
|
|
|
not_null<PeerData*> peer,
|
2017-11-03 18:26:14 +00:00
|
|
|
Section section);
|
2020-12-14 14:48:10 +00:00
|
|
|
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
2018-09-05 19:05:49 +00:00
|
|
|
Settings::Tag settings,
|
|
|
|
Section section);
|
2020-12-14 14:48:10 +00:00
|
|
|
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
2020-01-15 11:53:42 +00:00
|
|
|
not_null<PollData*> poll,
|
|
|
|
FullMsgId contextId);
|
|
|
|
|
2020-12-14 14:48:10 +00:00
|
|
|
static std::shared_ptr<ContentMemento> DefaultContent(
|
2020-06-08 09:06:50 +00:00
|
|
|
not_null<PeerData*> peer,
|
2017-09-13 17:01:23 +00:00
|
|
|
Section section);
|
|
|
|
|
2020-12-14 14:48:10 +00:00
|
|
|
std::vector<std::shared_ptr<ContentMemento>> _stack;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-09-15 17:34:41 +00:00
|
|
|
class MoveMemento final : public Window::SectionMemento {
|
|
|
|
public:
|
2017-09-30 18:26:45 +00:00
|
|
|
MoveMemento(object_ptr<WrapWidget> content);
|
2017-09-15 17:34:41 +00:00
|
|
|
|
|
|
|
object_ptr<Window::SectionWidget> createWidget(
|
|
|
|
QWidget *parent,
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::Column column,
|
2017-09-15 17:34:41 +00:00
|
|
|
const QRect &geometry) override;
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
object_ptr<Ui::LayerWidget> createLayer(
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-30 18:26:45 +00:00
|
|
|
const QRect &geometry) override;
|
2017-09-15 17:34:41 +00:00
|
|
|
|
|
|
|
bool instant() const override {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<WrapWidget> takeContent(
|
2017-09-15 17:34:41 +00:00
|
|
|
QWidget *parent,
|
|
|
|
Wrap wrap);
|
|
|
|
|
|
|
|
private:
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<WrapWidget> _content;
|
2017-09-15 17:34:41 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
} // namespace Info
|