1 // Copyright 2005-2019 The Mumble Developers. All rights reserved. 2 // Use of this source code is governed by a BSD-style license 3 // that can be found in the LICENSE file at the root of the 4 // Mumble source tree or at <https://www.mumble.info/LICENSE>. 5 6 #ifndef MUMBLE_MUMBLE_ACLEDITOR_H_ 7 #define MUMBLE_MUMBLE_ACLEDITOR_H_ 8 9 #include "ACL.h" 10 #include "Group.h" 11 #include "Mumble.pb.h" 12 13 #include "ui_ACLEditor.h" 14 15 class ACLGroup : public Group { 16 private: 17 Q_DISABLE_COPY(ACLGroup) 18 public: 19 bool bInherited; 20 ACLGroup(const QString &name); 21 }; 22 23 class ACLEditor : public QDialog, public Ui::ACLEditor { 24 private: 25 Q_OBJECT 26 Q_DISABLE_COPY(ACLEditor) 27 protected: 28 typedef QPair<QString, int> idname; 29 MumbleProto::ACL msg; 30 enum WaitID { 31 GroupAdd, GroupRemove, GroupInherit, ACLList 32 }; 33 QHash<int, QString> qhNameCache; 34 QHash<QString, int> qhIDCache; 35 QHash<QString, int> qhNameWait; 36 37 int iUnknown; 38 39 void refill(WaitID what); 40 41 ACLGroup *currentGroup(); 42 ChanACL *currentACL(); 43 44 int iId; 45 bool bInheritACL; 46 QList<ChanACL *> qlACLs; 47 QList<ACLGroup *> qlGroups; 48 ChanACL *pcaPassword; 49 50 int numInheritACL; 51 int iChannel; 52 bool bAddChannelMode; 53 54 const QString userName(int id); 55 int id(const QString &uname); 56 57 QList<QCheckBox *> qlACLAllow; 58 QList<QCheckBox *> qlACLDeny; 59 QList<ChanACL::Perm> qlPerms; 60 61 void updatePasswordACL(void); 62 void updatePasswordField(void); 63 void showEvent(QShowEvent *) Q_DECL_OVERRIDE; 64 void fillWidgetFromSet(QListWidget *, const QSet<int> &); 65 public: 66 ACLEditor(int parentchannelid, QWidget *p = NULL); 67 ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p = NULL); 68 ~ACLEditor(); 69 void returnQuery(const MumbleProto::QueryUsers &mqu); 70 public slots: 71 void accept() Q_DECL_OVERRIDE; 72 public slots: 73 void refillACL(); 74 void refillGroupNames(); 75 void refillGroupAdd(); 76 void refillGroupRemove(); 77 void refillGroupInherit(); 78 void refillComboBoxes(); 79 void groupEnableCheck(); 80 void ACLEnableCheck(); 81 82 void on_qtwTab_currentChanged(int index); 83 void on_qlwACLs_currentRowChanged(); 84 void on_qpbACLAdd_clicked(); 85 void on_qpbACLRemove_clicked(); 86 void on_qpbACLUp_clicked(); 87 void on_qpbACLDown_clicked(); 88 void on_qcbACLInherit_clicked(bool checked); 89 void on_qcbACLApplyHere_clicked(bool checked); 90 void on_qcbACLApplySubs_clicked(bool checked); 91 void on_qcbACLGroup_activated(const QString &text); 92 void on_qcbACLUser_activated(); 93 void ACLPermissions_clicked(); 94 95 void on_qcbGroupList_activated(const QString &text); 96 void on_qcbGroupList_editTextChanged(const QString & text); 97 void on_qpbGroupAdd_clicked(); 98 void on_qpbGroupRemove_clicked(); 99 void on_qcbGroupInherit_clicked(bool checked); 100 void on_qcbGroupInheritable_clicked(bool checked); 101 void on_qpbGroupAddAdd_clicked(); 102 void on_qpbGroupAddRemove_clicked(); 103 void on_qpbGroupRemoveAdd_clicked(); 104 void on_qpbGroupRemoveRemove_clicked(); 105 void on_qpbGroupInheritRemove_clicked(); 106 }; 107 108 #endif 109