PageRenderTime 37ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLFLOATERSCRIPTLIMITS_H
  28. #define LL_LLFLOATERSCRIPTLIMITS_H
  29. #include <vector>
  30. #include "llfloater.h"
  31. #include "llhost.h"
  32. #include "llpanel.h"
  33. #include "llremoteparcelrequest.h"
  34. class LLPanelScriptLimitsInfo;
  35. class LLTabContainer;
  36. class LLPanelScriptLimitsRegionMemory;
  37. class LLFloaterScriptLimits : public LLFloater
  38. {
  39. friend class LLFloaterReg;
  40. public:
  41. /*virtual*/ BOOL postBuild();
  42. // from LLPanel
  43. virtual void refresh();
  44. private:
  45. LLFloaterScriptLimits(const LLSD& seed);
  46. ~LLFloaterScriptLimits();
  47. protected:
  48. LLTabContainer* mTab;
  49. typedef std::vector<LLPanelScriptLimitsInfo*> info_panels_t;
  50. info_panels_t mInfoPanels;
  51. };
  52. // Base class for all script limits information panels.
  53. class LLPanelScriptLimitsInfo : public LLPanel
  54. {
  55. public:
  56. LLPanelScriptLimitsInfo();
  57. virtual BOOL postBuild();
  58. virtual void updateChild(LLUICtrl* child_ctrl);
  59. protected:
  60. void initCtrl(const std::string& name);
  61. typedef std::vector<std::string> strings_t;
  62. LLHost mHost;
  63. };
  64. /////////////////////////////////////////////////////////////////////////////
  65. // Responders
  66. /////////////////////////////////////////////////////////////////////////////
  67. class fetchScriptLimitsRegionInfoResponder: public LLHTTPClient::Responder
  68. {
  69. public:
  70. fetchScriptLimitsRegionInfoResponder(const LLSD& info) : mInfo(info) {};
  71. void result(const LLSD& content);
  72. void error(U32 status, const std::string& reason);
  73. public:
  74. protected:
  75. LLSD mInfo;
  76. };
  77. class fetchScriptLimitsRegionSummaryResponder: public LLHTTPClient::Responder
  78. {
  79. public:
  80. fetchScriptLimitsRegionSummaryResponder(const LLSD& info) : mInfo(info) {};
  81. void result(const LLSD& content);
  82. void error(U32 status, const std::string& reason);
  83. public:
  84. protected:
  85. LLSD mInfo;
  86. };
  87. class fetchScriptLimitsRegionDetailsResponder: public LLHTTPClient::Responder
  88. {
  89. public:
  90. fetchScriptLimitsRegionDetailsResponder(const LLSD& info) : mInfo(info) {};
  91. void result(const LLSD& content);
  92. void error(U32 status, const std::string& reason);
  93. public:
  94. protected:
  95. LLSD mInfo;
  96. };
  97. class fetchScriptLimitsAttachmentInfoResponder: public LLHTTPClient::Responder
  98. {
  99. public:
  100. fetchScriptLimitsAttachmentInfoResponder() {};
  101. void result(const LLSD& content);
  102. void error(U32 status, const std::string& reason);
  103. public:
  104. protected:
  105. };
  106. /////////////////////////////////////////////////////////////////////////////
  107. // Memory panel
  108. /////////////////////////////////////////////////////////////////////////////
  109. class LLPanelScriptLimitsRegionMemory : public LLPanelScriptLimitsInfo, LLRemoteParcelInfoObserver
  110. {
  111. public:
  112. LLPanelScriptLimitsRegionMemory()
  113. : LLPanelScriptLimitsInfo(), LLRemoteParcelInfoObserver(),
  114. mParcelId(LLUUID()),
  115. mGotParcelMemoryUsed(false),
  116. mGotParcelMemoryMax(false),
  117. mParcelMemoryMax(0),
  118. mParcelMemoryUsed(0) {};
  119. ~LLPanelScriptLimitsRegionMemory();
  120. // LLPanel
  121. virtual BOOL postBuild();
  122. void setRegionDetails(LLSD content);
  123. void setRegionSummary(LLSD content);
  124. BOOL StartRequestChain();
  125. BOOL getLandScriptResources();
  126. void clearList();
  127. void showBeacon();
  128. void returnObjectsFromParcel(S32 local_id);
  129. void returnObjects();
  130. private:
  131. void onNameCache(const LLUUID& id,
  132. const std::string& name);
  133. LLSD mContent;
  134. LLUUID mParcelId;
  135. bool mGotParcelMemoryUsed;
  136. bool mGotParcelMemoryUsedDetails;
  137. bool mGotParcelMemoryMax;
  138. S32 mParcelMemoryMax;
  139. S32 mParcelMemoryUsed;
  140. S32 mParcelMemoryUsedDetails;
  141. bool mGotParcelURLsUsed;
  142. bool mGotParcelURLsUsedDetails;
  143. bool mGotParcelURLsMax;
  144. S32 mParcelURLsMax;
  145. S32 mParcelURLsUsed;
  146. S32 mParcelURLsUsedDetails;
  147. std::vector<LLSD> mObjectListItems;
  148. protected:
  149. // LLRemoteParcelInfoObserver interface:
  150. /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
  151. /*virtual*/ void setParcelID(const LLUUID& parcel_id);
  152. /*virtual*/ void setErrorStatus(U32 status, const std::string& reason);
  153. static void onClickRefresh(void* userdata);
  154. static void onClickHighlight(void* userdata);
  155. static void onClickReturn(void* userdata);
  156. };
  157. /////////////////////////////////////////////////////////////////////////////
  158. // Attachment panel
  159. /////////////////////////////////////////////////////////////////////////////
  160. class LLPanelScriptLimitsAttachment : public LLPanelScriptLimitsInfo
  161. {
  162. public:
  163. LLPanelScriptLimitsAttachment()
  164. : LLPanelScriptLimitsInfo(),
  165. mGotAttachmentMemoryUsed(false),
  166. mGotAttachmentMemoryUsedDetails(false),
  167. mGotAttachmentMemoryMax(false),
  168. mAttachmentMemoryMax(0),
  169. mAttachmentMemoryUsed(0),
  170. mAttachmentMemoryUsedDetails(0),
  171. mGotAttachmentURLsUsed(false),
  172. mGotAttachmentURLsUsedDetails(false),
  173. mGotAttachmentURLsMax(false),
  174. mAttachmentURLsMax(0),
  175. mAttachmentURLsUsed(0),
  176. mAttachmentURLsUsedDetails(0)
  177. {};
  178. ~LLPanelScriptLimitsAttachment()
  179. {
  180. };
  181. // LLPanel
  182. virtual BOOL postBuild();
  183. void setAttachmentDetails(LLSD content);
  184. void setAttachmentSummary(LLSD content);
  185. BOOL requestAttachmentDetails();
  186. void clearList();
  187. private:
  188. bool mGotAttachmentMemoryUsed;
  189. bool mGotAttachmentMemoryUsedDetails;
  190. bool mGotAttachmentMemoryMax;
  191. S32 mAttachmentMemoryMax;
  192. S32 mAttachmentMemoryUsed;
  193. S32 mAttachmentMemoryUsedDetails;
  194. bool mGotAttachmentURLsUsed;
  195. bool mGotAttachmentURLsUsedDetails;
  196. bool mGotAttachmentURLsMax;
  197. S32 mAttachmentURLsMax;
  198. S32 mAttachmentURLsUsed;
  199. S32 mAttachmentURLsUsedDetails;
  200. protected:
  201. static void onClickRefresh(void* userdata);
  202. };
  203. #endif