llfloatermediasettings.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * @file llfloatermediasettings.h
  3. * @brief Media settings floater - class definition
  4. *
  5. * $LicenseInfo:firstyear=2010&license=viewergpl$
  6. *
  7. * Copyright (c) 2010, 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_LLFLOATERMEDIASETTINGS_H
  33. #define LL_LLFLOATERMEDIASETTINGS_H
  34. #include "llerror.h"
  35. #include "llfloater.h"
  36. class LLButton;
  37. class LLCheckBoxCtrl;
  38. class LLComboBox;
  39. class LLLineEditor;
  40. class LLMediaCtrl;
  41. class LLNameEditor;
  42. class LLScrollListCtrl;
  43. class LLSpinCtrl;
  44. class LLTabContainer;
  45. class LLTextBox;
  46. class LLFloaterMediaSettings final
  47. : public LLFloater,
  48. public LLFloaterSingleton<LLFloaterMediaSettings>
  49. {
  50. friend class LLUISingleton<LLFloaterMediaSettings,
  51. VisibilityPolicy<LLFloater> >;
  52. protected:
  53. LOG_CLASS(LLFloaterMediaSettings);
  54. public:
  55. bool postBuild() override;
  56. void draw() override;
  57. void close(bool app_quitting = false) override;
  58. static void initValues(LLSD& media_settings, bool editable);
  59. static void clearValues(bool editable);
  60. static void setHasMediaInfo(bool b) { sIdenticalHasMediaInfo = b; }
  61. static bool getHasMediaInfo() { return sIdenticalHasMediaInfo; }
  62. static void setMultipleMedia(bool b) { sMultipleMedia = b; }
  63. static bool getMultipleMedia() { return sMultipleMedia; }
  64. static void setMultipleValidMedia(bool b) { sMultipleValidMedia = b; }
  65. static bool getMultipleValidMedia() { return sMultipleValidMedia; }
  66. static const std::string getHomeUrl();
  67. private:
  68. LLFloaterMediaSettings(const LLSD&);
  69. void getValues(LLSD& fill_me_in, bool include_tentative);
  70. bool haveValuesChanged();
  71. void apply();
  72. void updateMediaPreview();
  73. bool checkHomeUrlPassesWhitelist();
  74. bool urlPassesWhiteList(const std::string& test_url);
  75. const std::string makeValidUrl(const std::string& src_url);
  76. void updateWhitelistEnableStatus();
  77. void updateCurrentUrl();
  78. bool navigateHomeSelectedFace(bool only_if_current_is_empty);
  79. void commitFields();
  80. void addWhiteListEntry(const std::string& url);
  81. static void createInstance();
  82. static bool isMultiple();
  83. // Callbacks
  84. static void onTabChanged(void* userdata, bool from_click);
  85. static void onCommitHomeURL(LLUICtrl* ctrl, void* userdata);
  86. static void onCommitNewPattern(LLUICtrl* ctrl, void* userdata);
  87. static void onBtnResetCurrentUrl(void *userdata);
  88. static void onBtnOK(void* userdata);
  89. static void onBtnCancel(void* userdata);
  90. static void onBtnApply(void* userdata);
  91. static void onBtnDel(void* userdata);
  92. private:
  93. LLButton* mOKBtn;
  94. LLButton* mCancelBtn;
  95. LLButton* mApplyBtn;
  96. LLButton* mResetCurrentUrlBtn;
  97. LLButton* mDeleteBtn;
  98. LLTextBox* mCurrentUrlLabel;
  99. LLTextBox* mCurrentURL;
  100. LLTextBox* mFailWhiteListText;
  101. LLTextBox* mHomeUrlFailsWhiteListText;
  102. LLSpinCtrl* mWidthPixels;
  103. LLSpinCtrl* mHeightPixels;
  104. LLComboBox* mControls;
  105. LLMediaCtrl* mPreviewMedia;
  106. LLLineEditor* mHomeURL;
  107. LLLineEditor* mNewWhiteListPattern;
  108. LLNameEditor* mPermsGroupName;
  109. LLCheckBoxCtrl* mAutoLoop;
  110. LLCheckBoxCtrl* mFirstClick;
  111. LLCheckBoxCtrl* mAutoZoom;
  112. LLCheckBoxCtrl* mAutoPlay;
  113. LLCheckBoxCtrl* mAutoScale;
  114. LLCheckBoxCtrl* mPermsOwnerInteract;
  115. LLCheckBoxCtrl* mPermsOwnerControl;
  116. LLCheckBoxCtrl* mPermsGroupInteract;
  117. LLCheckBoxCtrl* mPermsGroupControl;
  118. LLCheckBoxCtrl* mPermsWorldInteract;
  119. LLCheckBoxCtrl* mPermsWorldControl;
  120. LLCheckBoxCtrl* mEnableWhiteList;
  121. LLScrollListCtrl* mWhiteListList;
  122. LLTabContainer* mTabContainer;
  123. LLUUID mGroupId;
  124. LLSD mInitialValues;
  125. bool mFirstRun;
  126. bool mMediaEditable;
  127. bool mHomeUrlCommitted;
  128. static bool sIdenticalHasMediaInfo;
  129. static bool sMultipleMedia;
  130. static bool sMultipleValidMedia;
  131. };
  132. #endif // LL_LLFLOATERMEDIASETTINGS_H