PageRenderTime 132ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llpanelgrouproles.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 311 lines | 198 code | 78 blank | 35 comment | 0 complexity | 92cf58e85d7492ed4c379fe3c4103d80 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpanelgrouproles.h
  3. * @brief Panel for roles information about a particular group.
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLPANELGROUPROLES_H
  27. #define LL_LLPANELGROUPROLES_H
  28. #include "llpanelgroup.h"
  29. class LLFilterEditor;
  30. class LLNameListCtrl;
  31. class LLPanelGroupSubTab;
  32. class LLPanelGroupMembersSubTab;
  33. class LLPanelGroupRolesSubTab;
  34. class LLPanelGroupActionsSubTab;
  35. class LLScrollListCtrl;
  36. class LLScrollListItem;
  37. class LLTextEditor;
  38. // Forward declare for friend usage.
  39. //virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*);
  40. typedef std::map<std::string,std::string> icon_map_t;
  41. class LLPanelGroupRoles : public LLPanelGroupTab
  42. {
  43. public:
  44. LLPanelGroupRoles();
  45. virtual ~LLPanelGroupRoles();
  46. // Allow sub tabs to ask for sibling controls.
  47. friend class LLPanelGroupMembersSubTab;
  48. friend class LLPanelGroupRolesSubTab;
  49. friend class LLPanelGroupActionsSubTab;
  50. virtual BOOL postBuild();
  51. virtual BOOL isVisibleByAgent(LLAgent* agentp);
  52. bool handleSubTabSwitch(const LLSD& data);
  53. // Checks if the current tab needs to be applied, and tries to switch to the requested tab.
  54. BOOL attemptTransition();
  55. // Switches to the requested tab (will close() if requested is NULL)
  56. void transitionToTab();
  57. // Used by attemptTransition to query the user's response to a tab that needs to apply.
  58. bool handleNotifyCallback(const LLSD& notification, const LLSD& response);
  59. bool onModalClose(const LLSD& notification, const LLSD& response);
  60. // Most of these messages are just passed on to the current sub-tab.
  61. virtual void activate();
  62. virtual void deactivate();
  63. virtual bool needsApply(std::string& mesg);
  64. virtual BOOL hasModal();
  65. virtual bool apply(std::string& mesg);
  66. virtual void cancel();
  67. virtual void update(LLGroupChange gc);
  68. virtual void setGroupID(const LLUUID& id);
  69. protected:
  70. LLPanelGroupTab* mCurrentTab;
  71. LLPanelGroupTab* mRequestedTab;
  72. LLTabContainer* mSubTabContainer;
  73. BOOL mFirstUse;
  74. std::string mDefaultNeedsApplyMesg;
  75. std::string mWantApplyMesg;
  76. };
  77. class LLPanelGroupSubTab : public LLPanelGroupTab
  78. {
  79. public:
  80. LLPanelGroupSubTab();
  81. virtual ~LLPanelGroupSubTab();
  82. virtual BOOL postBuild();
  83. // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
  84. virtual BOOL postBuildSubTab(LLView* root);
  85. virtual void setSearchFilter( const std::string& filter );
  86. virtual void activate();
  87. virtual void deactivate();
  88. // Helper functions
  89. bool matchesActionSearchFilter(std::string action);
  90. void setFooterEnabled(BOOL enable);
  91. virtual void setGroupID(const LLUUID& id);
  92. protected:
  93. void buildActionsList(LLScrollListCtrl* ctrl,
  94. U64 allowed_by_some,
  95. U64 allowed_by_all,
  96. LLUICtrl::commit_callback_t commit_callback,
  97. BOOL show_all,
  98. BOOL filter,
  99. BOOL is_owner_role);
  100. void buildActionCategory(LLScrollListCtrl* ctrl,
  101. U64 allowed_by_some,
  102. U64 allowed_by_all,
  103. LLRoleActionSet* action_set,
  104. LLUICtrl::commit_callback_t commit_callback,
  105. BOOL show_all,
  106. BOOL filter,
  107. BOOL is_owner_role);
  108. protected:
  109. LLPanel* mHeader;
  110. LLPanel* mFooter;
  111. LLFilterEditor* mSearchEditor;
  112. std::string mSearchFilter;
  113. icon_map_t mActionIcons;
  114. bool mActivated;
  115. void setOthersVisible(BOOL b);
  116. };
  117. class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
  118. {
  119. public:
  120. LLPanelGroupMembersSubTab();
  121. virtual ~LLPanelGroupMembersSubTab();
  122. virtual BOOL postBuildSubTab(LLView* root);
  123. static void onMemberSelect(LLUICtrl*, void*);
  124. void handleMemberSelect();
  125. static void onMemberDoubleClick(void*);
  126. void handleMemberDoubleClick();
  127. static void onInviteMember(void*);
  128. void handleInviteMember();
  129. static void onEjectMembers(void*);
  130. void handleEjectMembers();
  131. void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members);
  132. static void onRoleCheck(LLUICtrl* check, void* user_data);
  133. void handleRoleCheck(const LLUUID& role_id,
  134. LLRoleMemberChangeType type);
  135. void applyMemberChanges();
  136. bool addOwnerCB(const LLSD& notification, const LLSD& response);
  137. virtual void activate();
  138. virtual void deactivate();
  139. virtual void cancel();
  140. virtual bool needsApply(std::string& mesg);
  141. virtual bool apply(std::string& mesg);
  142. virtual void update(LLGroupChange gc);
  143. void updateMembers();
  144. virtual void draw();
  145. virtual void setGroupID(const LLUUID& id);
  146. void addMemberToList(LLUUID id, LLGroupMemberData* data);
  147. void onNameCache(const LLUUID& update_id, const LLUUID& id);
  148. protected:
  149. typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
  150. typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
  151. bool matchesSearchFilter(const std::string& fullname);
  152. U64 getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
  153. bool getRoleChangeType(const LLUUID& member_id,
  154. const LLUUID& role_id,
  155. LLRoleMemberChangeType& type);
  156. LLNameListCtrl* mMembersList;
  157. LLScrollListCtrl* mAssignedRolesList;
  158. LLScrollListCtrl* mAllowedActionsList;
  159. LLButton* mEjectBtn;
  160. BOOL mChanged;
  161. BOOL mPendingMemberUpdate;
  162. BOOL mHasMatch;
  163. // This id is generated after each user initiated member list update(opening Roles or changing filter)
  164. LLUUID mUdpateSessionID;
  165. member_role_changes_map_t mMemberRoleChangeData;
  166. U32 mNumOwnerAdditions;
  167. LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
  168. };
  169. class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
  170. {
  171. public:
  172. LLPanelGroupRolesSubTab();
  173. virtual ~LLPanelGroupRolesSubTab();
  174. virtual BOOL postBuildSubTab(LLView* root);
  175. virtual void activate();
  176. virtual void deactivate();
  177. virtual bool needsApply(std::string& mesg);
  178. virtual bool apply(std::string& mesg);
  179. virtual void cancel();
  180. bool matchesSearchFilter(std::string rolename, std::string roletitle);
  181. virtual void update(LLGroupChange gc);
  182. static void onRoleSelect(LLUICtrl*, void*);
  183. void handleRoleSelect();
  184. void buildMembersList();
  185. static void onActionCheck(LLUICtrl*, void*);
  186. bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check);
  187. static void onPropertiesKey(LLLineEditor*, void*);
  188. void onDescriptionKeyStroke(LLTextEditor* caller);
  189. static void onDescriptionCommit(LLUICtrl*, void*);
  190. static void onMemberVisibilityChange(LLUICtrl*, void*);
  191. void handleMemberVisibilityChange(bool value);
  192. static void onCreateRole(void*);
  193. void handleCreateRole();
  194. static void onDeleteRole(void*);
  195. void handleDeleteRole();
  196. void saveRoleChanges(bool select_saved_role);
  197. virtual void setGroupID(const LLUUID& id);
  198. protected:
  199. void handleActionCheck(LLUICtrl* ctrl, bool force);
  200. LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
  201. LLScrollListCtrl* mRolesList;
  202. LLNameListCtrl* mAssignedMembersList;
  203. LLScrollListCtrl* mAllowedActionsList;
  204. LLLineEditor* mRoleName;
  205. LLLineEditor* mRoleTitle;
  206. LLTextEditor* mRoleDescription;
  207. LLCheckBoxCtrl* mMemberVisibleCheck;
  208. LLButton* mDeleteRoleButton;
  209. LLButton* mCreateRoleButton;
  210. LLUUID mSelectedRole;
  211. BOOL mHasRoleChange;
  212. std::string mRemoveEveryoneTxt;
  213. };
  214. class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab
  215. {
  216. public:
  217. LLPanelGroupActionsSubTab();
  218. virtual ~LLPanelGroupActionsSubTab();
  219. virtual BOOL postBuildSubTab(LLView* root);
  220. virtual void activate();
  221. virtual void deactivate();
  222. virtual bool needsApply(std::string& mesg);
  223. virtual bool apply(std::string& mesg);
  224. virtual void update(LLGroupChange gc);
  225. void handleActionSelect();
  226. virtual void setGroupID(const LLUUID& id);
  227. protected:
  228. LLScrollListCtrl* mActionList;
  229. LLScrollListCtrl* mActionRoles;
  230. LLNameListCtrl* mActionMembers;
  231. LLTextEditor* mActionDescription;
  232. };
  233. #endif // LL_LLPANELGROUPROLES_H