PageRenderTime 523ms CodeModel.GetById 186ms app.highlight 104ms RepoModel.GetById 229ms app.codeStats 1ms

/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
  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
 27#ifndef LL_LLPANELGROUPROLES_H
 28#define LL_LLPANELGROUPROLES_H
 29
 30#include "llpanelgroup.h"
 31
 32class LLFilterEditor;
 33class LLNameListCtrl;
 34class LLPanelGroupSubTab;
 35class LLPanelGroupMembersSubTab;
 36class LLPanelGroupRolesSubTab;
 37class LLPanelGroupActionsSubTab;
 38class LLScrollListCtrl;
 39class LLScrollListItem;
 40class LLTextEditor;
 41
 42// Forward declare for friend usage.
 43//virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*);
 44
 45typedef std::map<std::string,std::string> icon_map_t;
 46
 47class LLPanelGroupRoles : public LLPanelGroupTab
 48{
 49public:
 50	LLPanelGroupRoles();
 51	virtual ~LLPanelGroupRoles();
 52
 53	// Allow sub tabs to ask for sibling controls.
 54	friend class LLPanelGroupMembersSubTab;
 55	friend class LLPanelGroupRolesSubTab;
 56	friend class LLPanelGroupActionsSubTab;
 57
 58	virtual BOOL postBuild();
 59	virtual BOOL isVisibleByAgent(LLAgent* agentp);
 60
 61	
 62	bool handleSubTabSwitch(const LLSD& data);
 63
 64	// Checks if the current tab needs to be applied, and tries to switch to the requested tab.
 65	BOOL attemptTransition();
 66	
 67	// Switches to the requested tab (will close() if requested is NULL)
 68	void transitionToTab();
 69
 70	// Used by attemptTransition to query the user's response to a tab that needs to apply. 
 71	bool handleNotifyCallback(const LLSD& notification, const LLSD& response);
 72	bool onModalClose(const LLSD& notification, const LLSD& response);
 73
 74	// Most of these messages are just passed on to the current sub-tab.
 75	virtual void activate();
 76	virtual void deactivate();
 77	virtual bool needsApply(std::string& mesg);
 78	virtual BOOL hasModal();
 79	virtual bool apply(std::string& mesg);
 80	virtual void cancel();
 81	virtual void update(LLGroupChange gc);
 82
 83	virtual void setGroupID(const LLUUID& id);
 84
 85protected:
 86	LLPanelGroupTab*		mCurrentTab;
 87	LLPanelGroupTab*		mRequestedTab;
 88	LLTabContainer*	mSubTabContainer;
 89	BOOL					mFirstUse;
 90
 91	std::string				mDefaultNeedsApplyMesg;
 92	std::string				mWantApplyMesg;
 93};
 94
 95class LLPanelGroupSubTab : public LLPanelGroupTab
 96{
 97public:
 98	LLPanelGroupSubTab();
 99	virtual ~LLPanelGroupSubTab();
100
101	virtual BOOL postBuild();
102
103	// This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
104	virtual BOOL postBuildSubTab(LLView* root);
105
106	virtual void setSearchFilter( const std::string& filter );
107
108	virtual void activate();
109	virtual void deactivate();
110
111	// Helper functions
112	bool matchesActionSearchFilter(std::string action);
113
114
115	void setFooterEnabled(BOOL enable);
116
117	virtual void setGroupID(const LLUUID& id);
118protected:
119	void buildActionsList(LLScrollListCtrl* ctrl,
120								 U64 allowed_by_some,
121								 U64 allowed_by_all,
122						  		 LLUICtrl::commit_callback_t commit_callback,
123								 BOOL show_all,
124								 BOOL filter,
125								 BOOL is_owner_role);
126	void buildActionCategory(LLScrollListCtrl* ctrl,
127									U64 allowed_by_some,
128									U64 allowed_by_all,
129									LLRoleActionSet* action_set,
130									LLUICtrl::commit_callback_t commit_callback,
131									BOOL show_all,
132									BOOL filter,
133									BOOL is_owner_role);
134
135protected:
136	LLPanel* mHeader;
137	LLPanel* mFooter;
138
139	LLFilterEditor*	mSearchEditor;
140
141	std::string mSearchFilter;
142
143	icon_map_t	mActionIcons;
144
145	bool mActivated;
146
147	void setOthersVisible(BOOL b);
148};
149
150class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
151{
152public:
153	LLPanelGroupMembersSubTab();
154	virtual ~LLPanelGroupMembersSubTab();
155
156	virtual BOOL postBuildSubTab(LLView* root);
157
158	static void onMemberSelect(LLUICtrl*, void*);
159	void handleMemberSelect();
160
161	static void onMemberDoubleClick(void*);
162	void handleMemberDoubleClick();
163
164	static void onInviteMember(void*);
165	void handleInviteMember();
166
167	static void onEjectMembers(void*);
168	void handleEjectMembers();
169	void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members);
170
171	static void onRoleCheck(LLUICtrl* check, void* user_data);
172	void handleRoleCheck(const LLUUID& role_id,
173						 LLRoleMemberChangeType type);
174
175	void applyMemberChanges();
176	bool addOwnerCB(const LLSD& notification, const LLSD& response);
177
178	virtual void activate();
179	virtual void deactivate();
180	virtual void cancel();
181	virtual bool needsApply(std::string& mesg);
182	virtual bool apply(std::string& mesg);
183	virtual void update(LLGroupChange gc);
184	void updateMembers();
185
186	virtual void draw();
187
188	virtual void setGroupID(const LLUUID& id);
189
190	void addMemberToList(LLUUID id, LLGroupMemberData* data);
191	void onNameCache(const LLUUID& update_id, const LLUUID& id);
192
193protected:
194	typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
195	typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
196
197	bool matchesSearchFilter(const std::string& fullname);
198
199	U64  getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
200	bool getRoleChangeType(const LLUUID& member_id,
201						   const LLUUID& role_id,
202						   LLRoleMemberChangeType& type);
203
204	LLNameListCtrl*		mMembersList;
205	LLScrollListCtrl*	mAssignedRolesList;
206	LLScrollListCtrl*	mAllowedActionsList;
207	LLButton*           mEjectBtn;
208
209	BOOL mChanged;
210	BOOL mPendingMemberUpdate;
211	BOOL mHasMatch;
212
213	// This id is generated after each user initiated member list update(opening Roles or changing filter)
214	LLUUID mUdpateSessionID;
215
216	member_role_changes_map_t mMemberRoleChangeData;
217	U32 mNumOwnerAdditions;
218
219	LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
220};
221
222class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
223{
224public:
225	LLPanelGroupRolesSubTab();
226	virtual ~LLPanelGroupRolesSubTab();
227
228	virtual BOOL postBuildSubTab(LLView* root);
229
230	virtual void activate();
231	virtual void deactivate();
232	virtual bool needsApply(std::string& mesg);
233	virtual bool apply(std::string& mesg);
234	virtual void cancel();
235	bool matchesSearchFilter(std::string rolename, std::string roletitle);
236	virtual void update(LLGroupChange gc);
237
238	static void onRoleSelect(LLUICtrl*, void*);
239	void handleRoleSelect();
240	void buildMembersList();
241
242	static void onActionCheck(LLUICtrl*, void*);
243	bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check);
244
245	static void onPropertiesKey(LLLineEditor*, void*);
246
247	void onDescriptionKeyStroke(LLTextEditor* caller);
248
249	static void onDescriptionCommit(LLUICtrl*, void*);
250
251	static void onMemberVisibilityChange(LLUICtrl*, void*);
252	void handleMemberVisibilityChange(bool value);
253
254	static void onCreateRole(void*);
255	void handleCreateRole();
256
257	static void onDeleteRole(void*);
258	void handleDeleteRole();
259
260	void saveRoleChanges(bool select_saved_role);
261
262	virtual void setGroupID(const LLUUID& id);
263protected:
264	void handleActionCheck(LLUICtrl* ctrl, bool force);
265	LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
266
267	LLScrollListCtrl* mRolesList;
268	LLNameListCtrl* mAssignedMembersList;
269	LLScrollListCtrl* mAllowedActionsList;
270
271	LLLineEditor* mRoleName;
272	LLLineEditor* mRoleTitle;
273	LLTextEditor* mRoleDescription;
274
275	LLCheckBoxCtrl* mMemberVisibleCheck;
276	LLButton*       mDeleteRoleButton;
277	LLButton*       mCreateRoleButton;
278
279	LLUUID	mSelectedRole;
280	BOOL	mHasRoleChange;
281	std::string mRemoveEveryoneTxt;
282};
283
284class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab
285{
286public:
287	LLPanelGroupActionsSubTab();
288	virtual ~LLPanelGroupActionsSubTab();
289
290	virtual BOOL postBuildSubTab(LLView* root);
291
292
293	virtual void activate();
294	virtual void deactivate();
295	virtual bool needsApply(std::string& mesg);
296	virtual bool apply(std::string& mesg);
297	virtual void update(LLGroupChange gc);
298
299	void handleActionSelect();
300
301	virtual void setGroupID(const LLUUID& id);
302protected:
303	LLScrollListCtrl*	mActionList;
304	LLScrollListCtrl*	mActionRoles;
305	LLNameListCtrl*		mActionMembers;
306
307	LLTextEditor*	mActionDescription;
308};
309
310
311#endif // LL_LLPANELGROUPROLES_H