From 2ed3543b53ccca7b22a4abc2f17876205530e2b9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 27 May 2021 16:54:24 +0300 Subject: [PATCH] Renamed class back from AdaptiveModern to Adaptive. --- .../SourceFiles/history/history_widget.cpp | 4 +-- .../view/history_view_pinned_section.cpp | 4 +-- .../view/history_view_replies_section.cpp | 4 +-- Telegram/SourceFiles/mainwidget.cpp | 6 ++--- .../SourceFiles/settings/settings_chat.cpp | 4 +-- .../SourceFiles/window/window_adaptive.cpp | 26 +++++++++---------- Telegram/SourceFiles/window/window_adaptive.h | 4 +-- .../SourceFiles/window/window_controller.cpp | 4 +-- .../SourceFiles/window/window_controller.h | 4 +-- .../window/window_session_controller.cpp | 10 +++---- .../window/window_session_controller.h | 4 +-- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index d2b70d214..ac80baef5 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4087,8 +4087,8 @@ void HistoryWidget::toggleTabbedSelectorMode() { void HistoryWidget::recountChatWidth() { const auto layout = (width() < st::adaptiveChatWideWidth) - ? Window::AdaptiveModern::ChatLayout::Normal - : Window::AdaptiveModern::ChatLayout::Wide; + ? Window::Adaptive::ChatLayout::Normal + : Window::Adaptive::ChatLayout::Wide; controller()->adaptive().setChatLayout(layout); } diff --git a/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp b/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp index 339b486bd..ba0782a7a 100644 --- a/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp @@ -393,8 +393,8 @@ void PinnedWidget::resizeEvent(QResizeEvent *e) { void PinnedWidget::recountChatWidth() { auto layout = (width() < st::adaptiveChatWideWidth) - ? Window::AdaptiveModern::ChatLayout::Normal - : Window::AdaptiveModern::ChatLayout::Wide; + ? Window::Adaptive::ChatLayout::Normal + : Window::Adaptive::ChatLayout::Wide; controller()->adaptive().setChatLayout(layout); } diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index aaf594b5e..a925a57d0 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1464,8 +1464,8 @@ void RepliesWidget::resizeEvent(QResizeEvent *e) { void RepliesWidget::recountChatWidth() { auto layout = (width() < st::adaptiveChatWideWidth) - ? Window::AdaptiveModern::ChatLayout::Normal - : Window::AdaptiveModern::ChatLayout::Wide; + ? Window::Adaptive::ChatLayout::Normal + : Window::Adaptive::ChatLayout::Wide; controller()->adaptive().setChatLayout(layout); } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index d7aeff77a..4d094ba41 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2656,7 +2656,7 @@ void MainWidget::updateWindowAdaptiveLayout() { // Check if we are in a single-column layout in a wide enough window // for the normal layout. If so, switch to the normal layout. - if (layout.windowLayout == Window::AdaptiveModern::WindowLayout::OneColumn) { + if (layout.windowLayout == Window::Adaptive::WindowLayout::OneColumn) { auto chatWidth = layout.chatWidth; //if (session().settings().tabbedSelectorSectionEnabled() // && chatWidth >= _history->minimalWidthForTabbedSelectorSection()) { @@ -2666,7 +2666,7 @@ void MainWidget::updateWindowAdaptiveLayout() { + st::columnMinimalWidthMain; if (chatWidth >= minimalNormalWidth) { // Switch layout back to normal in a wide enough window. - layout.windowLayout = Window::AdaptiveModern::WindowLayout::Normal; + layout.windowLayout = Window::Adaptive::WindowLayout::Normal; layout.dialogsWidth = st::columnMinimalWidthLeft; layout.chatWidth = layout.bodyWidth - layout.dialogsWidth; dialogsWidthRatio = float64(layout.dialogsWidth) / layout.bodyWidth; @@ -2676,7 +2676,7 @@ void MainWidget::updateWindowAdaptiveLayout() { // Check if we are going to create the third column and shrink the // dialogs widget to provide a wide enough chat history column. // Don't shrink the column on the first call, when window is inited. - if (layout.windowLayout == Window::AdaptiveModern::WindowLayout::ThreeColumn + if (layout.windowLayout == Window::Adaptive::WindowLayout::ThreeColumn && _controller->widget()->positionInited()) { //auto chatWidth = layout.chatWidth; //if (_history->willSwitchToTabbedSelectorWithWidth(chatWidth)) { diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index 9434d6499..7cad61674 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -969,8 +969,8 @@ void SetupChatBackground( }, tile->lifetime()); adaptive->toggleOn(controller->adaptive().chatLayoutValue( - ) | rpl::map([](Window::AdaptiveModern::ChatLayout layout) { - return (layout == Window::AdaptiveModern::ChatLayout::Wide); + ) | rpl::map([](Window::Adaptive::ChatLayout layout) { + return (layout == Window::Adaptive::ChatLayout::Wide); })); adaptive->entity()->checkedChanges( diff --git a/Telegram/SourceFiles/window/window_adaptive.cpp b/Telegram/SourceFiles/window/window_adaptive.cpp index 2285a7bdb..6e63d0fe0 100644 --- a/Telegram/SourceFiles/window/window_adaptive.cpp +++ b/Telegram/SourceFiles/window/window_adaptive.cpp @@ -15,57 +15,57 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Window { -AdaptiveModern::AdaptiveModern() = default; +Adaptive::Adaptive() = default; -void AdaptiveModern::setWindowLayout(WindowLayout value) { +void Adaptive::setWindowLayout(WindowLayout value) { _layout = value; } -void AdaptiveModern::setChatLayout(ChatLayout value) { +void Adaptive::setChatLayout(ChatLayout value) { _chatLayout = value; } -rpl::producer<> AdaptiveModern::changed() const { +rpl::producer<> Adaptive::changed() const { return rpl::merge( Core::App().settings().adaptiveForWideValue() | rpl::to_empty, _chatLayout.changes() | rpl::to_empty, _layout.changes() | rpl::to_empty); } -rpl::producer AdaptiveModern::oneColumnValue() const { +rpl::producer Adaptive::oneColumnValue() const { return _layout.value( ) | rpl::map([=] { return isOneColumn(); }); } -rpl::producer AdaptiveModern::chatLayoutValue() const { +rpl::producer Adaptive::chatLayoutValue() const { return _chatLayout.value(); } -bool AdaptiveModern::isOneColumn() const { +bool Adaptive::isOneColumn() const { return _layout.current() == WindowLayout::OneColumn; } -bool AdaptiveModern::isNormal() const { +bool Adaptive::isNormal() const { return _layout.current() == WindowLayout::Normal; } -bool AdaptiveModern::isThreeColumn() const { +bool Adaptive::isThreeColumn() const { return _layout.current() == WindowLayout::ThreeColumn; } -rpl::producer AdaptiveModern::chatWideValue() const { +rpl::producer Adaptive::chatWideValue() const { return rpl::combine( _chatLayout.value( - ) | rpl::map(rpl::mappers::_1 == AdaptiveModern::ChatLayout::Wide), + ) | rpl::map(rpl::mappers::_1 == Adaptive::ChatLayout::Wide), Core::App().settings().adaptiveForWideValue() ) | rpl::map(rpl::mappers::_1 && rpl::mappers::_2); } -bool AdaptiveModern::isChatWide() const { +bool Adaptive::isChatWide() const { return Core::App().settings().adaptiveForWide() - && (_chatLayout.current() == AdaptiveModern::ChatLayout::Wide); + && (_chatLayout.current() == Adaptive::ChatLayout::Wide); } } // namespace Window diff --git a/Telegram/SourceFiles/window/window_adaptive.h b/Telegram/SourceFiles/window/window_adaptive.h index d6c7c3a20..432ea9667 100644 --- a/Telegram/SourceFiles/window/window_adaptive.h +++ b/Telegram/SourceFiles/window/window_adaptive.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Window { -class AdaptiveModern { +class Adaptive { public: enum class WindowLayout { OneColumn, @@ -22,7 +22,7 @@ public: Wide, }; - AdaptiveModern(); + Adaptive(); void setWindowLayout(WindowLayout value); void setChatLayout(ChatLayout value); diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp index 0aeefca1b..a317f60c7 100644 --- a/Telegram/SourceFiles/window/window_controller.cpp +++ b/Telegram/SourceFiles/window/window_controller.cpp @@ -41,7 +41,7 @@ namespace Window { Controller::Controller() : _widget(this) -, _adaptive(std::make_unique()) +, _adaptive(std::make_unique()) , _isActiveTimer([=] { updateIsActive(); }) { _widget.init(); } @@ -368,7 +368,7 @@ void Controller::showLogoutConfirmation() { callback)); } -Window::AdaptiveModern &Controller::adaptive() const { +Window::Adaptive &Controller::adaptive() const { return *_adaptive; } diff --git a/Telegram/SourceFiles/window/window_controller.h b/Telegram/SourceFiles/window/window_controller.h index 00d4667fa..1fa3c997d 100644 --- a/Telegram/SourceFiles/window/window_controller.h +++ b/Telegram/SourceFiles/window/window_controller.h @@ -40,7 +40,7 @@ public: } [[nodiscard]] bool locked() const; - [[nodiscard]] AdaptiveModern &adaptive() const; + [[nodiscard]] Adaptive &adaptive() const; void finishFirstShow(); @@ -93,7 +93,7 @@ private: Main::Account *_account = nullptr; ::MainWindow _widget; - const std::unique_ptr _adaptive; + const std::unique_ptr _adaptive; std::unique_ptr _sessionController; base::Timer _isActiveTimer; QPointer _termsBox; diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index cd81876e6..aace39cad 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -803,7 +803,7 @@ bool SessionController::forceWideDialogs() const { } auto SessionController::computeColumnLayout() const -> ColumnLayout { - auto layout = AdaptiveModern::WindowLayout::OneColumn; + auto layout = Adaptive::WindowLayout::OneColumn; auto bodyWidth = widget()->bodyWidget()->width() - filtersWidth(); auto dialogsWidth = 0, chatWidth = 0, thirdWidth = 0; @@ -832,12 +832,12 @@ auto SessionController::computeColumnLayout() const -> ColumnLayout { if (useOneColumnLayout()) { dialogsWidth = chatWidth = bodyWidth; } else if (useNormalLayout()) { - layout = AdaptiveModern::WindowLayout::Normal; + layout = Adaptive::WindowLayout::Normal; dialogsWidth = countDialogsWidthFromRatio(bodyWidth); accumulate_min(dialogsWidth, bodyWidth - st::columnMinimalWidthMain); chatWidth = bodyWidth - dialogsWidth; } else { - layout = AdaptiveModern::WindowLayout::ThreeColumn; + layout = Adaptive::WindowLayout::ThreeColumn; dialogsWidth = countDialogsWidthFromRatio(bodyWidth); thirdWidth = countThirdColumnWidthFromRatio(bodyWidth); auto shrink = shrinkDialogsAndThirdColumns( @@ -960,7 +960,7 @@ void SessionController::closeThirdSection() { auto &settings = Core::App().settings(); auto newWindowSize = widget()->size(); auto layout = computeColumnLayout(); - if (layout.windowLayout == AdaptiveModern::WindowLayout::ThreeColumn) { + if (layout.windowLayout == Adaptive::WindowLayout::ThreeColumn) { auto noResize = widget()->isFullScreen() || widget()->isMaximized(); auto savedValue = settings.thirdSectionExtendedBy(); @@ -1206,7 +1206,7 @@ void SessionController::showNewChannel() { Ui::LayerOption::KeepOther); } -Window::AdaptiveModern &SessionController::adaptive() const { +Window::Adaptive &SessionController::adaptive() const { return _window->adaptive(); } diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 1b7eaa4b9..f4f21ea97 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -239,7 +239,7 @@ public: } [[nodiscard]] not_null<::MainWindow*> widget() const; [[nodiscard]] not_null content() const; - [[nodiscard]] AdaptiveModern &adaptive() const; + [[nodiscard]] Adaptive &adaptive() const; // We need access to this from MainWidget::MainWidget, where // we can't call content() yet. @@ -287,7 +287,7 @@ public: int dialogsWidth; int chatWidth; int thirdWidth; - AdaptiveModern::WindowLayout windowLayout; + Adaptive::WindowLayout windowLayout; }; [[nodiscard]] ColumnLayout computeColumnLayout() const; int dialogsSmallColumnWidth() const;