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"
|
|
|
|
#include "data/data_peer.h"
|
|
|
|
|
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 {
|
|
|
|
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 {
|
|
|
|
MTPDchatBannedRights::Flags rights;
|
|
|
|
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);
|
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
|
|
|
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
EditFlagsControl<MTPDchatBannedRights::Flags> CreateEditRestrictions(
|
|
|
|
QWidget *parent,
|
2019-06-18 12:16:43 +00:00
|
|
|
rpl::producer<QString> header,
|
2019-01-07 12:55:49 +00:00
|
|
|
MTPDchatBannedRights::Flags restrictions,
|
2019-01-21 10:22:18 +00:00
|
|
|
std::map<MTPDchatBannedRights::Flags, QString> disabledMessages);
|
2019-01-07 12:55:49 +00:00
|
|
|
|
|
|
|
EditFlagsControl<MTPDchatAdminRights::Flags> CreateEditAdminRights(
|
|
|
|
QWidget *parent,
|
2019-06-18 12:16:43 +00:00
|
|
|
rpl::producer<QString> header,
|
2019-01-07 12:55:49 +00:00
|
|
|
MTPDchatAdminRights::Flags rights,
|
2019-01-21 10:22:18 +00:00
|
|
|
std::map<MTPDchatAdminRights::Flags, QString> disabledMessages,
|
2019-01-07 12:55:49 +00:00
|
|
|
bool isGroup,
|
|
|
|
bool anyoneCanAddMembers);
|
2019-01-14 06:34:51 +00:00
|
|
|
|
|
|
|
ChatAdminRights DisabledByDefaultRestrictions(not_null<PeerData*> peer);
|
2019-02-13 12:18:03 +00:00
|
|
|
ChatRestrictions FixDependentRestrictions(ChatRestrictions restrictions);
|
2020-10-23 14:37:27 +00:00
|
|
|
ChatAdminRights AdminRightsForOwnershipTransfer(bool isGroup);
|