/* 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/abstract_box.h" #include "data/data_chat_participant_status.h" namespace Ui { class RoundButton; class VerticalLayout; } // namespace Ui namespace Window { class SessionController; class SessionNavigation; } // namespace Window class EditPeerPermissionsBox : public Ui::BoxContent { public: EditPeerPermissionsBox( QWidget*, not_null navigation, not_null peer); struct Result { ChatRestrictions rights; int slowmodeSeconds = 0; }; rpl::producer saveEvents() const; protected: void prepare() override; private: Fn addSlowmodeSlider(not_null container); void addSlowmodeLabels(not_null container); void addSuggestGigagroup(not_null container); void addBannedButtons(not_null container); const not_null _navigation; const not_null _peer; Ui::RoundButton *_save = nullptr; Fn _value; }; [[nodiscard]] Fn AboutGigagroupCallback( not_null channel, not_null controller); struct RestrictionLabel { ChatRestrictions flags; QString label; }; [[nodiscard]] std::vector RestrictionLabels( Data::RestrictionsSetOptions options); struct AdminRightLabel { ChatAdminRights flags; QString label; }; [[nodiscard]] std::vector AdminRightLabels( Data::AdminRightsSetOptions options); template struct EditFlagsControl { object_ptr widget; Fn value; rpl::producer changes; }; [[nodiscard]] EditFlagsControl CreateEditRestrictions( QWidget *parent, rpl::producer header, ChatRestrictions restrictions, std::map disabledMessages, Data::RestrictionsSetOptions options); [[nodiscard]] EditFlagsControl CreateEditAdminRights( QWidget *parent, rpl::producer header, ChatAdminRights rights, std::map disabledMessages, Data::AdminRightsSetOptions options); [[nodiscard]] ChatAdminRights DisabledByDefaultRestrictions( not_null peer); [[nodiscard]] ChatRestrictions FixDependentRestrictions( ChatRestrictions restrictions); [[nodiscard]] ChatAdminRights AdminRightsForOwnershipTransfer( Data::AdminRightsSetOptions options);