From bfa3655c7b29742efbded650193b61d1154ce72d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 3 May 2022 19:43:54 +0300 Subject: [PATCH] Removed unused code of box for filters choosing. --- .../SourceFiles/boxes/choose_filter_box.cpp | 82 ------------------- .../SourceFiles/boxes/choose_filter_box.h | 5 -- 2 files changed, 87 deletions(-) diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.cpp b/Telegram/SourceFiles/boxes/choose_filter_box.cpp index 1a0ac1a50f..d5efcde408 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/choose_filter_box.cpp @@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "main/main_session.h" #include "ui/filter_icons.h" -#include "ui/layers/generic_box.h" #include "ui/text/text_utilities.h" // Ui::Text::Bold #include "ui/toast/toast.h" #include "ui/widgets/buttons.h" @@ -27,46 +26,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { -class FolderButton : public Ui::SettingsButton { -public: - FolderButton( - not_null parent, - const Data::ChatFilter &filter); - -protected: - void paintEvent(QPaintEvent *e) override; - -private: - const Ui::FilterIcon _icon; - -}; - -FolderButton::FolderButton( - not_null parent, - const Data::ChatFilter &filter) -: SettingsButton( - parent, - rpl::single(filter.title()), - st::paymentsSectionButton) -, _icon(Ui::ComputeFilterIcon(filter)) { -} - -void FolderButton::paintEvent(QPaintEvent *e) { - SettingsButton::paintEvent(e); - - Painter p(this); - const auto over = isOver() || isDown(); - const auto icon = Ui::LookupFilterIcon(_icon).normal; - icon->paint( - p, - st::settingsFilterIconLeft, - (height() - icon->height()) / 2, - width(), - (over - ? st::dialogsUnreadBgMutedOver - : st::dialogsUnreadBgMuted)->c); -} - Data::ChatFilter ChangedFilter( const Data::ChatFilter &filter, not_null history, @@ -165,47 +124,6 @@ void ChooseFilterValidator::remove(FilterId filterId) const { ChangeFilterById(filterId, _history, false); } -void ChooseFilterBox( - not_null box, - not_null history) { - box->setTitle(tr::lng_filters_add_box_title()); - - const auto validator = ChooseFilterValidator(history); - - const auto container = box->verticalLayout()->add( - object_ptr(box->verticalLayout())); - - const auto rebuild = [=] { - while (container->count()) { - delete container->widgetAt(0); - } - for (const auto &filter : history->owner().chatsFilters().list()) { - if (filter.contains(history)) { - continue; - } - container->add( - object_ptr(box, filter), - style::margins() - )->setClickedCallback([=, id = filter.id()] { - validator.add(id); - box->closeBox(); - }); - } - container->resizeToWidth(box->verticalLayout()->width()); - if (!container->count()) { - box->closeBox(); - } - }; - - history->owner().chatsFilters().changed( - ) | rpl::start_with_next([=] { - rebuild(); - }, box->lifetime()); - rebuild(); - - box->addButton(tr::lng_close(), [=] { box->closeBox(); }); -} - void FillChooseFilterMenu( not_null menu, not_null history) { diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.h b/Telegram/SourceFiles/boxes/choose_filter_box.h index 2ebc1bbab1..03dac402ca 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.h +++ b/Telegram/SourceFiles/boxes/choose_filter_box.h @@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once namespace Ui { -class GenericBox; class PopupMenu; } // namespace Ui @@ -29,10 +28,6 @@ private: }; -void ChooseFilterBox( - not_null box, - not_null history); - void FillChooseFilterMenu( not_null menu, not_null history);