llfloaterexperienceprofile.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /**
  2. * @file llfloaterexperienceprofile.h
  3. * @brief llfloaterexperienceprofile and related class definitions
  4. *
  5. * $LicenseInfo:firstyear=2013&license=viewergpl$
  6. *
  7. * Copyright (c) 2013, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLFLOATEREXPERIENCEPROFILE_H
  33. #define LL_LLFLOATEREXPERIENCEPROFILE_H
  34. #include "llfloater.h"
  35. #include "llsd.h"
  36. class LLButton;
  37. class LLCheckBoxCtrl;
  38. class LLComboBox;
  39. class LLLineEditor;
  40. class LLTextBox;
  41. class LLTextEditor;
  42. class LLTextureCtrl;
  43. class LLFloaterExperienceProfile final : public LLFloater
  44. {
  45. protected:
  46. LOG_CLASS(LLFloaterExperienceProfile);
  47. public:
  48. enum PostSaveAction
  49. {
  50. NOTHING,
  51. CLOSE,
  52. VIEW,
  53. };
  54. LLFloaterExperienceProfile(const LLUUID& exp_id);
  55. ~LLFloaterExperienceProfile() override;
  56. bool postBuild() override;
  57. bool canClose() override;
  58. void onClose(bool app_quitting) override;
  59. LL_INLINE LLUUID getExperienceId() const { return mExperienceId; }
  60. void setPreferences(const LLSD& content);
  61. void refreshExperience(const LLSD& experience);
  62. void onSaveComplete(const LLSD& content);
  63. static LLFloaterExperienceProfile* show(const LLUUID& exp_id);
  64. static LLUUID getInstanceId(LLFloaterExperienceProfile* instance);
  65. protected:
  66. static void onClickEdit(void* data);
  67. static void onClickAllow(void* data);
  68. static void onClickBlock(void* data);
  69. static void onClickForget(void* data);
  70. static void onClickCancel(void* data);
  71. static void onClickSave(void* data);
  72. static void onClickLocation(void* data);
  73. static void onClickClear(void* data);
  74. static void onPickGroup(void* data);
  75. static void onClickExperienceTitle(void* data);
  76. static void onOwnerProfile(void* data);
  77. static void onShowGroupInfo(void* data);
  78. static void onShowLocation(void* data);
  79. static void onOpenMarketplaceURL(void* data);
  80. static void onLineKeystroke(LLLineEditor*, void* data);
  81. static void onTextKeystroke(LLTextEditor*, void* data);
  82. static void onFieldChanged(LLUICtrl*, void* data);
  83. static void onReportExperience(void* data);
  84. static void nameCallback(const LLUUID& group_id, const std::string& name,
  85. bool is_group,LLFloaterExperienceProfile* self);
  86. static void setOwnerId(LLUUID agent_id, void* data);
  87. static void setEditGroup(LLUUID group_id, void* data);
  88. void setPermission(const char* perm);
  89. void changeToView();
  90. void experienceForgotten();
  91. void experienceBlocked();
  92. void experienceAllowed();
  93. static void experienceCallback(LLHandle<LLFloaterExperienceProfile> handle,
  94. const LLSD& experience);
  95. static bool experiencePermission(LLHandle<LLFloaterExperienceProfile> handle,
  96. const LLSD& permission);
  97. bool setMaturityString(S32 maturity);
  98. bool handleSaveChangesDialog(const LLSD& notification,
  99. const LLSD& response, PostSaveAction action);
  100. void doSave(int success_action);
  101. void updatePackage();
  102. void updatePermission(const LLSD& permission);
  103. private:
  104. static bool hasPermission(const LLSD& content, const std::string& name,
  105. const LLUUID& test);
  106. static void experiencePermissionResults(LLUUID exp_id, LLSD result);
  107. static void experienceIsAdmin(LLHandle<LLFloaterExperienceProfile> handle,
  108. const LLSD& result);
  109. static void experienceUpdateResult(LLHandle<LLFloaterExperienceProfile> handle,
  110. const LLSD& result);
  111. protected:
  112. LLButton* mAllowBtn;
  113. LLButton* mForgetBtn;
  114. LLButton* mBlockBtn;
  115. LLButton* mEditBtn;
  116. LLButton* mSaveBtn;
  117. LLButton* mGroupBtn;
  118. LLCheckBoxCtrl* mEnableCheck;
  119. LLCheckBoxCtrl* mPrivateCheck;
  120. LLComboBox* mRatingCombo;
  121. LLLineEditor* mMarketplaceEditor;
  122. LLLineEditor* mExperienceTitleEditor;
  123. LLTextBox* mRatingText;
  124. LLTextBox* mExperienceTitleText;
  125. LLTextBox* mLocationText;
  126. LLTextBox* mEditLocationText;
  127. LLTextBox* mGroupText;
  128. LLTextBox* mEditGroupText;
  129. LLTextBox* mOwnerText;
  130. LLTextBox* mMarketplaceText;
  131. LLTextEditor* mExperienceDescEditor;
  132. LLTextureCtrl* mLogoTexture;
  133. LLTextureCtrl* mEditLogoTexture;
  134. S32 mSaveCompleteAction;
  135. LLUUID mExperienceId;
  136. LLUUID mOwnerId;
  137. LLUUID mGroupId;
  138. bool mDirty;
  139. bool mForceClose;
  140. LLSD mExperienceDetails;
  141. LLSD mPackage;
  142. std::string mLocationSLURL;
  143. std::string mExperienceSLURL;
  144. std::string mMarketplaceURL;
  145. typedef fast_hmap<LLUUID, LLFloaterExperienceProfile*> instances_map_t;
  146. static instances_map_t sInstances;
  147. };
  148. #endif // LL_LLFLOATEREXPERIENCEPROFILE_H