diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 1cb4309aa..00f597231 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -824,6 +824,8 @@ PRIVATE history/history_view_highlight_manager.h history/history_widget.cpp history/history_widget.h + info/boosts/giveaway/giveaway_list_controllers.cpp + info/boosts/giveaway/giveaway_list_controllers.h info/boosts/create_giveaway_box.cpp info/boosts/create_giveaway_box.h info/boosts/info_boosts_inner_widget.cpp diff --git a/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp b/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp index 0e8b26133..626a01b78 100644 --- a/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp +++ b/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp @@ -10,10 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_premium.h" #include "base/call_delayed.h" #include "base/unixtime.h" -#include "boxes/peers/edit_participants_box.h" // ParticipantsBoxController #include "data/data_peer.h" -#include "data/data_subscription_option.h" -#include "data/data_user.h" +#include "info/boosts/giveaway/giveaway_list_controllers.h" #include "info/boosts/giveaway/giveaway_type_row.h" #include "info/boosts/giveaway/select_countries_box.h" #include "info/info_controller.h" @@ -49,38 +47,6 @@ namespace { return dateNow; } -class MembersListController : public ParticipantsBoxController { -public: - using ParticipantsBoxController::ParticipantsBoxController; - - void rowClicked(not_null row) override; - std::unique_ptr createRow( - not_null participant) const override; - base::unique_qptr rowContextMenu( - QWidget *parent, - not_null row) override; - -}; - -void MembersListController::rowClicked(not_null row) { - delegate()->peerListSetRowChecked(row, !row->checked()); -} - -std::unique_ptr MembersListController::createRow( - not_null participant) const { - const auto user = participant->asUser(); - if (!user || user->isInaccessible() || user->isBot() || user->isSelf()) { - return nullptr; - } - return std::make_unique(participant); -} - -base::unique_qptr MembersListController::rowContextMenu( - QWidget *parent, - not_null row) { - return nullptr; -} - } // namespace void CreateGiveawayBox( @@ -162,10 +128,9 @@ void CreateGiveawayBox( box->uiShow()->showBox( Box( - std::make_unique( + std::make_unique( controller, - peer, - ParticipantsRole::Members), + peer), std::move(initBox)), Ui::LayerOption::KeepOther); }); diff --git a/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp b/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp new file mode 100644 index 000000000..e9b7e50fe --- /dev/null +++ b/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp @@ -0,0 +1,41 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "info/boosts/giveaway/giveaway_list_controllers.h" + +#include "data/data_peer.h" +#include "data/data_user.h" +#include "lang/lang_keys.h" + +namespace Giveaway { + +AwardMembersListController::AwardMembersListController( + not_null navigation, + not_null peer) +: ParticipantsBoxController(navigation, peer, ParticipantsRole::Members) { +} + +void AwardMembersListController::rowClicked(not_null row) { + delegate()->peerListSetRowChecked(row, !row->checked()); +} + +std::unique_ptr AwardMembersListController::createRow( + not_null participant) const { + const auto user = participant->asUser(); + if (!user || user->isInaccessible() || user->isBot() || user->isSelf()) { + return nullptr; + } + return std::make_unique(participant); +} + +base::unique_qptr AwardMembersListController::rowContextMenu( + QWidget *parent, + not_null row) { + return nullptr; +} + +} // namespace Giveaway diff --git a/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.h b/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.h new file mode 100644 index 000000000..404b65433 --- /dev/null +++ b/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.h @@ -0,0 +1,40 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include "boxes/peers/edit_participants_box.h" + +class PeerData; +class PeerListRow; + +namespace Ui { +class PopupMenu; +} // namespace Ui + +namespace Window { +class SessionNavigation; +} // namespace Window + +namespace Giveaway { + +class AwardMembersListController : public ParticipantsBoxController { +public: + AwardMembersListController( + not_null navigation, + not_null peer); + + void rowClicked(not_null row) override; + std::unique_ptr createRow( + not_null participant) const override; + base::unique_qptr rowContextMenu( + QWidget *parent, + not_null row) override; + +}; + +} // namespace Giveaway