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