PageRenderTime 532ms CodeModel.GetById 185ms app.highlight 190ms RepoModel.GetById 152ms app.codeStats 0ms

/indra/newview/llfloaterregioninfo.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 453 lines | 288 code | 101 blank | 64 comment | 0 complexity | 6fe22d2d1d081767221d94abad3da4a4 MD5 | raw file
  1/** 
  2 * @file llfloaterregioninfo.h
  3 * @author Aaron Brashears
  4 * @brief Declaration of the region info and controls floater and panels.
  5 *
  6 * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  7 * Second Life Viewer Source Code
  8 * Copyright (C) 2010, Linden Research, Inc.
  9 * 
 10 * This library is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU Lesser General Public
 12 * License as published by the Free Software Foundation;
 13 * version 2.1 of the License only.
 14 * 
 15 * This library is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18 * Lesser General Public License for more details.
 19 * 
 20 * You should have received a copy of the GNU Lesser General Public
 21 * License along with this library; if not, write to the Free Software
 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 23 * 
 24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 25 * $/LicenseInfo$
 26 */
 27
 28#ifndef LL_LLFLOATERREGIONINFO_H
 29#define LL_LLFLOATERREGIONINFO_H
 30
 31#include <vector>
 32#include "llassettype.h"
 33#include "llfloater.h"
 34#include "llhost.h"
 35#include "llpanel.h"
 36
 37#include "llenvmanager.h" // for LLEnvironmentSettings
 38
 39class LLAvatarName;
 40class LLDispatcher;
 41class LLLineEditor;
 42class LLMessageSystem;
 43class LLPanelRegionInfo;
 44class LLTabContainer;
 45class LLViewerRegion;
 46class LLViewerTextEditor;
 47class LLInventoryItem;
 48class LLCheckBoxCtrl;
 49class LLComboBox;
 50class LLNameListCtrl;
 51class LLRadioGroup;
 52class LLSliderCtrl;
 53class LLSpinCtrl;
 54class LLTextBox;
 55class LLVFS;
 56
 57class LLPanelRegionGeneralInfo;
 58class LLPanelRegionDebugInfo;
 59class LLPanelRegionTerrainInfo;
 60class LLPanelEstateInfo;
 61class LLPanelEstateCovenant;
 62
 63class LLEventTimer;
 64class LLEnvironmentSettings;
 65class LLWLParamManager;
 66class LLWaterParamManager;
 67class LLWLParamSet;
 68class LLWaterParamSet;
 69
 70class LLFloaterRegionInfo : public LLFloater
 71{
 72	friend class LLFloaterReg;
 73public:
 74
 75
 76	/*virtual*/ void onOpen(const LLSD& key);
 77	/*virtual*/ BOOL postBuild();
 78
 79	static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
 80
 81	// get and process region info if necessary.
 82	static void processRegionInfo(LLMessageSystem* msg);
 83
 84	static const LLUUID& getLastInvoice() { return sRequestInvoice; }
 85	static void nextInvoice() { sRequestInvoice.generate(); }
 86	//static S32 getSerial() { return sRequestSerial; }
 87	//static void incrementSerial() { sRequestSerial++; }
 88
 89	static LLPanelEstateInfo* getPanelEstate();
 90	static LLPanelEstateCovenant* getPanelCovenant();
 91	static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
 92
 93	// from LLPanel
 94	virtual void refresh();
 95	
 96	void requestRegionInfo();
 97	void requestMeshRezInfo();
 98
 99private:
100	
101	LLFloaterRegionInfo(const LLSD& seed);
102	~LLFloaterRegionInfo();
103	
104protected:
105	void onTabSelected(const LLSD& param);
106	void refreshFromRegion(LLViewerRegion* region);
107
108	// member data
109	LLTabContainer* mTab;
110	typedef std::vector<LLPanelRegionInfo*> info_panels_t;
111	info_panels_t mInfoPanels;
112	//static S32 sRequestSerial;	// serial # of last EstateOwnerRequest
113	static LLUUID sRequestInvoice;
114};
115
116
117// Base class for all region information panels.
118class LLPanelRegionInfo : public LLPanel
119{
120public:
121	LLPanelRegionInfo();
122	
123	void onBtnSet();
124	void onChangeChildCtrl(LLUICtrl* ctrl);
125	void onChangeAnything();
126	static void onChangeText(LLLineEditor* caller, void* user_data);
127	
128	virtual bool refreshFromRegion(LLViewerRegion* region);
129	virtual bool estateUpdate(LLMessageSystem* msg) { return true; }
130	
131	virtual BOOL postBuild();
132	virtual void updateChild(LLUICtrl* child_ctrl);
133	
134	void enableButton(const std::string& btn_name, BOOL enable = TRUE);
135	void disableButton(const std::string& btn_name);
136	
137	void onClickManageTelehub();
138	
139protected:
140	void initCtrl(const std::string& name);
141	
142	// Returns TRUE if update sent and apply button should be
143	// disabled.
144	virtual BOOL sendUpdate() { return TRUE; }
145	
146	typedef std::vector<std::string> strings_t;
147	//typedef std::vector<U32> integers_t;
148	void sendEstateOwnerMessage(
149					 LLMessageSystem* msg,
150					 const std::string& request,
151					 const LLUUID& invoice,
152					 const strings_t& strings);
153	
154	// member data
155	LLHost mHost;
156};
157
158/////////////////////////////////////////////////////////////////////////////
159// Actual panels start here
160/////////////////////////////////////////////////////////////////////////////
161
162class LLPanelRegionGeneralInfo : public LLPanelRegionInfo
163{
164	
165public:
166	LLPanelRegionGeneralInfo()
167		:	LLPanelRegionInfo()	{}
168	~LLPanelRegionGeneralInfo() {}
169	
170	virtual bool refreshFromRegion(LLViewerRegion* region);
171	
172	// LLPanel
173	virtual BOOL postBuild();
174	
175protected:
176	virtual BOOL sendUpdate();
177	void onClickKick();
178	void onKickCommit(const uuid_vec_t& ids);
179	static void onClickKickAll(void* userdata);
180	bool onKickAllCommit(const LLSD& notification, const LLSD& response);
181	static void onClickMessage(void* userdata);
182	bool onMessageCommit(const LLSD& notification, const LLSD& response);
183
184};
185
186/////////////////////////////////////////////////////////////////////////////
187
188class LLPanelRegionDebugInfo : public LLPanelRegionInfo
189{
190public:
191	LLPanelRegionDebugInfo()
192		:	LLPanelRegionInfo(), mTargetAvatar() {}
193	~LLPanelRegionDebugInfo() {}
194	// LLPanel
195	virtual BOOL postBuild();
196	
197	virtual bool refreshFromRegion(LLViewerRegion* region);
198	
199protected:
200	virtual BOOL sendUpdate();
201
202	void onClickChooseAvatar();
203	void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
204	static void onClickReturn(void *);
205	bool callbackReturn(const LLSD& notification, const LLSD& response);
206	static void onClickTopColliders(void*);
207	static void onClickTopScripts(void*);
208	static void onClickRestart(void* data);
209	bool callbackRestart(const LLSD& notification, const LLSD& response);
210	static void onClickCancelRestart(void* data);
211	
212private:
213	LLUUID mTargetAvatar;
214};
215
216/////////////////////////////////////////////////////////////////////////////
217
218class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
219{
220	LOG_CLASS(LLPanelRegionTerrainInfo);
221
222public:
223	LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
224	~LLPanelRegionTerrainInfo() {}
225	
226	virtual BOOL postBuild();												// LLPanel
227	
228	virtual bool refreshFromRegion(LLViewerRegion* region);					// refresh local settings from region update from simulator
229	void setEnvControls(bool available);									// Whether environment settings are available for this region
230
231	BOOL validateTextureSizes();
232
233	//static void onChangeAnything(LLUICtrl* ctrl, void* userData);			// callback for any change, to enable commit button
234	
235	virtual BOOL sendUpdate();
236
237	static void onClickDownloadRaw(void*);
238	static void onClickUploadRaw(void*);
239	static void onClickBakeTerrain(void*);
240	bool callbackBakeTerrain(const LLSD& notification, const LLSD& response);
241};
242
243/////////////////////////////////////////////////////////////////////////////
244
245class LLPanelEstateInfo : public LLPanelRegionInfo
246{
247public:
248	static void initDispatch(LLDispatcher& dispatch);
249	
250	void onChangeFixedSun();
251	void onChangeUseGlobalTime();
252	
253	void onClickEditSky();
254	void onClickEditSkyHelp();	
255	void onClickEditDayCycle();
256	void onClickEditDayCycleHelp();
257
258	void onClickAddAllowedAgent();
259	void onClickRemoveAllowedAgent();
260	void onClickAddAllowedGroup();
261	void onClickRemoveAllowedGroup();
262	void onClickAddBannedAgent();
263	void onClickRemoveBannedAgent();
264	void onClickAddEstateManager();
265	void onClickRemoveEstateManager();
266	void onClickKickUser();
267
268	// Group picker callback is different, can't use core methods below
269	bool addAllowedGroup(const LLSD& notification, const LLSD& response);
270	void addAllowedGroup2(LLUUID id);
271
272	// Core methods for all above add/remove button clicks
273	static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
274	static bool accessAddCore2(const LLSD& notification, const LLSD& response);
275	static void accessAddCore3(const uuid_vec_t& ids, void* data);
276
277	static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
278	static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);
279
280	// used for both add and remove operations
281	static bool accessCoreConfirm(const LLSD& notification, const LLSD& response);
282	bool kickUserConfirm(const LLSD& notification, const LLSD& response);
283
284	// Send the actual EstateOwnerRequest "estateaccessdelta" message
285	static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
286
287	void onKickUserCommit(const uuid_vec_t& ids);
288	static void onClickMessageEstate(void* data);
289	bool onMessageCommit(const LLSD& notification, const LLSD& response);
290	
291	LLPanelEstateInfo();
292	~LLPanelEstateInfo() {}
293	
294	void updateControls(LLViewerRegion* region);
295	
296	virtual bool refreshFromRegion(LLViewerRegion* region);
297	virtual bool estateUpdate(LLMessageSystem* msg);
298	
299	// LLPanel
300	virtual BOOL postBuild();
301	virtual void updateChild(LLUICtrl* child_ctrl);
302	virtual void refresh();
303
304	void refreshFromEstate();
305	
306	static bool isLindenEstate();
307	
308	const std::string getOwnerName() const;
309	void setOwnerName(const std::string& name);
310
311	// If visible from mainland, allowed agent and allowed groups
312	// are ignored, so must disable UI.
313	void setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban);
314protected:
315	virtual BOOL sendUpdate();
316	// confirmation dialog callback
317	bool callbackChangeLindenEstate(const LLSD& notification, const LLSD& response);
318
319	void commitEstateAccess();
320	void commitEstateManagers();
321	
322	void clearAccessLists();
323	BOOL checkRemovalButton(std::string name);
324	BOOL checkSunHourSlider(LLUICtrl* child_ctrl);
325
326	U32 mEstateID;
327};
328
329/////////////////////////////////////////////////////////////////////////////
330
331class LLPanelEstateCovenant : public LLPanelRegionInfo
332{
333public:
334	LLPanelEstateCovenant();
335	~LLPanelEstateCovenant() {}
336	
337	// LLPanel
338	virtual BOOL postBuild();
339	virtual void updateChild(LLUICtrl* child_ctrl);
340	virtual bool refreshFromRegion(LLViewerRegion* region);
341	virtual bool estateUpdate(LLMessageSystem* msg);
342
343	// LLView overrides
344	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
345						   BOOL drop, EDragAndDropType cargo_type,
346						   void *cargo_data, EAcceptance *accept,
347						   std::string& tooltip_msg);
348	static bool confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response);
349	static void resetCovenantID(void* userdata);
350	static bool confirmResetCovenantCallback(const LLSD& notification, const LLSD& response);
351	void sendChangeCovenantID(const LLUUID &asset_id);
352	void loadInvItem(LLInventoryItem *itemp);
353	static void onLoadComplete(LLVFS *vfs,
354							   const LLUUID& asset_uuid,
355							   LLAssetType::EType type,
356							   void* user_data, S32 status, LLExtStat ext_status);
357
358	// Accessor functions
359	static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
360	static void updateEstateName(const std::string& name);
361	static void updateLastModified(const std::string& text);
362	static void updateEstateOwnerName(const std::string& name);
363
364	const LLUUID& getCovenantID() const { return mCovenantID; }
365	void setCovenantID(const LLUUID& id) { mCovenantID = id; }
366	std::string getEstateName() const;
367	void setEstateName(const std::string& name);
368	std::string getOwnerName() const;
369	void setOwnerName(const std::string& name);
370	void setCovenantTextEditor(const std::string& text);
371
372	typedef enum e_asset_status
373	{
374		ASSET_ERROR,
375		ASSET_UNLOADED,
376		ASSET_LOADING,
377		ASSET_LOADED
378	} EAssetStatus;
379
380protected:
381	virtual BOOL sendUpdate();
382	LLTextBox*				mEstateNameText;
383	LLTextBox*				mEstateOwnerText;
384	LLTextBox*				mLastModifiedText;
385	// CovenantID from sim
386	LLUUID					mCovenantID;
387	LLViewerTextEditor*		mEditor;
388	EAssetStatus			mAssetStatus;
389};
390
391/////////////////////////////////////////////////////////////////////////////
392
393class LLPanelEnvironmentInfo : public LLPanelRegionInfo
394{
395	LOG_CLASS(LLPanelEnvironmentInfo);
396
397public:
398	LLPanelEnvironmentInfo();
399
400	// LLPanel
401	/*virtual*/ BOOL postBuild();
402	/*virtual*/ void onOpen(const LLSD& key);
403
404	// LLView
405	/*virtual*/ void handleVisibilityChange(BOOL new_visibility);
406
407	// LLPanelRegionInfo
408	/*virtual*/ bool refreshFromRegion(LLViewerRegion* region);
409
410private:
411	void refresh();
412	void setControlsEnabled(bool enabled);
413	void setApplyProgress(bool started);
414	void setDirty(bool dirty);
415
416	void sendRegionSunUpdate();
417	void fixEstateSun();
418
419	void populateWaterPresetsList();
420	void populateSkyPresetsList();
421	void populateDayCyclesList();
422
423	bool getSelectedWaterParams(LLSD& water_params);
424	bool getSelectedSkyParams(LLSD& sky_params, std::string& preset_name);
425	bool getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope);
426
427	void onSwitchRegionSettings();
428	void onSwitchDayCycle();
429
430	void onSelectWaterPreset();
431	void onSelectSkyPreset();
432	void onSelectDayCycle();
433
434	void onBtnApply();
435	void onBtnCancel();
436
437	void onRegionSettingschange();
438	void onRegionSettingsApplied(bool ok);
439
440	/// New environment settings that are being applied to the region.
441	LLEnvironmentSettings	mNewRegionSettings;
442
443	bool			mEnableEditing;
444
445	LLRadioGroup*	mRegionSettingsRadioGroup;
446	LLRadioGroup*	mDayCycleSettingsRadioGroup;
447
448	LLComboBox*		mWaterPresetCombo;
449	LLComboBox*		mSkyPresetCombo;
450	LLComboBox*		mDayCyclePresetCombo;
451};
452
453#endif