llpanelclassified.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /**
  2. * @file llpanelclassified.h
  3. * @brief LLPanelClassified class definition
  4. *
  5. * $LicenseInfo:firstyear=2005&license=viewergpl$
  6. *
  7. * Copyright (c) 2005-2009, 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. // Display of a classified used both for the global view in the
  33. // Find directory, and also for each individual user's classified in their
  34. // profile.
  35. #ifndef LL_LLPANELCLASSIFIED_H
  36. #define LL_LLPANELCLASSIFIED_H
  37. #include "hbfastset.h"
  38. #include "llfloater.h"
  39. #include "llvector3d.h"
  40. #include "llavatarproperties.h"
  41. class LLButton;
  42. class LLCheckBoxCtrl;
  43. class LLComboBox;
  44. class LLLineEditor;
  45. class LLTextBox;
  46. class LLTextEditor;
  47. class LLTextureCtrl;
  48. // Purely static class
  49. class LLClassifiedInfo
  50. {
  51. LLClassifiedInfo() = delete;
  52. ~LLClassifiedInfo() = delete;
  53. public:
  54. static void loadCategories(const LLSD& options);
  55. public:
  56. typedef std::map<U32, std::string> map_t;
  57. static map_t sCategories;
  58. };
  59. class LLPanelClassified final : public LLPanel, LLAvatarPropertiesObserver
  60. {
  61. protected:
  62. LOG_CLASS(LLPanelClassified);
  63. public:
  64. LLPanelClassified(bool in_finder, bool from_search);
  65. ~LLPanelClassified() override;
  66. void reset();
  67. bool postBuild() override;
  68. void draw() override;
  69. void refresh() override;
  70. void apply();
  71. // If can close, return true. If cannot close, pop save/discard dialog
  72. // and return false.
  73. bool canClose();
  74. // LLAvatarPropertiesObserver override
  75. void processProperties(S32 type, void* data) override;
  76. // Setup a new classified, including creating an id, giving a sane
  77. // initial position, etc.
  78. void initNewClassified();
  79. LL_INLINE void setClassifiedID(const LLUUID& id) { mClassifiedID = id; }
  80. LL_INLINE const LLUUID& getClassifiedID() const { return mClassifiedID; }
  81. void setClickThroughText(const std::string& text);
  82. static void setClickThrough(const LLUUID& classified_id,
  83. S32 teleport, S32 map, S32 profile,
  84. bool from_new_table);
  85. // Checks that the title is valid (e.g. starts with a number or letter)
  86. bool titleIsValid();
  87. // Schedules the panel to request data from the server next time it is
  88. // drawn.
  89. void markForServerRequest();
  90. std::string getClassifiedName();
  91. void sendClassifiedInfoRequest();
  92. void sendClassifiedInfoUpdate();
  93. void resetDirty() override;
  94. // Confirmation dialogs flow in this order
  95. bool confirmMature(const LLSD& notification, const LLSD& response);
  96. void gotMature();
  97. static void callbackGotPriceForListing(S32 option, std::string text,
  98. void* data);
  99. bool confirmPublish(const LLSD& notification, const LLSD& response);
  100. void sendClassifiedClickMessage(const std::string& type);
  101. protected:
  102. bool saveCallback(const LLSD& notification, const LLSD& response);
  103. static void handleSearchStatResponse(LLUUID id, LLSD result);
  104. static void onClickUpdate(void* data);
  105. static void onClickTeleport(void* data);
  106. static void onClickMap(void* data);
  107. static void onClickProfile(void* data);
  108. static void onClickSet(void* data);
  109. static void focusReceived(LLFocusableElement* ctrl, void* data);
  110. static void onCommitAny(LLUICtrl* ctrl, void* data);
  111. // Default Mature and PG regions to proper classified access
  112. void setDefaultAccessCombo();
  113. bool checkDirty(); // Update and return mDirty
  114. protected:
  115. LLUUID mClassifiedID;
  116. LLUUID mRequestedID;
  117. LLUUID mCreatorID;
  118. LLUUID mParcelID;
  119. S32 mPriceForListing;
  120. LLTextureCtrl* mSnapshotCtrl;
  121. LLLineEditor* mNameEditor;
  122. LLTextEditor* mDescEditor;
  123. LLLineEditor* mLocationEditor;
  124. LLComboBox* mCategoryCombo;
  125. LLComboBox* mMatureCombo;
  126. LLCheckBoxCtrl* mAutoRenewCheck;
  127. LLButton* mUpdateBtn;
  128. LLButton* mTeleportBtn;
  129. LLButton* mMapBtn;
  130. LLButton* mProfileBtn;
  131. LLTextBox* mInfoText;
  132. LLButton* mSetBtn;
  133. LLTextBox* mClickThroughText;
  134. LLRect mSnapshotSize;
  135. // Needed for stat tracking
  136. S32 mTeleportClicksOld;
  137. S32 mMapClicksOld;
  138. S32 mProfileClicksOld;
  139. S32 mTeleportClicksNew;
  140. S32 mMapClicksNew;
  141. S32 mProfileClicksNew;
  142. std::string mSimName;
  143. LLVector3d mPosGlobal;
  144. bool mInFinder;
  145. bool mFromSearch; // from web-based "All" search sidebar
  146. bool mDirty;
  147. bool mForceClose;
  148. bool mLocationChanged;
  149. // Data will be requested on first draw
  150. bool mDataRequested;
  151. // For avatar panel classifieds only, has the user been charged yet for
  152. // this classified ? That is, have they saved it once ?
  153. bool mPaidFor;
  154. typedef fast_hset<LLPanelClassified*> panel_list_t;
  155. static panel_list_t sInstances;
  156. };
  157. class LLFloaterPriceForListing final : public LLFloater
  158. {
  159. public:
  160. LLFloaterPriceForListing();
  161. bool postBuild() override;
  162. static void show(void (*callback)(S32, std::string, void*),
  163. void* userdata);
  164. private:
  165. static void onClickSetPrice(void*);
  166. static void onClickCancel(void*);
  167. static void buttonCore(S32 button, void* data);
  168. private:
  169. void (*mCallback)(S32 option, std::string value, void* userdata);
  170. void* mUserData;
  171. };
  172. #endif // LL_LLPANELCLASSIFIED_H