2019-01-07 12:55:49 +00:00
|
|
|
/*
|
|
|
|
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"
|
2021-11-21 19:48:08 +00:00
|
|
|
#include "data/data_chat_participant_status.h"
|
2019-01-07 12:55:49 +00:00
|
|
|
|
2019-01-08 10:54:18 +00:00
|
|
|
namespace Ui {
|
|
|
|
class RoundButton;
|
|
|
|
class VerticalLayout;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2020-06-23 17:21:58 +00:00
|
|
|
namespace Window {
|
2022-02-20 10:42:12 +00:00
|
|
|
class SessionController;
|
2020-06-23 17:21:58 +00:00
|
|
|
class SessionNavigation;
|
|
|
|
} // namespace Window
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
class EditPeerPermissionsBox : public Ui::BoxContent {
|
2019-01-08 10:54:18 +00:00
|
|
|
public:
|
2020-06-23 17:21:58 +00:00
|
|
|
EditPeerPermissionsBox(
|
|
|
|
QWidget*,
|
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
|
|
|
not_null<PeerData*> peer);
|
2019-01-08 10:54:18 +00:00
|
|
|
|
2019-07-16 11:46:50 +00:00
|
|
|
struct Result {
|
2021-07-08 10:34:06 +00:00
|
|
|
ChatRestrictions rights;
|
2019-07-16 11:46:50 +00:00
|
|
|
int slowmodeSeconds = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
rpl::producer<Result> saveEvents() const;
|
2019-01-08 10:54:18 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
private:
|
2019-07-16 11:46:50 +00:00
|
|
|
Fn<int()> addSlowmodeSlider(not_null<Ui::VerticalLayout*> container);
|
2019-07-15 16:45:18 +00:00
|
|
|
void addSlowmodeLabels(not_null<Ui::VerticalLayout*> container);
|
2021-02-12 13:32:45 +00:00
|
|
|
void addSuggestGigagroup(not_null<Ui::VerticalLayout*> container);
|
2019-01-10 06:26:08 +00:00
|
|
|
void addBannedButtons(not_null<Ui::VerticalLayout*> container);
|
2019-01-08 10:54:18 +00:00
|
|
|
|
2020-06-23 17:21:58 +00:00
|
|
|
const not_null<Window::SessionNavigation*> _navigation;
|
|
|
|
const not_null<PeerData*> _peer;
|
2019-01-08 10:54:18 +00:00
|
|
|
Ui::RoundButton *_save = nullptr;
|
2019-07-16 11:46:50 +00:00
|
|
|
Fn<Result()> _value;
|
2019-01-08 10:54:18 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-02-19 13:53:20 +00:00
|
|
|
[[nodiscard]] Fn<void()> AboutGigagroupCallback(
|
2022-02-20 10:42:12 +00:00
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
not_null<Window::SessionController*> controller);
|
2021-02-19 13:53:20 +00:00
|
|
|
|
2022-10-24 07:23:21 +00:00
|
|
|
struct RestrictionLabel {
|
|
|
|
ChatRestrictions flags;
|
|
|
|
QString label;
|
|
|
|
};
|
|
|
|
[[nodiscard]] std::vector<RestrictionLabel> RestrictionLabels(
|
|
|
|
Data::RestrictionsSetOptions options);
|
|
|
|
|
|
|
|
struct AdminRightLabel {
|
|
|
|
ChatAdminRights flags;
|
|
|
|
QString label;
|
|
|
|
};
|
|
|
|
[[nodiscard]] std::vector<AdminRightLabel> AdminRightLabels(
|
|
|
|
Data::AdminRightsSetOptions options);
|
|
|
|
|
2019-01-07 12:55:49 +00:00
|
|
|
template <typename Flags>
|
|
|
|
struct EditFlagsControl {
|
|
|
|
object_ptr<Ui::RpWidget> widget;
|
|
|
|
Fn<Flags()> value;
|
|
|
|
rpl::producer<Flags> changes;
|
|
|
|
};
|
|
|
|
|
2022-10-24 07:23:21 +00:00
|
|
|
[[nodiscard]] EditFlagsControl<ChatRestrictions> CreateEditRestrictions(
|
2019-01-07 12:55:49 +00:00
|
|
|
QWidget *parent,
|
2019-06-18 12:16:43 +00:00
|
|
|
rpl::producer<QString> header,
|
2021-07-08 10:34:06 +00:00
|
|
|
ChatRestrictions restrictions,
|
2022-10-24 07:23:21 +00:00
|
|
|
std::map<ChatRestrictions, QString> disabledMessages,
|
|
|
|
Data::RestrictionsSetOptions options);
|
2019-01-07 12:55:49 +00:00
|
|
|
|
2022-10-24 07:23:21 +00:00
|
|
|
[[nodiscard]] EditFlagsControl<ChatAdminRights> CreateEditAdminRights(
|
2019-01-07 12:55:49 +00:00
|
|
|
QWidget *parent,
|
2019-06-18 12:16:43 +00:00
|
|
|
rpl::producer<QString> header,
|
2021-07-08 10:34:06 +00:00
|
|
|
ChatAdminRights rights,
|
|
|
|
std::map<ChatAdminRights, QString> disabledMessages,
|
2022-10-24 07:23:21 +00:00
|
|
|
Data::AdminRightsSetOptions options);
|
|
|
|
|
|
|
|
[[nodiscard]] ChatAdminRights DisabledByDefaultRestrictions(
|
|
|
|
not_null<PeerData*> peer);
|
|
|
|
[[nodiscard]] ChatRestrictions FixDependentRestrictions(
|
|
|
|
ChatRestrictions restrictions);
|
|
|
|
[[nodiscard]] ChatAdminRights AdminRightsForOwnershipTransfer(
|
|
|
|
Data::AdminRightsSetOptions options);
|