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"
|
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
|
|
|
|
|
|
|
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:
|
2018-09-05 19:05:49 +00:00
|
|
|
explicit Memento(PeerId peerId);
|
2017-09-30 18:26:45 +00:00
|
|
|
Memento(PeerId peerId, Section section);
|
2019-04-15 11:54:03 +00:00
|
|
|
//Memento(not_null<Data::Feed*> feed, Section section); // #feed
|
2018-09-05 19:05:49 +00:00
|
|
|
Memento(Settings::Tag settings, Section section);
|
|
|
|
explicit Memento(std::vector<std::unique_ptr<ContentMemento>> stack);
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
object_ptr<Window::SectionWidget> createWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::Controller*> controller,
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::Column column,
|
2017-09-13 17:01:23 +00:00
|
|
|
const QRect &geometry) override;
|
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<Window::LayerWidget> createLayer(
|
|
|
|
not_null<Window::Controller*> controller,
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
std::vector<std::unique_ptr<ContentMemento>> takeStack();
|
|
|
|
|
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);
|
|
|
|
//static Section DefaultSection(Dialogs::Key key); // #feed
|
|
|
|
static Memento Default(not_null<PeerData*> peer);
|
|
|
|
//static Memento Default(Dialogs::Key key); // #feed
|
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:
|
2017-11-03 18:26:14 +00:00
|
|
|
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
|
|
|
PeerId peerId,
|
|
|
|
Section section);
|
2019-04-15 11:54:03 +00:00
|
|
|
//static std::vector<std::unique_ptr<ContentMemento>> DefaultStack( // #feed
|
|
|
|
// not_null<Data::Feed*> feed,
|
|
|
|
// Section section);
|
2018-09-05 19:05:49 +00:00
|
|
|
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
|
|
|
Settings::Tag settings,
|
|
|
|
Section section);
|
2019-04-15 11:54:03 +00:00
|
|
|
//static std::unique_ptr<ContentMemento> DefaultContent( // #feed
|
|
|
|
// not_null<Data::Feed*> feed,
|
|
|
|
// Section section);
|
2018-01-22 19:51:38 +00:00
|
|
|
|
2017-12-05 14:07:01 +00:00
|
|
|
static std::unique_ptr<ContentMemento> DefaultContent(
|
2017-09-13 17:01:23 +00:00
|
|
|
PeerId peerId,
|
|
|
|
Section section);
|
|
|
|
|
2017-11-03 18:26:14 +00:00
|
|
|
std::vector<std::unique_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,
|
|
|
|
not_null<Window::Controller*> controller,
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::Column column,
|
2017-09-15 17:34:41 +00:00
|
|
|
const QRect &geometry) override;
|
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<Window::LayerWidget> createLayer(
|
|
|
|
not_null<Window::Controller*> controller,
|
|
|
|
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
|