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