Removed Adaptive namespace from Settings::Chat.

This commit is contained in:
23rd 2021-05-27 02:20:00 +03:00
parent 295a863d69
commit 9b488f03a1
3 changed files with 9 additions and 7 deletions

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/themes/window_themes_embedded.h"
#include "window/themes/window_theme_editor_box.h"
#include "window/themes/window_themes_cloud_list.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "window/window_controller.h"
#include "storage/localstorage.h"
@ -967,19 +968,15 @@ void SetupChatBackground(
tile->setChecked(tiled);
}, tile->lifetime());
adaptive->toggleOn(rpl::single(
rpl::empty_value()
) | rpl::then(base::ObservableViewer(
Adaptive::Changed()
)) | rpl::map([] {
return (Global::AdaptiveChatLayout() == Adaptive::ChatLayout::Wide);
adaptive->toggleOn(controller->adaptive().chatLayoutValue(
) | rpl::map([](Window::AdaptiveModern::ChatLayout layout) {
return (layout == Window::AdaptiveModern::ChatLayout::Wide);
}));
adaptive->entity()->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
Core::App().settings().setAdaptiveForWide(checked);
Core::App().saveSettingsDelayed();
Adaptive::Changed().notify();
}, adaptive->lifetime());
}

View file

@ -36,6 +36,10 @@ rpl::producer<bool> AdaptiveModern::oneColumnValue() const {
});
}
rpl::producer<AdaptiveModern::ChatLayout> AdaptiveModern::chatLayoutValue() const {
return _chatLayout.value();
}
bool AdaptiveModern::isOneColumn() const {
return _layout.current() == WindowLayout::OneColumn;
}

View file

@ -29,6 +29,7 @@ public:
[[nodiscard]] rpl::producer<> changed() const;
[[nodiscard]] rpl::producer<bool> oneColumnValue() const;
[[nodiscard]] rpl::producer<ChatLayout> chatLayoutValue() const;
[[nodiscard]] bool isOneColumn() const;
[[nodiscard]] bool isNormal() const;