From 48d790de5efff36053719609604daeed0f1fb31d Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 6 Mar 2020 16:20:50 +0400 Subject: [PATCH] Move main menu button to the side bar. --- Telegram/SourceFiles/dialogs/dialogs_widget.cpp | 3 ++- Telegram/SourceFiles/window/window.style | 2 ++ Telegram/SourceFiles/window/window_filters_menu.cpp | 12 +++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index d93369251..925d7ec24 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -259,6 +259,7 @@ Widget::Widget( Core::App().lockByPasscode(); _lockUnlock->setIconOverride(nullptr); }); + _mainMenuToggle->setVisible(!controller->filtersWidth()); _mainMenuToggle->setClickedCallback([this] { showMainMenu(); }); _chooseByDragTimer.setSingleShot(true); @@ -1500,7 +1501,7 @@ void Widget::updateControlsGeometry() { } auto smallLayoutWidth = (st::dialogsPadding.x() + st::dialogsPhotoSize + st::dialogsPadding.x()); auto smallLayoutRatio = (width() < st::columnMinimalWidthLeft) ? (st::columnMinimalWidthLeft - width()) / float64(st::columnMinimalWidthLeft - smallLayoutWidth) : 0.; - auto filterLeft = st::dialogsFilterPadding.x() + _mainMenuToggle->width() + st::dialogsFilterPadding.x(); + auto filterLeft = (controller()->filtersWidth() ? 0 : st::dialogsFilterPadding.x() + _mainMenuToggle->width()) + st::dialogsFilterPadding.x(); auto filterRight = (Global::LocalPasscode() ? (st::dialogsFilterPadding.x() + _lockUnlock->width()) : st::dialogsFilterSkip) + st::dialogsFilterPadding.x(); auto filterWidth = qMax(width(), st::columnMinimalWidthLeft) - filterLeft - filterRight; auto filterAreaHeight = st::topBarHeight; diff --git a/Telegram/SourceFiles/window/window.style b/Telegram/SourceFiles/window/window.style index df4300a30..8762e62a8 100644 --- a/Telegram/SourceFiles/window/window.style +++ b/Telegram/SourceFiles/window/window.style @@ -246,6 +246,8 @@ createThemeLink: InputField(defaultInputField) { } windowFiltersWidth: 72px; +windowFiltersMainMenu: icon {{ "dialogs_menu", sideBarIconFg }}; +windowFiltersMainMenuIconTop: 12px; windowFiltersIconTop: 8px; windowFiltersAll: icon {{ "filters_all", sideBarIconFg }}; windowFiltersAllActive: icon {{ "filters_all_active", sideBarIconFgActive }}; diff --git a/Telegram/SourceFiles/window/window_filters_menu.cpp b/Telegram/SourceFiles/window/window_filters_menu.cpp index 9a8105048..71c77dbc8 100644 --- a/Telegram/SourceFiles/window/window_filters_menu.cpp +++ b/Telegram/SourceFiles/window/window_filters_menu.cpp @@ -48,7 +48,9 @@ void FiltersMenu::setup() { _widget.activateRequests( ) | rpl::start_with_next([=](const QString &id) { - if (id == "setup") { + if (id == "main_menu") { + _session->widget()->showMainMenu(); + } else if (id == "setup") { } else if (const auto filterId = id.toInt()) { _session->setActiveChatsFilter(filterId); } else { @@ -59,6 +61,14 @@ void FiltersMenu::setup() { void FiltersMenu::refresh() { auto items = std::vector(); + items.push_back({ + "main_menu", + QString(), + QString(), + &st::windowFiltersMainMenu, + &st::windowFiltersMainMenu, + st::windowFiltersMainMenuIconTop + }); items.push_back({ QString::number(0), "All Chats",