PageRenderTime 604ms CodeModel.GetById 242ms app.highlight 15ms RepoModel.GetById 206ms app.codeStats 13ms

/indra/newview/llfloaterscriptlimits.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 258 lines | 163 code | 55 blank | 40 comment | 0 complexity | 6277727f565db87bc6cbeef3e3c376e0 MD5 | raw file
  1/** 
  2 * @file llfloaterscriptlimits.h
  3 * @author Gabriel Lee
  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_LLFLOATERSCRIPTLIMITS_H
 29#define LL_LLFLOATERSCRIPTLIMITS_H
 30
 31#include <vector>
 32#include "llfloater.h"
 33#include "llhost.h"
 34#include "llpanel.h"
 35#include "llremoteparcelrequest.h"
 36
 37class LLPanelScriptLimitsInfo;
 38class LLTabContainer;
 39
 40class LLPanelScriptLimitsRegionMemory;
 41
 42class LLFloaterScriptLimits : public LLFloater
 43{
 44	friend class LLFloaterReg;
 45public:
 46
 47	/*virtual*/ BOOL postBuild();
 48
 49	// from LLPanel
 50	virtual void refresh();
 51
 52private:
 53
 54	LLFloaterScriptLimits(const LLSD& seed);
 55	~LLFloaterScriptLimits();
 56
 57protected:
 58
 59	LLTabContainer* mTab;
 60	typedef std::vector<LLPanelScriptLimitsInfo*> info_panels_t;
 61	info_panels_t mInfoPanels;
 62};
 63
 64
 65// Base class for all script limits information panels.
 66class LLPanelScriptLimitsInfo : public LLPanel
 67{
 68public:
 69	LLPanelScriptLimitsInfo();
 70	
 71	virtual BOOL postBuild();
 72	virtual void updateChild(LLUICtrl* child_ctrl);
 73	
 74protected:
 75	void initCtrl(const std::string& name);
 76	
 77	typedef std::vector<std::string> strings_t;
 78	
 79	LLHost mHost;
 80};
 81
 82/////////////////////////////////////////////////////////////////////////////
 83// Responders
 84/////////////////////////////////////////////////////////////////////////////
 85
 86class fetchScriptLimitsRegionInfoResponder: public LLHTTPClient::Responder
 87{
 88	public:
 89		fetchScriptLimitsRegionInfoResponder(const LLSD& info) : mInfo(info) {};
 90
 91		void result(const LLSD& content);
 92		void error(U32 status, const std::string& reason);
 93	public:
 94	protected:
 95		LLSD mInfo;
 96};
 97
 98class fetchScriptLimitsRegionSummaryResponder: public LLHTTPClient::Responder
 99{
100	public:
101		fetchScriptLimitsRegionSummaryResponder(const LLSD& info) : mInfo(info) {};
102
103		void result(const LLSD& content);
104		void error(U32 status, const std::string& reason);
105	public:
106	protected:
107		LLSD mInfo;
108};
109
110class fetchScriptLimitsRegionDetailsResponder: public LLHTTPClient::Responder
111{
112	public:
113		fetchScriptLimitsRegionDetailsResponder(const LLSD& info) : mInfo(info) {};
114
115		void result(const LLSD& content);
116		void error(U32 status, const std::string& reason);
117	public:
118	protected:
119		LLSD mInfo;
120};
121
122class fetchScriptLimitsAttachmentInfoResponder: public LLHTTPClient::Responder
123{
124	public:
125		fetchScriptLimitsAttachmentInfoResponder() {};
126
127		void result(const LLSD& content);
128		void error(U32 status, const std::string& reason);
129	public:
130	protected:
131};
132
133/////////////////////////////////////////////////////////////////////////////
134// Memory panel
135/////////////////////////////////////////////////////////////////////////////
136
137class LLPanelScriptLimitsRegionMemory : public LLPanelScriptLimitsInfo, LLRemoteParcelInfoObserver
138{
139	
140public:
141	LLPanelScriptLimitsRegionMemory()
142		: LLPanelScriptLimitsInfo(), LLRemoteParcelInfoObserver(),
143
144		mParcelId(LLUUID()),
145		mGotParcelMemoryUsed(false),
146		mGotParcelMemoryMax(false),
147		mParcelMemoryMax(0),
148		mParcelMemoryUsed(0) {};
149
150	~LLPanelScriptLimitsRegionMemory();
151	
152	// LLPanel
153	virtual BOOL postBuild();
154
155	void setRegionDetails(LLSD content);
156	void setRegionSummary(LLSD content);
157
158	BOOL StartRequestChain();
159
160	BOOL getLandScriptResources();
161	void clearList();
162	void showBeacon();
163	void returnObjectsFromParcel(S32 local_id);
164	void returnObjects();
165
166private:
167	void onNameCache(const LLUUID& id,
168						 const std::string& name);
169
170	LLSD mContent;
171	LLUUID mParcelId;
172	bool mGotParcelMemoryUsed;
173	bool mGotParcelMemoryUsedDetails;
174	bool mGotParcelMemoryMax;
175	S32 mParcelMemoryMax;
176	S32 mParcelMemoryUsed;
177	S32 mParcelMemoryUsedDetails;
178	
179	bool mGotParcelURLsUsed;
180	bool mGotParcelURLsUsedDetails;
181	bool mGotParcelURLsMax;
182	S32 mParcelURLsMax;
183	S32 mParcelURLsUsed;
184	S32 mParcelURLsUsedDetails;
185	
186	std::vector<LLSD> mObjectListItems;
187		
188protected:
189
190// LLRemoteParcelInfoObserver interface:
191/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
192/*virtual*/ void setParcelID(const LLUUID& parcel_id);
193/*virtual*/ void setErrorStatus(U32 status, const std::string& reason);
194	
195	static void onClickRefresh(void* userdata);
196	static void onClickHighlight(void* userdata);
197	static void onClickReturn(void* userdata);
198};
199
200/////////////////////////////////////////////////////////////////////////////
201// Attachment panel
202/////////////////////////////////////////////////////////////////////////////
203
204class LLPanelScriptLimitsAttachment : public LLPanelScriptLimitsInfo
205{
206	
207public:
208	LLPanelScriptLimitsAttachment()
209		:	LLPanelScriptLimitsInfo(),
210		mGotAttachmentMemoryUsed(false),
211		mGotAttachmentMemoryUsedDetails(false),
212		mGotAttachmentMemoryMax(false),
213		mAttachmentMemoryMax(0),
214		mAttachmentMemoryUsed(0),
215		mAttachmentMemoryUsedDetails(0),
216		mGotAttachmentURLsUsed(false),
217		mGotAttachmentURLsUsedDetails(false),
218		mGotAttachmentURLsMax(false),
219		mAttachmentURLsMax(0),
220		mAttachmentURLsUsed(0),
221		mAttachmentURLsUsedDetails(0)
222		{};
223
224	~LLPanelScriptLimitsAttachment()
225	{
226	};
227	
228	// LLPanel
229	virtual BOOL postBuild();
230
231	void setAttachmentDetails(LLSD content);
232
233	void setAttachmentSummary(LLSD content);
234	BOOL requestAttachmentDetails();
235	void clearList();
236
237private:
238
239	bool mGotAttachmentMemoryUsed;
240	bool mGotAttachmentMemoryUsedDetails;
241	bool mGotAttachmentMemoryMax;
242	S32 mAttachmentMemoryMax;
243	S32 mAttachmentMemoryUsed;
244	S32 mAttachmentMemoryUsedDetails;
245	
246	bool mGotAttachmentURLsUsed;
247	bool mGotAttachmentURLsUsedDetails;
248	bool mGotAttachmentURLsMax;
249	S32 mAttachmentURLsMax;
250	S32 mAttachmentURLsUsed;
251	S32 mAttachmentURLsUsedDetails;
252
253protected:
254	
255	static void onClickRefresh(void* userdata);
256};
257
258#endif