mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Use shared_ptr<Memento> for sections.
This commit is contained in:
parent
baba7e272d
commit
b6483cb65c
54 changed files with 147 additions and 152 deletions
|
@ -3412,7 +3412,7 @@ void ApiWrap::jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date) {
|
|||
// requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) {
|
||||
// Ui::hideLayer();
|
||||
// App::wnd()->sessionController()->showSection(
|
||||
// std::make_unique<HistoryFeed::Memento>(feed, result));
|
||||
// std::make_shared<HistoryFeed::Memento>(feed, result));
|
||||
// });
|
||||
//}
|
||||
|
||||
|
|
|
@ -1002,7 +1002,7 @@ void Controller::fillManageSection() {
|
|||
if (hasRecentActions) {
|
||||
auto callback = [=] {
|
||||
_navigation->showSection(
|
||||
std::make_unique<AdminLog::SectionMemento>(channel));
|
||||
std::make_shared<AdminLog::SectionMemento>(channel));
|
||||
};
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
|
|
|
@ -1591,7 +1591,7 @@ void UpdateApplication() {
|
|||
if (const auto window = App::wnd()) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
controller->showSection(
|
||||
std::make_unique<Info::Memento>(
|
||||
std::make_shared<Info::Memento>(
|
||||
Info::Settings::Tag{ controller->session().user() },
|
||||
Info::Section::SettingsType::Advanced),
|
||||
Window::SectionShow());
|
||||
|
|
|
@ -56,7 +56,7 @@ void SharedMediaShowOverview(
|
|||
return;
|
||||
}
|
||||
}
|
||||
windows.front()->showSection(std::make_unique<Info::Memento>(
|
||||
windows.front()->showSection(std::make_shared<Info::Memento>(
|
||||
history->peer,
|
||||
Info::Section(type)));
|
||||
}
|
||||
|
|
|
@ -1776,7 +1776,7 @@ bool Widget::onCancelSearch() {
|
|||
if (const auto peer = _searchInChat.peer()) {
|
||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// controller()->showSection(std::make_unique<HistoryFeed::Memento>(feed));
|
||||
// controller()->showSection(std::make_shared<HistoryFeed::Memento>(feed));
|
||||
} else {
|
||||
Unexpected("Empty key in onCancelSearch().");
|
||||
}
|
||||
|
@ -1800,7 +1800,7 @@ void Widget::onCancelSearchInChat() {
|
|||
if (const auto peer = _searchInChat.peer()) {
|
||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// controller()->showSection(std::make_unique<HistoryFeed::Memento>(feed));
|
||||
// controller()->showSection(std::make_shared<HistoryFeed::Memento>(feed));
|
||||
} else {
|
||||
Unexpected("Empty key in onCancelSearchInPeer().");
|
||||
}
|
||||
|
|
|
@ -371,8 +371,8 @@ void Widget::setupShortcuts() {
|
|||
}, lifetime());
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
||||
auto result = std::make_unique<SectionMemento>(channel());
|
||||
std::shared_ptr<Window::SectionMemento> Widget::createMemento() {
|
||||
auto result = std::make_shared<SectionMemento>(channel());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
bool showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
|
||||
void setInternalState(const QRect &geometry, not_null<SectionMemento*> memento);
|
||||
|
||||
|
|
|
@ -687,7 +687,7 @@ HistoryWidget::HistoryWidget(
|
|||
cancelReply(lastKeyboardUsed);
|
||||
crl::on_main(this, [=, history = action.history]{
|
||||
controller->showSection(
|
||||
std::make_unique<HistoryView::ScheduledMemento>(history));
|
||||
std::make_shared<HistoryView::ScheduledMemento>(history));
|
||||
});
|
||||
} else {
|
||||
fastShowAtEnd(action.history);
|
||||
|
@ -1502,7 +1502,7 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, U
|
|||
} else if (to.section == Section::Scheduled) {
|
||||
history->setDraft(Data::DraftKey::Scheduled(), std::move(draft));
|
||||
controller()->showSection(
|
||||
std::make_unique<HistoryView::ScheduledMemento>(history));
|
||||
std::make_shared<HistoryView::ScheduledMemento>(history));
|
||||
} else {
|
||||
history->setLocalDraft(std::move(draft));
|
||||
if (history == _history) {
|
||||
|
@ -2070,7 +2070,7 @@ void HistoryWidget::refreshScheduledToggle() {
|
|||
_scheduled->show();
|
||||
_scheduled->addClickHandler([=] {
|
||||
controller()->showSection(
|
||||
std::make_unique<HistoryView::ScheduledMemento>(_history));
|
||||
std::make_shared<HistoryView::ScheduledMemento>(_history));
|
||||
});
|
||||
orderWidgets(); // Raise drag areas to the top.
|
||||
} else if (_scheduled && !has) {
|
||||
|
@ -3880,7 +3880,7 @@ bool HistoryWidget::pushTabbedSelectorToThirdSection(
|
|||
Core::App().settings().setTabbedReplacedWithInfo(false);
|
||||
controller()->resizeForThirdSection();
|
||||
controller()->showSection(
|
||||
std::make_unique<ChatHelpers::TabbedMemento>(),
|
||||
std::make_shared<ChatHelpers::TabbedMemento>(),
|
||||
params.withThirdColumn());
|
||||
return true;
|
||||
}
|
||||
|
@ -5387,7 +5387,7 @@ void HistoryWidget::refreshPinnedBarButton(bool many) {
|
|||
const auto id = _pinnedTracker->currentMessageId();
|
||||
if (id.message) {
|
||||
controller()->showSection(
|
||||
std::make_unique<HistoryView::PinnedMemento>(
|
||||
std::make_shared<HistoryView::PinnedMemento>(
|
||||
_history,
|
||||
((!_migrated || id.message.channel)
|
||||
? id.message.msg
|
||||
|
|
|
@ -1736,7 +1736,7 @@ bool ComposeControls::pushTabbedSelectorToThirdSection(
|
|||
&st::historyRecordVoiceRippleBgActive);
|
||||
_window->resizeForThirdSection();
|
||||
_window->showSection(
|
||||
std::make_unique<ChatHelpers::TabbedMemento>(),
|
||||
std::make_shared<ChatHelpers::TabbedMemento>(),
|
||||
params.withThirdColumn());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -342,8 +342,8 @@ void PinnedWidget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> PinnedWidget::createMemento() {
|
||||
auto result = std::make_unique<PinnedMemento>(history());
|
||||
std::shared_ptr<Window::SectionMemento> PinnedWidget::createMemento() {
|
||||
auto result = std::make_shared<PinnedMemento>(history());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
bool showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
bool showMessage(
|
||||
PeerId peerId,
|
||||
const Window::SectionShow ¶ms,
|
||||
|
|
|
@ -1367,8 +1367,8 @@ bool RepliesWidget::returnTabbedSelector() {
|
|||
return _composeControls->returnTabbedSelector();
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> RepliesWidget::createMemento() {
|
||||
auto result = std::make_unique<RepliesMemento>(history(), _rootId);
|
||||
std::shared_ptr<Window::SectionMemento> RepliesWidget::createMemento() {
|
||||
auto result = std::make_shared<RepliesMemento>(history(), _rootId);
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
bool showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
bool showMessage(
|
||||
PeerId peerId,
|
||||
const Window::SectionShow ¶ms,
|
||||
|
|
|
@ -941,8 +941,8 @@ bool ScheduledWidget::returnTabbedSelector() {
|
|||
return _composeControls->returnTabbedSelector();
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> ScheduledWidget::createMemento() {
|
||||
auto result = std::make_unique<ScheduledMemento>(history());
|
||||
std::shared_ptr<Window::SectionMemento> ScheduledWidget::createMemento() {
|
||||
auto result = std::make_shared<ScheduledMemento>(history());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
bool showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
|
||||
void setInternalState(
|
||||
const QRect &geometry,
|
||||
|
|
|
@ -493,15 +493,15 @@ void TopBarWidget::infoClicked() {
|
|||
} else if (key.folder()) {
|
||||
_controller->closeFolder();
|
||||
//} else if (const auto feed = _activeChat.feed()) { // #feed
|
||||
// _controller->showSection(std::make_unique<Info::Memento>(
|
||||
// _controller->showSection(std::make_shared<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
} else if (key.peer()->isSelf()) {
|
||||
_controller->showSection(std::make_unique<Info::Memento>(
|
||||
_controller->showSection(std::make_shared<Info::Memento>(
|
||||
key.peer(),
|
||||
Info::Section(Storage::SharedMediaType::Photo)));
|
||||
} else if (key.peer()->isRepliesChat()) {
|
||||
_controller->showSection(std::make_unique<Info::Memento>(
|
||||
_controller->showSection(std::make_shared<Info::Memento>(
|
||||
key.peer(),
|
||||
Info::Section(Storage::SharedMediaType::Photo)));
|
||||
} else {
|
||||
|
|
|
@ -87,8 +87,8 @@ void Widget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(user());
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(user());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
InnerWidget *_inner = nullptr;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void ContentWidget::updateControlsGeometry() {
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> ContentWidget::createMemento() {
|
||||
std::shared_ptr<ContentMemento> ContentWidget::createMemento() {
|
||||
auto result = doCreateMemento();
|
||||
_controller->saveSearchState(result.get());
|
||||
return result;
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
virtual bool showInternal(
|
||||
not_null<ContentMemento*> memento) = 0;
|
||||
std::unique_ptr<ContentMemento> createMemento();
|
||||
std::shared_ptr<ContentMemento> createMemento();
|
||||
|
||||
virtual void setIsStackBottom(bool isStackBottom) {
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
void updateControlsGeometry();
|
||||
void refreshSearchField(bool shown);
|
||||
|
||||
virtual std::unique_ptr<ContentMemento> doCreateMemento() = 0;
|
||||
virtual std::shared_ptr<ContentMemento> doCreateMemento() = 0;
|
||||
|
||||
const not_null<Controller*> _controller;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ PollData *AbstractController::poll() const {
|
|||
}
|
||||
|
||||
void AbstractController::showSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const Window::SectionShow ¶ms) {
|
||||
return parentController()->showSection(std::move(memento), params);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void Controller::setupMigrationViewer() {
|
|||
const auto section = _section;
|
||||
InvokeQueued(_widget, [=] {
|
||||
window->showSection(
|
||||
std::make_unique<Memento>(peer, section),
|
||||
std::make_shared<Memento>(peer, section),
|
||||
Window::SectionShow(
|
||||
Window::SectionShow::Way::Backward,
|
||||
anim::type::instant,
|
||||
|
@ -261,7 +261,7 @@ void Controller::saveSearchState(not_null<ContentMemento*> memento) {
|
|||
}
|
||||
|
||||
void Controller::showSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const Window::SectionShow ¶ms) {
|
||||
if (!_widget->showInternal(memento.get(), params)) {
|
||||
AbstractController::showSection(std::move(memento), params);
|
||||
|
|
|
@ -136,7 +136,7 @@ public:
|
|||
virtual rpl::producer<QString> mediaSourceQueryValue() const;
|
||||
|
||||
void showSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const Window::SectionShow ¶ms = Window::SectionShow()) override;
|
||||
void showBackFromStack(
|
||||
const Window::SectionShow ¶ms = Window::SectionShow()) override;
|
||||
|
@ -202,7 +202,7 @@ public:
|
|||
void saveSearchState(not_null<ContentMemento*> memento);
|
||||
|
||||
void showSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const Window::SectionShow ¶ms = Window::SectionShow()) override;
|
||||
void showBackFromStack(
|
||||
const Window::SectionShow ¶ms = Window::SectionShow()) override;
|
||||
|
|
|
@ -106,7 +106,7 @@ void LayerWidget::parentResized() {
|
|||
Ui::FocusPersister persister(this);
|
||||
restoreFloatPlayerDelegate();
|
||||
|
||||
auto memento = std::make_unique<MoveMemento>(std::move(_content));
|
||||
auto memento = std::make_shared<MoveMemento>(std::move(_content));
|
||||
|
||||
// We want to call hideSpecialLayer synchronously to avoid glitches,
|
||||
// but we can't destroy LayerStackWidget from its' resizeEvent,
|
||||
|
|
|
@ -47,41 +47,41 @@ Memento::Memento(not_null<PollData*> poll, FullMsgId contextId)
|
|||
: Memento(DefaultStack(poll, contextId)) {
|
||||
}
|
||||
|
||||
Memento::Memento(std::vector<std::unique_ptr<ContentMemento>> stack)
|
||||
Memento::Memento(std::vector<std::shared_ptr<ContentMemento>> stack)
|
||||
: _stack(std::move(stack)) {
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
not_null<PeerData*> peer,
|
||||
Section section) {
|
||||
auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
auto result = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
result.push_back(DefaultContent(peer, section));
|
||||
return result;
|
||||
}
|
||||
|
||||
//std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack( // #feed
|
||||
//std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section) {
|
||||
// auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
// auto result = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
// result.push_back(DefaultContent(feed, section));
|
||||
// return result;
|
||||
//}
|
||||
//
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
Settings::Tag settings,
|
||||
Section section) {
|
||||
auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
result.push_back(std::make_unique<Settings::Memento>(
|
||||
auto result = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
result.push_back(std::make_shared<Settings::Memento>(
|
||||
settings.self,
|
||||
section.settingsType()));
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
not_null<PollData*> poll,
|
||||
FullMsgId contextId) {
|
||||
auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
result.push_back(std::make_unique<Polls::Memento>(poll, contextId));
|
||||
auto result = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
result.push_back(std::make_shared<Polls::Memento>(poll, contextId));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -101,8 +101,8 @@ Section Memento::DefaultSection(not_null<PeerData*> peer) {
|
|||
// return Section(Section::Type::Profile);
|
||||
//}
|
||||
|
||||
std::unique_ptr<Memento> Memento::Default(not_null<PeerData*> peer) {
|
||||
return std::make_unique<Memento>(peer, DefaultSection(peer));
|
||||
std::shared_ptr<Memento> Memento::Default(not_null<PeerData*> peer) {
|
||||
return std::make_shared<Memento>(peer, DefaultSection(peer));
|
||||
}
|
||||
// // #feed
|
||||
//Memento Memento::Default(Dialogs::Key key) {
|
||||
|
@ -112,7 +112,7 @@ std::unique_ptr<Memento> Memento::Default(not_null<PeerData*> peer) {
|
|||
// return Memento(key.feed(), DefaultSection(key));
|
||||
//}
|
||||
|
||||
std::unique_ptr<ContentMemento> Memento::DefaultContent(
|
||||
std::shared_ptr<ContentMemento> Memento::DefaultContent(
|
||||
not_null<PeerData*> peer,
|
||||
Section section) {
|
||||
if (auto to = peer->migrateTo()) {
|
||||
|
@ -123,32 +123,32 @@ std::unique_ptr<ContentMemento> Memento::DefaultContent(
|
|||
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
return std::make_unique<Profile::Memento>(
|
||||
return std::make_shared<Profile::Memento>(
|
||||
peer,
|
||||
migratedPeerId);
|
||||
case Section::Type::Media:
|
||||
return std::make_unique<Media::Memento>(
|
||||
return std::make_shared<Media::Memento>(
|
||||
peer,
|
||||
migratedPeerId,
|
||||
section.mediaType());
|
||||
case Section::Type::CommonGroups:
|
||||
return std::make_unique<CommonGroups::Memento>(peer->asUser());
|
||||
return std::make_shared<CommonGroups::Memento>(peer->asUser());
|
||||
case Section::Type::Members:
|
||||
return std::make_unique<Members::Memento>(
|
||||
return std::make_shared<Members::Memento>(
|
||||
peer,
|
||||
migratedPeerId);
|
||||
}
|
||||
Unexpected("Wrong section type in Info::Memento::DefaultContent()");
|
||||
}
|
||||
//
|
||||
//std::unique_ptr<ContentMemento> Memento::DefaultContent( // #feed
|
||||
//std::shared_ptr<ContentMemento> Memento::DefaultContent( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section) {
|
||||
// switch (section.type()) {
|
||||
// case Section::Type::Profile:
|
||||
// return std::make_unique<FeedProfile::Memento>(feed);
|
||||
// return std::make_shared<FeedProfile::Memento>(feed);
|
||||
// case Section::Type::Channels:
|
||||
// return std::make_unique<Channels::Memento>(feed);
|
||||
// return std::make_shared<Channels::Memento>(feed);
|
||||
// }
|
||||
// Unexpected("Wrong feed section in Info::Memento::DefaultContent()");
|
||||
//}
|
||||
|
@ -179,7 +179,7 @@ object_ptr<Ui::LayerWidget> Memento::createLayer(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::takeStack() {
|
||||
std::vector<std::shared_ptr<ContentMemento>> Memento::takeStack() {
|
||||
return std::move(_stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
//Memento(not_null<Data::Feed*> feed, Section section); // #feed
|
||||
Memento(Settings::Tag settings, Section section);
|
||||
Memento(not_null<PollData*> poll, FullMsgId contextId);
|
||||
explicit Memento(std::vector<std::unique_ptr<ContentMemento>> stack);
|
||||
explicit Memento(std::vector<std::shared_ptr<ContentMemento>> stack);
|
||||
|
||||
object_ptr<Window::SectionWidget> createWidget(
|
||||
QWidget *parent,
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
int stackSize() const {
|
||||
return int(_stack.size());
|
||||
}
|
||||
std::vector<std::unique_ptr<ContentMemento>> takeStack();
|
||||
std::vector<std::shared_ptr<ContentMemento>> takeStack();
|
||||
|
||||
not_null<ContentMemento*> content() {
|
||||
Expects(!_stack.empty());
|
||||
|
@ -62,33 +62,33 @@ public:
|
|||
|
||||
static Section DefaultSection(not_null<PeerData*> peer);
|
||||
//static Section DefaultSection(Dialogs::Key key); // #feed
|
||||
static std::unique_ptr<Memento> Default(not_null<PeerData*> peer);
|
||||
static std::shared_ptr<Memento> Default(not_null<PeerData*> peer);
|
||||
//static Memento Default(Dialogs::Key key); // #feed
|
||||
|
||||
~Memento();
|
||||
|
||||
private:
|
||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
||||
not_null<PeerData*> peer,
|
||||
Section section);
|
||||
//static std::vector<std::unique_ptr<ContentMemento>> DefaultStack( // #feed
|
||||
//static std::vector<std::shared_ptr<ContentMemento>> DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
||||
Settings::Tag settings,
|
||||
Section section);
|
||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
||||
not_null<PollData*> poll,
|
||||
FullMsgId contextId);
|
||||
|
||||
//static std::unique_ptr<ContentMemento> DefaultContent( // #feed
|
||||
//static std::shared_ptr<ContentMemento> DefaultContent( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
static std::unique_ptr<ContentMemento> DefaultContent(
|
||||
static std::shared_ptr<ContentMemento> DefaultContent(
|
||||
not_null<PeerData*> peer,
|
||||
Section section);
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> _stack;
|
||||
std::vector<std::shared_ptr<ContentMemento>> _stack;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ bool SectionWidget::showInternal(
|
|||
return _content->showInternal(memento, params);
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> SectionWidget::createMemento() {
|
||||
std::shared_ptr<Window::SectionMemento> SectionWidget::createMemento() {
|
||||
return _content->createMemento();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
bool showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
|
||||
object_ptr<Ui::LayerWidget> moveContentToLayer(
|
||||
QRect bodyGeometry) override;
|
||||
|
|
|
@ -50,8 +50,8 @@ const style::InfoTopBar &TopBarStyle(Wrap wrap) {
|
|||
} // namespace
|
||||
|
||||
struct WrapWidget::StackItem {
|
||||
std::unique_ptr<ContentMemento> section;
|
||||
// std::unique_ptr<ContentMemento> anotherTab;
|
||||
std::shared_ptr<ContentMemento> section;
|
||||
// std::shared_ptr<ContentMemento> anotherTab;
|
||||
};
|
||||
|
||||
WrapWidget::WrapWidget(
|
||||
|
@ -96,7 +96,7 @@ void WrapWidget::setupShortcuts() {
|
|||
}
|
||||
|
||||
void WrapWidget::restoreHistoryStack(
|
||||
std::vector<std::unique_ptr<ContentMemento>> stack) {
|
||||
std::vector<std::shared_ptr<ContentMemento>> stack) {
|
||||
Expects(!stack.empty());
|
||||
Expects(!hasStackHistory());
|
||||
|
||||
|
@ -188,7 +188,7 @@ void WrapWidget::injectActivePeerProfile(not_null<PeerData*> peer) {
|
|||
//}
|
||||
|
||||
void WrapWidget::injectActiveProfileMemento(
|
||||
std::unique_ptr<ContentMemento> memento) {
|
||||
std::shared_ptr<ContentMemento> memento) {
|
||||
auto injected = StackItem();
|
||||
injected.section = std::move(memento);
|
||||
_historyStack.insert(
|
||||
|
@ -712,13 +712,13 @@ rpl::producer<SelectedItems> WrapWidget::selectedListValue() const {
|
|||
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//std::unique_ptr<ContentMemento> WrapWidget::createTabMemento(
|
||||
//std::shared_ptr<ContentMemento> WrapWidget::createTabMemento(
|
||||
// Tab tab) {
|
||||
// switch (tab) {
|
||||
// case Tab::Profile: return std::make_unique<Profile::Memento>(
|
||||
// case Tab::Profile: return std::make_shared<Profile::Memento>(
|
||||
// _controller->peerId(),
|
||||
// _controller->migratedPeerId());
|
||||
// case Tab::Media: return std::make_unique<Media::Memento>(
|
||||
// case Tab::Media: return std::make_shared<Media::Memento>(
|
||||
// _controller->peerId(),
|
||||
// _controller->migratedPeerId(),
|
||||
// Media::Type::Photo);
|
||||
|
@ -884,8 +884,8 @@ void WrapWidget::highlightTopBar() {
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> WrapWidget::createMemento() {
|
||||
auto stack = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
std::shared_ptr<Window::SectionMemento> WrapWidget::createMemento() {
|
||||
auto stack = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
stack.reserve(_historyStack.size() + 1);
|
||||
for (auto &stackItem : base::take(_historyStack)) {
|
||||
stack.push_back(std::move(stackItem.section));
|
||||
|
@ -895,7 +895,7 @@ std::unique_ptr<Window::SectionMemento> WrapWidget::createMemento() {
|
|||
// We're not in valid state anymore and supposed to be destroyed.
|
||||
_controller = nullptr;
|
||||
|
||||
return std::make_unique<Memento>(std::move(stack));
|
||||
return std::make_shared<Memento>(std::move(stack));
|
||||
}
|
||||
|
||||
rpl::producer<int> WrapWidget::desiredHeightValue() const {
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
bool showBackFromStackInternal(const Window::SectionShow ¶ms);
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
|
||||
rpl::producer<int> desiredHeightValue() const override;
|
||||
|
||||
|
@ -146,10 +146,10 @@ private:
|
|||
void injectActivePeerProfile(not_null<PeerData*> peer);
|
||||
//void injectActiveFeedProfile(not_null<Data::Feed*> feed); // #feed
|
||||
void injectActiveProfileMemento(
|
||||
std::unique_ptr<ContentMemento> memento);
|
||||
std::shared_ptr<ContentMemento> memento);
|
||||
void checkBeforeClose(Fn<void()> close);
|
||||
void restoreHistoryStack(
|
||||
std::vector<std::unique_ptr<ContentMemento>> stack);
|
||||
std::vector<std::shared_ptr<ContentMemento>> stack);
|
||||
bool hasStackHistory() const {
|
||||
return !_historyStack.empty();
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ private:
|
|||
|
||||
//void showTab(Tab tab);
|
||||
void showContent(object_ptr<ContentWidget> content);
|
||||
//std::unique_ptr<ContentMemento> createTabMemento(Tab tab);
|
||||
//std::shared_ptr<ContentMemento> createTabMemento(Tab tab);
|
||||
object_ptr<ContentWidget> createContent(
|
||||
not_null<ContentMemento*> memento,
|
||||
not_null<Controller*> controller);
|
||||
|
@ -212,7 +212,7 @@ private:
|
|||
base::unique_qptr<Ui::DropdownMenu> _topBarMenu;
|
||||
|
||||
// Tab _tab = Tab::Profile;
|
||||
// std::unique_ptr<ContentMemento> _anotherTabMemento;
|
||||
// std::shared_ptr<ContentMemento> _anotherTabMemento;
|
||||
std::vector<StackItem> _historyStack;
|
||||
|
||||
rpl::event_stream<rpl::producer<int>> _desiredHeights;
|
||||
|
|
|
@ -92,7 +92,7 @@ inline auto AddButton(
|
|||
tracker)->entity();
|
||||
result->addClickHandler([=] {
|
||||
navigation->showSection(
|
||||
std::make_unique<Info::Memento>(peer, Section(type)));
|
||||
std::make_shared<Info::Memento>(peer, Section(type)));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ inline auto AddCommonGroupsButton(
|
|||
tracker)->entity();
|
||||
result->addClickHandler([=] {
|
||||
navigation->showSection(
|
||||
std::make_unique<Info::Memento>(user, Section::Type::CommonGroups));
|
||||
std::make_shared<Info::Memento>(user, Section::Type::CommonGroups));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -115,8 +115,8 @@ void Widget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(controller());
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(controller());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ private:
|
|||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
InnerWidget *_inner = nullptr;
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ void Widget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(controller());
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(controller());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
Profile::Members *_inner = nullptr;
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ void Widget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(poll(), contextId());
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(poll(), contextId());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
not_null<InnerWidget*> _inner;
|
||||
|
||||
|
|
|
@ -843,7 +843,7 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
|
|||
lt_count_decimal,
|
||||
MembersCountValue(channel) | tr::to_count());
|
||||
auto membersCallback = [=] {
|
||||
controller->showSection(std::make_unique<Info::Memento>(
|
||||
controller->showSection(std::make_shared<Info::Memento>(
|
||||
channel,
|
||||
Section::Type::Members));
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupContent(
|
|||
_cover->showSection(
|
||||
) | rpl::start_with_next([=](Section section) {
|
||||
_controller->showSection(
|
||||
std::make_unique<Info::Memento>(_peer, section));
|
||||
std::make_shared<Info::Memento>(_peer, section));
|
||||
}, _cover->lifetime());
|
||||
_cover->setOnlineCount(rpl::single(0));
|
||||
auto details = SetupDetails(_controller, parent, _peer);
|
||||
|
|
|
@ -342,14 +342,14 @@ void Members::showMembersWithSearch(bool withSearch) {
|
|||
//if (!_searchShown) {
|
||||
// toggleSearch();
|
||||
//}
|
||||
auto contentMemento = std::make_unique<Info::Members::Memento>(
|
||||
auto contentMemento = std::make_shared<Info::Members::Memento>(
|
||||
_controller);
|
||||
contentMemento->setState(saveState());
|
||||
contentMemento->setSearchStartsFocused(withSearch);
|
||||
auto mementoStack = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
auto mementoStack = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
mementoStack.push_back(std::move(contentMemento));
|
||||
_controller->showSection(
|
||||
std::make_unique<Info::Memento>(std::move(mementoStack)));
|
||||
std::make_shared<Info::Memento>(std::move(mementoStack)));
|
||||
}
|
||||
|
||||
//void Members::toggleSearch(anim::type animated) {
|
||||
|
|
|
@ -99,8 +99,8 @@ void Widget::setInternalState(
|
|||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(controller());
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(controller());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ private:
|
|||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
InnerWidget *_inner = nullptr;
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ rpl::producer<bool> Widget::desiredShadowVisibility() const {
|
|||
: rpl::single(true);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(self(), _type);
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(self(), _type);
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ private:
|
|||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
not_null<UserData*> _self;
|
||||
Type _type = Type();
|
||||
|
|
|
@ -140,8 +140,8 @@ public:
|
|||
}
|
||||
|
||||
void setThirdSectionMemento(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento);
|
||||
std::unique_ptr<Window::SectionMemento> takeThirdSectionMemento() {
|
||||
std::shared_ptr<Window::SectionMemento> memento);
|
||||
std::shared_ptr<Window::SectionMemento> takeThirdSectionMemento() {
|
||||
return std::move(_thirdSectionMemento);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
private:
|
||||
PeerData *_peer = nullptr;
|
||||
QPointer<Window::SectionWidget> _thirdSectionWeak;
|
||||
std::unique_ptr<Window::SectionMemento> _thirdSectionMemento;
|
||||
std::shared_ptr<Window::SectionMemento> _thirdSectionMemento;
|
||||
|
||||
};
|
||||
|
||||
|
@ -187,27 +187,27 @@ public:
|
|||
class StackItemSection : public StackItem {
|
||||
public:
|
||||
StackItemSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento);
|
||||
std::shared_ptr<Window::SectionMemento> memento);
|
||||
|
||||
StackItemType type() const override {
|
||||
return SectionStackItem;
|
||||
}
|
||||
std::unique_ptr<Window::SectionMemento> takeMemento() {
|
||||
std::shared_ptr<Window::SectionMemento> takeMemento() {
|
||||
return std::move(_memento);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<Window::SectionMemento> _memento;
|
||||
std::shared_ptr<Window::SectionMemento> _memento;
|
||||
|
||||
};
|
||||
|
||||
void StackItem::setThirdSectionMemento(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento) {
|
||||
std::shared_ptr<Window::SectionMemento> memento) {
|
||||
_thirdSectionMemento = std::move(memento);
|
||||
}
|
||||
|
||||
StackItemSection::StackItemSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento)
|
||||
std::shared_ptr<Window::SectionMemento> memento)
|
||||
: StackItem(nullptr)
|
||||
, _memento(std::move(memento)) {
|
||||
}
|
||||
|
@ -1607,7 +1607,7 @@ void MainWidget::saveSectionInStack() {
|
|||
}
|
||||
|
||||
void MainWidget::showSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const SectionShow ¶ms) {
|
||||
if (_mainSection && _mainSection->showInternal(
|
||||
memento.get(),
|
||||
|
@ -1626,11 +1626,8 @@ void MainWidget::showSection(
|
|||
// return;
|
||||
}
|
||||
|
||||
using MementoPtr = std::unique_ptr<Window::SectionMemento>;
|
||||
const auto sharedMemento = std::make_shared<MementoPtr>(
|
||||
std::move(memento));
|
||||
if (preventsCloseSection(
|
||||
[=] { showSection(base::take(*sharedMemento), params); },
|
||||
[=] { showSection(memento, params); },
|
||||
params)) {
|
||||
return;
|
||||
}
|
||||
|
@ -1640,9 +1637,7 @@ void MainWidget::showSection(
|
|||
// we need to update adaptive layout to Adaptive::ThirdColumn().
|
||||
updateColumnLayout();
|
||||
|
||||
showNewSection(
|
||||
std::move(*sharedMemento),
|
||||
params);
|
||||
showNewSection(std::move(memento), params);
|
||||
}
|
||||
|
||||
void MainWidget::updateColumnLayout() {
|
||||
|
@ -1737,7 +1732,7 @@ Window::SectionSlideParams MainWidget::prepareDialogsAnimation() {
|
|||
}
|
||||
|
||||
void MainWidget::showNewSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const SectionShow ¶ms) {
|
||||
using Column = Window::Column;
|
||||
|
||||
|
@ -2451,15 +2446,15 @@ bool MainWidget::saveThirdSectionToStackBack() const {
|
|||
|
||||
auto MainWidget::thirdSectionForCurrentMainSection(
|
||||
Dialogs::Key key)
|
||||
-> std::unique_ptr<Window::SectionMemento> {
|
||||
-> std::shared_ptr<Window::SectionMemento> {
|
||||
if (_thirdSectionFromStack) {
|
||||
return std::move(_thirdSectionFromStack);
|
||||
} else if (const auto peer = key.peer()) {
|
||||
return std::make_unique<Info::Memento>(
|
||||
return std::make_shared<Info::Memento>(
|
||||
peer,
|
||||
Info::Memento::DefaultSection(peer));
|
||||
//} else if (const auto feed = key.feed()) { // #feed
|
||||
// return std::make_unique<Info::Memento>(
|
||||
// return std::make_shared<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Memento::DefaultSection(key));
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
|
||||
int backgroundFromY() const;
|
||||
void showSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const SectionShow ¶ms);
|
||||
void updateColumnLayout();
|
||||
bool stackIsEmpty() const;
|
||||
|
@ -256,7 +256,7 @@ private:
|
|||
bool canWrite);
|
||||
[[nodiscard]] bool saveThirdSectionToStackBack() const;
|
||||
[[nodiscard]] auto thirdSectionForCurrentMainSection(Dialogs::Key key)
|
||||
-> std::unique_ptr<Window::SectionMemento>;
|
||||
-> std::shared_ptr<Window::SectionMemento>;
|
||||
|
||||
void setupConnectingWidget();
|
||||
void createPlayer();
|
||||
|
@ -276,7 +276,7 @@ private:
|
|||
Window::SectionSlideParams prepareShowAnimation(
|
||||
bool willHaveTopBarShadow);
|
||||
void showNewSection(
|
||||
std::unique_ptr<Window::SectionMemento> &&memento,
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const SectionShow ¶ms);
|
||||
void dropMainSection(Window::SectionWidget *widget);
|
||||
|
||||
|
@ -353,7 +353,7 @@ private:
|
|||
object_ptr<HistoryWidget> _history;
|
||||
object_ptr<Window::SectionWidget> _mainSection = { nullptr };
|
||||
object_ptr<Window::SectionWidget> _thirdSection = { nullptr };
|
||||
std::unique_ptr<Window::SectionMemento> _thirdSectionFromStack;
|
||||
std::shared_ptr<Window::SectionMemento> _thirdSectionFromStack;
|
||||
std::unique_ptr<Window::ConnectionState> _connecting;
|
||||
|
||||
base::weak_ptr<Calls::Call> _currentCall;
|
||||
|
|
|
@ -650,7 +650,7 @@ void Manager::openNotificationMessage(
|
|||
Ui::showPeerHistory(history, messageId);
|
||||
//} else if (messageFeed) { // #feed
|
||||
// App::wnd()->sessionController()->showSection(
|
||||
// std::make_unique<HistoryFeed::Memento>(messageFeed));
|
||||
// std::make_shared<HistoryFeed::Memento>(messageFeed));
|
||||
} else {
|
||||
Ui::showPeerHistory(history, ShowAtUnreadMsgId);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ void SectionWidget::showAnimated(
|
|||
show();
|
||||
}
|
||||
|
||||
std::unique_ptr<SectionMemento> SectionWidget::createMemento() {
|
||||
std::shared_ptr<SectionMemento> SectionWidget::createMemento() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
|
||||
// Create a memento of that section to store it in the history stack.
|
||||
// This method may modify the section ("take" heavy items).
|
||||
virtual std::unique_ptr<SectionMemento> createMemento();
|
||||
virtual std::shared_ptr<SectionMemento> createMemento();
|
||||
|
||||
void setInnerFocus() {
|
||||
doSetInnerFocus();
|
||||
|
|
|
@ -714,7 +714,7 @@ void Filler::addTogglesForArchive() {
|
|||
// const auto controller = _controller;
|
||||
// const auto feed = _feed;
|
||||
// _addAction(tr::lng_context_view_feed_info(tr::now), [=] {
|
||||
// controller->showSection(std::make_unique<Info::Memento>(
|
||||
// controller->showSection(std::make_shared<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
// });
|
||||
|
|
|
@ -253,12 +253,12 @@ void SessionNavigation::showRepliesForMessage(
|
|||
const auto channelId = history->channelId();
|
||||
//const auto item = _session->data().message(channelId, rootId);
|
||||
//if (!commentId && (!item || !item->repliesAreComments())) {
|
||||
// showSection(std::make_unique<HistoryView::RepliesMemento>(history, rootId));
|
||||
// showSection(std::make_shared<HistoryView::RepliesMemento>(history, rootId));
|
||||
// return;
|
||||
//} else if (const auto id = item ? item->commentsItemId() : FullMsgId()) {
|
||||
// if (const auto commentsItem = _session->data().message(id)) {
|
||||
// showSection(
|
||||
// std::make_unique<HistoryView::RepliesMemento>(commentsItem));
|
||||
// std::make_shared<HistoryView::RepliesMemento>(commentsItem));
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
@ -314,7 +314,7 @@ void SessionNavigation::showRepliesForMessage(
|
|||
post->setRepliesOutboxReadTill(readTill->v);
|
||||
}
|
||||
}
|
||||
showSection(std::make_unique<HistoryView::RepliesMemento>(
|
||||
showSection(std::make_shared<HistoryView::RepliesMemento>(
|
||||
item,
|
||||
commentId));
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ void SessionNavigation::showPeerInfo(
|
|||
// Core::App().settings().setThirdSectionInfoEnabled(true);
|
||||
// Core::App().saveSettingsDelayed();
|
||||
//}
|
||||
showSection(std::make_unique<Info::Memento>(peer), params);
|
||||
showSection(std::make_shared<Info::Memento>(peer), params);
|
||||
}
|
||||
|
||||
void SessionNavigation::showPeerInfo(
|
||||
|
@ -375,7 +375,7 @@ void SessionNavigation::showSettings(
|
|||
Settings::Type type,
|
||||
const SectionShow ¶ms) {
|
||||
showSection(
|
||||
std::make_unique<Info::Memento>(
|
||||
std::make_shared<Info::Memento>(
|
||||
Info::Settings::Tag{ _session->user() },
|
||||
Info::Section(type)),
|
||||
params);
|
||||
|
@ -389,7 +389,7 @@ void SessionNavigation::showPollResults(
|
|||
not_null<PollData*> poll,
|
||||
FullMsgId contextId,
|
||||
const SectionShow ¶ms) {
|
||||
showSection(std::make_unique<Info::Memento>(poll, contextId), params);
|
||||
showSection(std::make_shared<Info::Memento>(poll, contextId), params);
|
||||
}
|
||||
|
||||
SessionController::SessionController(
|
||||
|
@ -640,9 +640,9 @@ bool SessionController::jumpToChatListEntry(Dialogs::RowDescriptor row) {
|
|||
return true;
|
||||
//} else if (const auto feed = row.key.feed()) { // #feed
|
||||
// if (const auto item = session().data().message(row.fullId)) {
|
||||
// showSection(std::make_unique<HistoryFeed::Memento>(feed, item->position()));
|
||||
// showSection(std::make_shared<HistoryFeed::Memento>(feed, item->position()));
|
||||
// } else {
|
||||
// showSection(std::make_unique<HistoryFeed::Memento>(feed));
|
||||
// showSection(std::make_shared<HistoryFeed::Memento>(feed));
|
||||
// }
|
||||
}
|
||||
return false;
|
||||
|
@ -1087,7 +1087,7 @@ void SessionController::showPeerHistory(
|
|||
}
|
||||
|
||||
void SessionController::showSection(
|
||||
std::unique_ptr<SectionMemento> &&memento,
|
||||
std::shared_ptr<SectionMemento> memento,
|
||||
const SectionShow ¶ms) {
|
||||
if (!params.thirdColumn && widget()->showSectionInExistingLayer(
|
||||
memento.get(),
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
Main::Session &session() const;
|
||||
|
||||
virtual void showSection(
|
||||
std::unique_ptr<SectionMemento> &&memento,
|
||||
std::shared_ptr<SectionMemento> memento,
|
||||
const SectionShow ¶ms = SectionShow()) = 0;
|
||||
virtual void showBackFromStack(
|
||||
const SectionShow ¶ms = SectionShow()) = 0;
|
||||
|
@ -301,7 +301,7 @@ public:
|
|||
bool confirmedLeaveOther = false);
|
||||
|
||||
void showSection(
|
||||
std::unique_ptr<SectionMemento> &&memento,
|
||||
std::shared_ptr<SectionMemento> memento,
|
||||
const SectionShow ¶ms = SectionShow()) override;
|
||||
void showBackFromStack(
|
||||
const SectionShow ¶ms = SectionShow()) override;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f98f0221416746f0beaf5a51e95674a90442c3d5
|
||||
Subproject commit b95d2b4b378092daf3acb493515ff41a8e21f003
|
|
@ -1 +1 @@
|
|||
Subproject commit a02c8923dc6d00bcb4f4c2b1470cd48e2743903a
|
||||
Subproject commit e08a0de35dd2d0bbf26d88d127ac7b80efb94150
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
|||
Subproject commit 1c2be0df28feb0c4629a1f37ccf7d23da2ff17c1
|
||||
Subproject commit ceb5808939cf770c33be996ab3a1d38a998bf16d
|
Loading…
Add table
Reference in a new issue