/indra/newview/lloutputmonitorctrl.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 152 lines · 61 code · 25 blank · 66 comment · 0 complexity · 721b79540697f1e0224ea6e59b71eeee MD5 · raw file

  1. /**
  2. * @file lloutputmonitorctrl.h
  3. * @brief LLOutputMonitorCtrl base class
  4. *
  5. * $LicenseInfo:firstyear=2001&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_LLOUTPUTMONITORCTRL_H
  27. #define LL_LLOUTPUTMONITORCTRL_H
  28. #include "v4color.h"
  29. #include "llview.h"
  30. #include "llmutelist.h"
  31. #include "llspeakingindicatormanager.h"
  32. #include "lluiimage.h"
  33. class LLTextBox;
  34. class LLUICtrlFactory;
  35. //
  36. // Classes
  37. //
  38. class LLOutputMonitorCtrl
  39. : public LLView, public LLSpeakingIndicator, LLMuteListObserver
  40. {
  41. public:
  42. struct Params : public LLInitParam::Block<Params, LLView::Params>
  43. {
  44. Optional<bool> draw_border;
  45. Mandatory<LLUIImage*> image_mute,
  46. image_off,
  47. image_on,
  48. image_level_1,
  49. image_level_2,
  50. image_level_3;
  51. Optional<bool> auto_update;
  52. Optional<LLUUID> speaker_id;
  53. Params();
  54. };
  55. protected:
  56. bool mBorder;
  57. LLOutputMonitorCtrl(const Params&);
  58. friend class LLUICtrlFactory;
  59. public:
  60. virtual ~LLOutputMonitorCtrl();
  61. // llview overrides
  62. virtual void draw();
  63. void setPower(F32 val);
  64. F32 getPower(F32 val) const { return mPower; }
  65. bool getIsMuted() const { return mIsMuted; }
  66. void setIsMuted(bool val) { mIsMuted = val; }
  67. // For the current user, need to know the PTT state to show
  68. // correct button image.
  69. void setIsAgentControl(bool val) { mIsAgentControl = val; }
  70. void setIsTalking(bool val) { mIsTalking = val; }
  71. /**
  72. * Sets avatar UUID to interact with voice channel.
  73. *
  74. * @param speaker_id LLUUID of an avatar whose voice level is displayed.
  75. * @param session_id session UUID for which indicator should be shown only. Passed to LLSpeakingIndicatorManager
  76. * If this parameter is set registered indicator will be shown only in voice channel
  77. * which has the same session id (EXT-5562).
  78. */
  79. void setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null);
  80. //called by mute list
  81. virtual void onChange();
  82. /**
  83. * Implementation of LLSpeakingIndicator interface.
  84. * Behavior is implemented via changing visibility.
  85. *
  86. * If instance is in visible chain now (all parents are visible) it changes visibility
  87. * and notify parent about this.
  88. *
  89. * Otherwise it marks an instance as dirty and stores necessary visibility.
  90. * It will be applied in next draw and parent will be notified.
  91. */
  92. virtual void switchIndicator(bool switch_on);
  93. private:
  94. /**
  95. * Notifies parent about changed visibility.
  96. *
  97. * Passes LLSD with "visibility_changed" => <current visibility> value.
  98. * For now it is processed by LLAvatarListItem to update (reshape) its children.
  99. * Implemented fo complete EXT-3976
  100. */
  101. void notifyParentVisibilityChanged();
  102. //static LLColor4 sColorMuted;
  103. //static LLColor4 sColorNormal;
  104. //static LLColor4 sColorOverdriven;
  105. static LLColor4 sColorBound;
  106. //static S32 sRectsNumber;
  107. //static F32 sRectWidthRatio;
  108. //static F32 sRectHeightRatio;
  109. F32 mPower;
  110. bool mIsAgentControl;
  111. bool mIsMuted;
  112. bool mIsTalking;
  113. LLPointer<LLUIImage> mImageMute;
  114. LLPointer<LLUIImage> mImageOff;
  115. LLPointer<LLUIImage> mImageOn;
  116. LLPointer<LLUIImage> mImageLevel1;
  117. LLPointer<LLUIImage> mImageLevel2;
  118. LLPointer<LLUIImage> mImageLevel3;
  119. /** whether to deal with LLVoiceClient::getInstance() directly */
  120. bool mAutoUpdate;
  121. /** uuid of a speaker being monitored */
  122. LLUUID mSpeakerId;
  123. /** indicates if the instance is dirty and should notify parent */
  124. bool mIsSwitchDirty;
  125. bool mShouldSwitchOn;
  126. };
  127. #endif