PageRenderTime 103ms CodeModel.GetById 84ms RepoModel.GetById 1ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLFLOATERREGIONINFO_H
  28. #define LL_LLFLOATERREGIONINFO_H
  29. #include <vector>
  30. #include "llassettype.h"
  31. #include "llfloater.h"
  32. #include "llhost.h"
  33. #include "llpanel.h"
  34. #include "llenvmanager.h" // for LLEnvironmentSettings
  35. class LLAvatarName;
  36. class LLDispatcher;
  37. class LLLineEditor;
  38. class LLMessageSystem;
  39. class LLPanelRegionInfo;
  40. class LLTabContainer;
  41. class LLViewerRegion;
  42. class LLViewerTextEditor;
  43. class LLInventoryItem;
  44. class LLCheckBoxCtrl;
  45. class LLComboBox;
  46. class LLNameListCtrl;
  47. class LLRadioGroup;
  48. class LLSliderCtrl;
  49. class LLSpinCtrl;
  50. class LLTextBox;
  51. class LLVFS;
  52. class LLPanelRegionGeneralInfo;
  53. class LLPanelRegionDebugInfo;
  54. class LLPanelRegionTerrainInfo;
  55. class LLPanelEstateInfo;
  56. class LLPanelEstateCovenant;
  57. class LLEventTimer;
  58. class LLEnvironmentSettings;
  59. class LLWLParamManager;
  60. class LLWaterParamManager;
  61. class LLWLParamSet;
  62. class LLWaterParamSet;
  63. class LLFloaterRegionInfo : public LLFloater
  64. {
  65. friend class LLFloaterReg;
  66. public:
  67. /*virtual*/ void onOpen(const LLSD& key);
  68. /*virtual*/ BOOL postBuild();
  69. static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
  70. // get and process region info if necessary.
  71. static void processRegionInfo(LLMessageSystem* msg);
  72. static const LLUUID& getLastInvoice() { return sRequestInvoice; }
  73. static void nextInvoice() { sRequestInvoice.generate(); }
  74. //static S32 getSerial() { return sRequestSerial; }
  75. //static void incrementSerial() { sRequestSerial++; }
  76. static LLPanelEstateInfo* getPanelEstate();
  77. static LLPanelEstateCovenant* getPanelCovenant();
  78. static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
  79. // from LLPanel
  80. virtual void refresh();
  81. void requestRegionInfo();
  82. void requestMeshRezInfo();
  83. private:
  84. LLFloaterRegionInfo(const LLSD& seed);
  85. ~LLFloaterRegionInfo();
  86. protected:
  87. void onTabSelected(const LLSD& param);
  88. void refreshFromRegion(LLViewerRegion* region);
  89. // member data
  90. LLTabContainer* mTab;
  91. typedef std::vector<LLPanelRegionInfo*> info_panels_t;
  92. info_panels_t mInfoPanels;
  93. //static S32 sRequestSerial; // serial # of last EstateOwnerRequest
  94. static LLUUID sRequestInvoice;
  95. };
  96. // Base class for all region information panels.
  97. class LLPanelRegionInfo : public LLPanel
  98. {
  99. public:
  100. LLPanelRegionInfo();
  101. void onBtnSet();
  102. void onChangeChildCtrl(LLUICtrl* ctrl);
  103. void onChangeAnything();
  104. static void onChangeText(LLLineEditor* caller, void* user_data);
  105. virtual bool refreshFromRegion(LLViewerRegion* region);
  106. virtual bool estateUpdate(LLMessageSystem* msg) { return true; }
  107. virtual BOOL postBuild();
  108. virtual void updateChild(LLUICtrl* child_ctrl);
  109. void enableButton(const std::string& btn_name, BOOL enable = TRUE);
  110. void disableButton(const std::string& btn_name);
  111. void onClickManageTelehub();
  112. protected:
  113. void initCtrl(const std::string& name);
  114. // Returns TRUE if update sent and apply button should be
  115. // disabled.
  116. virtual BOOL sendUpdate() { return TRUE; }
  117. typedef std::vector<std::string> strings_t;
  118. //typedef std::vector<U32> integers_t;
  119. void sendEstateOwnerMessage(
  120. LLMessageSystem* msg,
  121. const std::string& request,
  122. const LLUUID& invoice,
  123. const strings_t& strings);
  124. // member data
  125. LLHost mHost;
  126. };
  127. /////////////////////////////////////////////////////////////////////////////
  128. // Actual panels start here
  129. /////////////////////////////////////////////////////////////////////////////
  130. class LLPanelRegionGeneralInfo : public LLPanelRegionInfo
  131. {
  132. public:
  133. LLPanelRegionGeneralInfo()
  134. : LLPanelRegionInfo() {}
  135. ~LLPanelRegionGeneralInfo() {}
  136. virtual bool refreshFromRegion(LLViewerRegion* region);
  137. // LLPanel
  138. virtual BOOL postBuild();
  139. protected:
  140. virtual BOOL sendUpdate();
  141. void onClickKick();
  142. void onKickCommit(const uuid_vec_t& ids);
  143. static void onClickKickAll(void* userdata);
  144. bool onKickAllCommit(const LLSD& notification, const LLSD& response);
  145. static void onClickMessage(void* userdata);
  146. bool onMessageCommit(const LLSD& notification, const LLSD& response);
  147. };
  148. /////////////////////////////////////////////////////////////////////////////
  149. class LLPanelRegionDebugInfo : public LLPanelRegionInfo
  150. {
  151. public:
  152. LLPanelRegionDebugInfo()
  153. : LLPanelRegionInfo(), mTargetAvatar() {}
  154. ~LLPanelRegionDebugInfo() {}
  155. // LLPanel
  156. virtual BOOL postBuild();
  157. virtual bool refreshFromRegion(LLViewerRegion* region);
  158. protected:
  159. virtual BOOL sendUpdate();
  160. void onClickChooseAvatar();
  161. void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
  162. static void onClickReturn(void *);
  163. bool callbackReturn(const LLSD& notification, const LLSD& response);
  164. static void onClickTopColliders(void*);
  165. static void onClickTopScripts(void*);
  166. static void onClickRestart(void* data);
  167. bool callbackRestart(const LLSD& notification, const LLSD& response);
  168. static void onClickCancelRestart(void* data);
  169. private:
  170. LLUUID mTargetAvatar;
  171. };
  172. /////////////////////////////////////////////////////////////////////////////
  173. class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
  174. {
  175. LOG_CLASS(LLPanelRegionTerrainInfo);
  176. public:
  177. LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
  178. ~LLPanelRegionTerrainInfo() {}
  179. virtual BOOL postBuild(); // LLPanel
  180. virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator
  181. void setEnvControls(bool available); // Whether environment settings are available for this region
  182. BOOL validateTextureSizes();
  183. //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button
  184. virtual BOOL sendUpdate();
  185. static void onClickDownloadRaw(void*);
  186. static void onClickUploadRaw(void*);
  187. static void onClickBakeTerrain(void*);
  188. bool callbackBakeTerrain(const LLSD& notification, const LLSD& response);
  189. };
  190. /////////////////////////////////////////////////////////////////////////////
  191. class LLPanelEstateInfo : public LLPanelRegionInfo
  192. {
  193. public:
  194. static void initDispatch(LLDispatcher& dispatch);
  195. void onChangeFixedSun();
  196. void onChangeUseGlobalTime();
  197. void onClickEditSky();
  198. void onClickEditSkyHelp();
  199. void onClickEditDayCycle();
  200. void onClickEditDayCycleHelp();
  201. void onClickAddAllowedAgent();
  202. void onClickRemoveAllowedAgent();
  203. void onClickAddAllowedGroup();
  204. void onClickRemoveAllowedGroup();
  205. void onClickAddBannedAgent();
  206. void onClickRemoveBannedAgent();
  207. void onClickAddEstateManager();
  208. void onClickRemoveEstateManager();
  209. void onClickKickUser();
  210. // Group picker callback is different, can't use core methods below
  211. bool addAllowedGroup(const LLSD& notification, const LLSD& response);
  212. void addAllowedGroup2(LLUUID id);
  213. // Core methods for all above add/remove button clicks
  214. static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
  215. static bool accessAddCore2(const LLSD& notification, const LLSD& response);
  216. static void accessAddCore3(const uuid_vec_t& ids, void* data);
  217. static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
  218. static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);
  219. // used for both add and remove operations
  220. static bool accessCoreConfirm(const LLSD& notification, const LLSD& response);
  221. bool kickUserConfirm(const LLSD& notification, const LLSD& response);
  222. // Send the actual EstateOwnerRequest "estateaccessdelta" message
  223. static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
  224. void onKickUserCommit(const uuid_vec_t& ids);
  225. static void onClickMessageEstate(void* data);
  226. bool onMessageCommit(const LLSD& notification, const LLSD& response);
  227. LLPanelEstateInfo();
  228. ~LLPanelEstateInfo() {}
  229. void updateControls(LLViewerRegion* region);
  230. virtual bool refreshFromRegion(LLViewerRegion* region);
  231. virtual bool estateUpdate(LLMessageSystem* msg);
  232. // LLPanel
  233. virtual BOOL postBuild();
  234. virtual void updateChild(LLUICtrl* child_ctrl);
  235. virtual void refresh();
  236. void refreshFromEstate();
  237. static bool isLindenEstate();
  238. const std::string getOwnerName() const;
  239. void setOwnerName(const std::string& name);
  240. // If visible from mainland, allowed agent and allowed groups
  241. // are ignored, so must disable UI.
  242. void setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban);
  243. protected:
  244. virtual BOOL sendUpdate();
  245. // confirmation dialog callback
  246. bool callbackChangeLindenEstate(const LLSD& notification, const LLSD& response);
  247. void commitEstateAccess();
  248. void commitEstateManagers();
  249. void clearAccessLists();
  250. BOOL checkRemovalButton(std::string name);
  251. BOOL checkSunHourSlider(LLUICtrl* child_ctrl);
  252. U32 mEstateID;
  253. };
  254. /////////////////////////////////////////////////////////////////////////////
  255. class LLPanelEstateCovenant : public LLPanelRegionInfo
  256. {
  257. public:
  258. LLPanelEstateCovenant();
  259. ~LLPanelEstateCovenant() {}
  260. // LLPanel
  261. virtual BOOL postBuild();
  262. virtual void updateChild(LLUICtrl* child_ctrl);
  263. virtual bool refreshFromRegion(LLViewerRegion* region);
  264. virtual bool estateUpdate(LLMessageSystem* msg);
  265. // LLView overrides
  266. BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
  267. BOOL drop, EDragAndDropType cargo_type,
  268. void *cargo_data, EAcceptance *accept,
  269. std::string& tooltip_msg);
  270. static bool confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response);
  271. static void resetCovenantID(void* userdata);
  272. static bool confirmResetCovenantCallback(const LLSD& notification, const LLSD& response);
  273. void sendChangeCovenantID(const LLUUID &asset_id);
  274. void loadInvItem(LLInventoryItem *itemp);
  275. static void onLoadComplete(LLVFS *vfs,
  276. const LLUUID& asset_uuid,
  277. LLAssetType::EType type,
  278. void* user_data, S32 status, LLExtStat ext_status);
  279. // Accessor functions
  280. static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
  281. static void updateEstateName(const std::string& name);
  282. static void updateLastModified(const std::string& text);
  283. static void updateEstateOwnerName(const std::string& name);
  284. const LLUUID& getCovenantID() const { return mCovenantID; }
  285. void setCovenantID(const LLUUID& id) { mCovenantID = id; }
  286. std::string getEstateName() const;
  287. void setEstateName(const std::string& name);
  288. std::string getOwnerName() const;
  289. void setOwnerName(const std::string& name);
  290. void setCovenantTextEditor(const std::string& text);
  291. typedef enum e_asset_status
  292. {
  293. ASSET_ERROR,
  294. ASSET_UNLOADED,
  295. ASSET_LOADING,
  296. ASSET_LOADED
  297. } EAssetStatus;
  298. protected:
  299. virtual BOOL sendUpdate();
  300. LLTextBox* mEstateNameText;
  301. LLTextBox* mEstateOwnerText;
  302. LLTextBox* mLastModifiedText;
  303. // CovenantID from sim
  304. LLUUID mCovenantID;
  305. LLViewerTextEditor* mEditor;
  306. EAssetStatus mAssetStatus;
  307. };
  308. /////////////////////////////////////////////////////////////////////////////
  309. class LLPanelEnvironmentInfo : public LLPanelRegionInfo
  310. {
  311. LOG_CLASS(LLPanelEnvironmentInfo);
  312. public:
  313. LLPanelEnvironmentInfo();
  314. // LLPanel
  315. /*virtual*/ BOOL postBuild();
  316. /*virtual*/ void onOpen(const LLSD& key);
  317. // LLView
  318. /*virtual*/ void handleVisibilityChange(BOOL new_visibility);
  319. // LLPanelRegionInfo
  320. /*virtual*/ bool refreshFromRegion(LLViewerRegion* region);
  321. private:
  322. void refresh();
  323. void setControlsEnabled(bool enabled);
  324. void setApplyProgress(bool started);
  325. void setDirty(bool dirty);
  326. void sendRegionSunUpdate();
  327. void fixEstateSun();
  328. void populateWaterPresetsList();
  329. void populateSkyPresetsList();
  330. void populateDayCyclesList();
  331. bool getSelectedWaterParams(LLSD& water_params);
  332. bool getSelectedSkyParams(LLSD& sky_params, std::string& preset_name);
  333. bool getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope);
  334. void onSwitchRegionSettings();
  335. void onSwitchDayCycle();
  336. void onSelectWaterPreset();
  337. void onSelectSkyPreset();
  338. void onSelectDayCycle();
  339. void onBtnApply();
  340. void onBtnCancel();
  341. void onRegionSettingschange();
  342. void onRegionSettingsApplied(bool ok);
  343. /// New environment settings that are being applied to the region.
  344. LLEnvironmentSettings mNewRegionSettings;
  345. bool mEnableEditing;
  346. LLRadioGroup* mRegionSettingsRadioGroup;
  347. LLRadioGroup* mDayCycleSettingsRadioGroup;
  348. LLComboBox* mWaterPresetCombo;
  349. LLComboBox* mSkyPresetCombo;
  350. LLComboBox* mDayCyclePresetCombo;
  351. };
  352. #endif