llfloaternearbymedia.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**
  2. * @file llfloaternearbymedia.h
  3. * @brief Management interface for muting and controlling nearby media
  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_LLFLOATERNEARBYMEDIA_H
  33. #define LL_LLFLOATERNEARBYMEDIA_H
  34. #include "llfloater.h"
  35. #include "llviewercontrol.h"
  36. class LLButton;
  37. class LLComboBox;
  38. class LLLineEditor;
  39. class LLScrollListCtrl;
  40. class LLScrollListItem;
  41. class LLSliderCtrl;
  42. class LLTextBox;
  43. class LLViewerMediaImpl;
  44. class LLFloaterNearByMedia final
  45. : public LLFloater,
  46. public LLFloaterSingleton<LLFloaterNearByMedia>
  47. {
  48. friend class LLUISingleton<LLFloaterNearByMedia,
  49. VisibilityPolicy<LLFloater> >;
  50. public:
  51. ~LLFloaterNearByMedia() override;
  52. bool postBuild() override;
  53. void draw() override;
  54. private:
  55. // Open only via LLFloaterSingleton interface, i.e. showInstance() or
  56. // toggleInstance().
  57. LLFloaterNearByMedia(const LLSD&);
  58. enum ColumnIndex {
  59. CHECKBOX_COLUMN = 0,
  60. PROXIMITY_COLUMN = 1,
  61. VISIBILITY_COLUMN = 2,
  62. CLASS_COLUMN = 3,
  63. NAME_COLUMN = 4
  64. };
  65. // Media "class" enumeration
  66. enum MediaClass {
  67. MEDIA_CLASS_ALL = 0,
  68. MEDIA_CLASS_WITHIN_PARCEL = 1,
  69. MEDIA_CLASS_OUTSIDE_PARCEL = 2,
  70. MEDIA_CLASS_ON_OTHERS = 3,
  71. MEDIA_CLASS_ON_HUD_OBJECT = 4
  72. };
  73. void updateControls();
  74. void showBasicControls(bool playing, bool include_zoom, bool is_zoomed,
  75. bool muted, F32 volume);
  76. void showTimeBasedControls(bool playing, bool paused,
  77. bool include_zoom, bool is_zoomed,
  78. bool muted, F32 volume);
  79. void showDisabledControls();
  80. void refreshParcelItems();
  81. void refreshMediaURL();
  82. void refreshList(bool fresh = false);
  83. bool shouldShow(LLViewerMediaImpl* impl);
  84. LLScrollListItem* addListItem(const LLUUID& id);
  85. void updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl);
  86. void updateListItem(LLScrollListItem* item,
  87. const std::string& item_name,
  88. const std::string& item_tooltip,
  89. S32 proximity,
  90. bool is_disabled,
  91. bool has_media,
  92. bool is_time_based_and_playing,
  93. MediaClass media_class,
  94. bool focused);
  95. void removeListItem(const LLUUID& id);
  96. void mediaEnable(const LLUUID& row_id, bool enable = true);
  97. static void getNameAndUrlHelper(LLViewerMediaImpl* impl,
  98. std::string& name,
  99. std::string& url,
  100. const std::string& default_name);
  101. // Callbacks
  102. static void onClickEnableAll(void*);
  103. static void onClickDisableAll(void*);
  104. static void onOpenPrefs(void*);
  105. static void onClickSelectedMediaPlay(void* user_data);
  106. static void onClickSelectedMediaPause(void* user_data);
  107. static void onClickSelectedMediaStop(void* user_data);
  108. static void onClickSelectedMediaMute(void* user_data);
  109. static void onClickSelectedMediaUnmute(void* user_data);
  110. static void onClickSelectedMediaZoom(void* user_data);
  111. static void onClickSelectedMediaUnzoom(void*);
  112. static void onCheckItem(LLUICtrl* ctrl, void* user_data);
  113. static void onCommitMediaType(LLUICtrl*, void* user_data);
  114. static void onCommitMediaURL(LLUICtrl* ctrl, void* user_data);
  115. static void onSelectNewMedia(LLUICtrl* ctrl, void* data);
  116. static void onCommitSelectedMediaVolume(LLUICtrl*, void* user_data);
  117. private:
  118. LLButton* mEnableAllButton;
  119. LLButton* mDisableAllButton;
  120. LLButton* mOpenPrefsButton;
  121. LLButton* mPlayButton;
  122. LLButton* mPauseButton;
  123. LLButton* mStopButton;
  124. LLButton* mZoomButton;
  125. LLButton* mUnzoomButton;
  126. LLButton* mMuteButton;
  127. LLButton* mUnmuteButton;
  128. LLSliderCtrl* mVolumeSlider;
  129. LLTextBox* mMediaURLText;
  130. LLComboBox* mMediaTypeCombo;
  131. LLLineEditor* mMediaURLEditor;
  132. LLScrollListCtrl* mMediaList;
  133. LLScrollListItem* mParcelMediaItem;
  134. LLScrollListItem* mParcelAudioItem;
  135. std::string mEmptyNameString;
  136. std::string mPlayingString;
  137. std::string mParcelMediaName;
  138. std::string mParcelAudioName;
  139. std::string mPreviousURL;
  140. LLCachedControl<bool> mStreamingMusic;
  141. LLCachedControl<bool> mSteamingMedia;
  142. LLCachedControl<bool> mSharedMedia;
  143. };
  144. #endif // LL_LLFLOATERNEARBYMEDIA_H