/indra/newview/llpanelnearbymedia.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 182 lines · 118 code · 29 blank · 35 comment · 0 complexity · 5276c43e1e03c1e1986efe88d5edb928 MD5 · raw file

  1. /**
  2. * @file llpanelnearbymedia.h
  3. * @brief Management interface for muting and controlling nearby media
  4. *
  5. * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLPANELNEARBYMEDIA_H
  27. #define LL_LLPANELNEARBYMEDIA_H
  28. #include "llpanel.h"
  29. class LLPanelNearbyMedia;
  30. class LLButton;
  31. class LLScrollListCtrl;
  32. class LLSlider;
  33. class LLSliderCtrl;
  34. class LLCheckBoxCtrl;
  35. class LLTextBox;
  36. class LLComboBox;
  37. class LLViewerMediaImpl;
  38. class LLPanelNearByMedia : public LLPanel
  39. {
  40. public:
  41. /*virtual*/ BOOL postBuild();
  42. /*virtual*/ void draw();
  43. /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
  44. /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
  45. /*virtual*/ void onTopLost();
  46. /*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
  47. /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
  48. /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
  49. // this is part of the nearby media *dialog* so we can track whether
  50. // the user *implicitly* wants audio on or off via their *explicit*
  51. // interaction with our buttons.
  52. bool getParcelAudioAutoStart();
  53. // callback for when the auto play media preference changes
  54. // to update mParcelAudioAutoStart
  55. void handleMediaAutoPlayChanged(const LLSD& newvalue);
  56. LLPanelNearByMedia();
  57. virtual ~LLPanelNearByMedia();
  58. private:
  59. enum ColumnIndex {
  60. CHECKBOX_COLUMN = 0,
  61. PROXIMITY_COLUMN = 1,
  62. VISIBILITY_COLUMN = 2,
  63. CLASS_COLUMN = 3,
  64. NAME_COLUMN = 4,
  65. DEBUG_COLUMN = 5
  66. };
  67. // Media "class" enumeration
  68. enum MediaClass {
  69. MEDIA_CLASS_ALL = 0,
  70. MEDIA_CLASS_FOCUSED = 1,
  71. MEDIA_CLASS_WITHIN_PARCEL = 2,
  72. MEDIA_CLASS_OUTSIDE_PARCEL = 3,
  73. MEDIA_CLASS_ON_OTHERS = 4
  74. };
  75. // Add/remove an LLViewerMediaImpl to/from the list
  76. LLScrollListItem* addListItem(const LLUUID &id);
  77. void updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl);
  78. void updateListItem(LLScrollListItem* item,
  79. const std::string &item_name,
  80. const std::string &item_tooltip,
  81. S32 proximity,
  82. bool is_disabled,
  83. bool has_media,
  84. bool is_time_based_and_playing,
  85. MediaClass media_class,
  86. const std::string &debug_str);
  87. void removeListItem(const LLUUID &id);
  88. // Refresh the list in the UI
  89. void refreshList();
  90. void refreshParcelItems();
  91. // UI Callbacks
  92. void onClickEnableAll();
  93. void onClickDisableAll();
  94. void onClickEnableParcelMedia();
  95. void onClickDisableParcelMedia();
  96. void onClickMuteParcelMedia();
  97. void onParcelMediaVolumeSlider();
  98. void onClickParcelMediaPlay();
  99. void onClickParcelMediaStop();
  100. void onClickParcelMediaPause();
  101. void onClickParcelAudioPlay();
  102. void onClickParcelAudioStop();
  103. void onClickParcelAudioPause();
  104. void onCheckAutoPlay();
  105. void onAdvancedButtonClick();
  106. void onMoreLess();
  107. void onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id);
  108. static void onZoomMedia(void* user_data);
  109. private:
  110. bool setDisabled(const LLUUID &id, bool disabled);
  111. static void getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName);
  112. void updateColumns();
  113. bool shouldShow(LLViewerMediaImpl* impl);
  114. void showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
  115. void showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
  116. void showDisabledControls();
  117. void updateControls();
  118. void onClickSelectedMediaStop();
  119. void onClickSelectedMediaPlay();
  120. void onClickSelectedMediaPause();
  121. void onClickSelectedMediaMute();
  122. void onCommitSelectedMediaVolume();
  123. void onClickSelectedMediaZoom();
  124. void onClickSelectedMediaUnzoom();
  125. LLUICtrl* mNearbyMediaPanel;
  126. LLScrollListCtrl* mMediaList;
  127. LLUICtrl* mEnableAllCtrl;
  128. LLUICtrl* mDisableAllCtrl;
  129. LLComboBox* mShowCtrl;
  130. // Dynamic (selection-dependent) controls
  131. LLUICtrl* mStopCtrl;
  132. LLUICtrl* mPlayCtrl;
  133. LLUICtrl* mPauseCtrl;
  134. LLUICtrl* mMuteCtrl;
  135. LLUICtrl* mVolumeSliderCtrl;
  136. LLUICtrl* mZoomCtrl;
  137. LLUICtrl* mUnzoomCtrl;
  138. LLSlider* mVolumeSlider;
  139. LLButton* mMuteBtn;
  140. bool mAllMediaDisabled;
  141. bool mDebugInfoVisible;
  142. bool mParcelAudioAutoStart;
  143. std::string mEmptyNameString;
  144. std::string mPlayingString;
  145. std::string mParcelMediaName;
  146. std::string mParcelAudioName;
  147. LLRect mMoreRect;
  148. LLRect mLessRect;
  149. LLFrameTimer mHoverTimer;
  150. LLScrollListItem* mParcelMediaItem;
  151. LLScrollListItem* mParcelAudioItem;
  152. };
  153. #endif // LL_LLPANELNEARBYMEDIA_H