From 7cd330db9abd26187bcd59dc4dc789a1822914b9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 9 Jan 2023 11:46:40 +0300 Subject: [PATCH] Improved style of box for creation of linked chat. --- .../boxes/peers/edit_linked_chat_box.cpp | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp index 31eb7336d..cdba89701 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp @@ -227,31 +227,6 @@ void Controller::choose(not_null chat) { return tr::lng_manage_discussion_group_about(Ui::Text::WithEntities); } -[[nodiscard]] object_ptr SetupCreateGroup( - not_null parent, - not_null navigation, - not_null channel, - Fn callback) { - Expects(channel->isBroadcast()); - - auto result = object_ptr( - parent, - tr::lng_manage_discussion_group_create( - ) | Ui::Text::ToUpper(), - st::infoCreateLinkedChatButton); - result->addClickHandler([=] { - const auto guarded = crl::guard(parent, callback); - Window::Show(navigation).showBox( - Box( - navigation, - GroupInfoBox::Type::Megagroup, - channel->name() + " Chat", - guarded), - Ui::LayerOption::KeepOther); - }); - return result; -} - [[nodiscard]] object_ptr EditLinkedChatBox( not_null navigation, not_null channel, @@ -294,8 +269,24 @@ void Controller::choose(not_null chat) { About(channel, chat), u"discussion"_q); if (!chat) { - above->add( - SetupCreateGroup(above, navigation, channel, callback)); + Assert(channel->isBroadcast()); + + Settings::AddSkip(above); + Settings::AddButton( + above, + tr::lng_manage_discussion_group_create(), + st::infoCreateLinkedChatButton, + { &st::settingsIconChat, Settings::kIconLightBlue } + )->addClickHandler([=, parent = above.data()] { + const auto guarded = crl::guard(parent, callback); + Window::Show(navigation).showBox( + Box( + navigation, + GroupInfoBox::Type::Megagroup, + channel->name() + " Chat", + guarded), + Ui::LayerOption::KeepOther); + }); } box->peerListSetAboveWidget(std::move(above));