mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 15:17:07 +02:00
Added ability to transfer variant data between nearest setting sections.
This commit is contained in:
parent
2eaa17b938
commit
fbd9437775
5 changed files with 21 additions and 2 deletions
Telegram/SourceFiles
|
@ -342,6 +342,14 @@ rpl::producer<SparseIdsMergedSlice> Controller::mediaSource(
|
|||
limitAfter);
|
||||
}
|
||||
|
||||
std::any &Controller::stepDataReference() {
|
||||
return _stepData;
|
||||
}
|
||||
|
||||
void Controller::takeStepData(not_null<Controller*> another) {
|
||||
_stepData = base::take(another->_stepData);
|
||||
}
|
||||
|
||||
Controller::~Controller() = default;
|
||||
|
||||
} // namespace Info
|
||||
|
|
|
@ -10,7 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <rpl/variable.h>
|
||||
#include "data/data_search_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "settings/settings_common.h"
|
||||
|
||||
namespace Ui {
|
||||
class SearchFieldController;
|
||||
|
@ -214,6 +213,9 @@ public:
|
|||
|
||||
void removeFromStack(const std::vector<Section> §ions) const;
|
||||
|
||||
void takeStepData(not_null<Controller*> another);
|
||||
std::any &stepDataReference();
|
||||
|
||||
rpl::lifetime &lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
|
@ -238,6 +240,9 @@ private:
|
|||
rpl::variable<bool> _seachEnabledByContent = false;
|
||||
bool _searchStartsFocused = false;
|
||||
|
||||
// Data between sections based on steps.
|
||||
std::any _stepData;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
|
|
@ -920,6 +920,9 @@ void WrapWidget::showNewContent(
|
|||
auto newController = createController(
|
||||
_controller->parentController(),
|
||||
memento);
|
||||
if (_controller && newController) {
|
||||
newController->takeStepData(_controller.get());
|
||||
}
|
||||
auto newContent = object_ptr<ContentWidget>(nullptr);
|
||||
if (needAnimation) {
|
||||
newContent = createContent(memento, newController.get());
|
||||
|
|
|
@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "info/settings/info_settings_widget.h"
|
||||
|
||||
#include "info/info_memento.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "settings/settings_main.h"
|
||||
#include "settings/settings_information.h"
|
||||
|
@ -60,6 +59,8 @@ Widget::Widget(
|
|||
controller->showBackFromStack();
|
||||
}, _inner->lifetime());
|
||||
|
||||
_inner->setStepDataReference(controller->stepDataReference());
|
||||
|
||||
_removesFromStack.events(
|
||||
) | rpl::start_with_next([=](const std::vector<Type> &types) {
|
||||
const auto sections = ranges::views::all(
|
||||
|
|
|
@ -100,6 +100,8 @@ public:
|
|||
not_null<Ui::RpWidget*> parent) {
|
||||
return nullptr;
|
||||
}
|
||||
virtual void setStepDataReference(std::any &data) {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename SectionType>
|
||||
|
|
Loading…
Add table
Reference in a new issue