From 546dfb08ef734895eeb346567d76032732e8aaee Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 5 May 2022 15:57:52 +0300 Subject: [PATCH] Moved out info in Folders settings from pinned content. --- .../SourceFiles/settings/settings_folders.cpp | 81 ++++++++++--------- .../SourceFiles/settings/settings_folders.h | 3 - 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Telegram/SourceFiles/settings/settings_folders.cpp b/Telegram/SourceFiles/settings/settings_folders.cpp index ce3f4e51d..a39faebfd 100644 --- a/Telegram/SourceFiles/settings/settings_folders.cpp +++ b/Telegram/SourceFiles/settings/settings_folders.cpp @@ -567,6 +567,46 @@ void FilterRowButton::paintEvent(QPaintEvent *e) { }; } +void SetupTopContent( + not_null parent, + rpl::producer<> showFinished) { + const auto divider = Ui::CreateChild(parent.get()); + const auto verticalLayout = parent->add( + object_ptr(parent.get())); + + auto icon = CreateLottieIcon( + verticalLayout, + { + .name = u"filters"_q, + .sizeOverride = { + st::settingsFilterIconSize, + st::settingsFilterIconSize, + }, + }, + st::settingsFilterIconPadding); + std::move( + showFinished + ) | rpl::start_with_next([animate = std::move(icon.animate)] { + animate(anim::repeat::once); + }, verticalLayout->lifetime()); + verticalLayout->add(std::move(icon.widget)); + + verticalLayout->add( + object_ptr>( + verticalLayout, + object_ptr( + verticalLayout, + tr::lng_filters_about(), + st::settingsFilterDividerLabel)), + st::settingsFilterDividerLabelPadding); + + verticalLayout->geometryValue( + ) | rpl::start_with_next([=](const QRect &r) { + divider->setGeometry(r); + }, divider->lifetime()); + +} + } // namespace Folders::Folders( @@ -591,6 +631,8 @@ void Folders::setupContent(not_null controller) { const auto content = Ui::CreateChild(this); + SetupTopContent(content, _showFinished.events()); + _save = SetupFoldersContent(controller, content); Ui::ResizeFitChild(this, content); @@ -600,43 +642,4 @@ void Folders::showFinished() { _showFinished.fire({}); } -QPointer Folders::createPinnedToTop(not_null parent) { - const auto divider = Ui::CreateChild(parent.get()); - const auto verticalLayout = Ui::CreateChild(divider); - - auto icon = CreateLottieIcon( - this, - { - .name = u"filters"_q, - .sizeOverride = { - st::settingsFilterIconSize, - st::settingsFilterIconSize, - }, - }, - st::settingsFilterIconPadding); - _showFinished.events( - ) | rpl::start_with_next([animate = std::move(icon.animate)] { - animate(anim::repeat::once); - }, verticalLayout->lifetime()); - verticalLayout->add(std::move(icon.widget)); - - verticalLayout->add( - object_ptr>( - verticalLayout, - object_ptr( - verticalLayout, - tr::lng_filters_about(), - st::settingsFilterDividerLabel)), - st::settingsFilterDividerLabelPadding); - - verticalLayout->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { - divider->resize(s); - }, divider->lifetime()); - - verticalLayout->resizeToWidth(parent->width()); - - return Ui::MakeWeak(not_null{ verticalLayout }); -} - } // namespace Settings diff --git a/Telegram/SourceFiles/settings/settings_folders.h b/Telegram/SourceFiles/settings/settings_folders.h index 93db52d4f..98447aa08 100644 --- a/Telegram/SourceFiles/settings/settings_folders.h +++ b/Telegram/SourceFiles/settings/settings_folders.h @@ -22,9 +22,6 @@ public: [[nodiscard]] rpl::producer title() override; - [[nodiscard]] QPointer createPinnedToTop( - not_null parent) override; - private: void setupContent(not_null controller);