diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-09-14 14:31:25 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-09-14 14:31:25 -0700 |
commit | 562006aa5585a42418cae978516505035cd34d8d (patch) | |
tree | f42488d1b07907937f5b9e236617d9f02297d32d /indra/newview/lloutputmonitorctrl.cpp | |
parent | 9a8042d5a3edfd07727793a1939c3ab361ceec9a (diff) | |
parent | 7cd1020f2953b776e1878e7b4e365d4b23e6b07b (diff) |
Merge with SVN viewer-2.0.0-3 branch
Diffstat (limited to 'indra/newview/lloutputmonitorctrl.cpp')
-rw-r--r-- | indra/newview/lloutputmonitorctrl.cpp | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index d088c45710..49b48f5a8e 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -38,6 +38,8 @@ // viewer includes #include "llvoiceclient.h" +#include "llmutelist.h" +#include "llagent.h" // default options set in output_monitor.xml static LLDefaultChildRegistry::Register<LLOutputMonitorCtrl> r("output_monitor"); @@ -58,7 +60,9 @@ LLOutputMonitorCtrl::Params::Params() image_on("image_on"), image_level_1("image_level_1"), image_level_2("image_level_2"), - image_level_3("image_level_3") + image_level_3("image_level_3"), + auto_update("auto_update"), + speaker_id("speaker_id") { draw_border = true; name = "output_monitor"; @@ -69,14 +73,14 @@ LLOutputMonitorCtrl::Params::Params() LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p) : LLView(p), mPower(0), - mIsMuted(true), - mIsTalking(false), mImageMute(p.image_mute), mImageOff(p.image_off), mImageOn(p.image_on), mImageLevel1(p.image_level_1), mImageLevel2(p.image_level_2), - mImageLevel3(p.image_level_3) + mImageLevel3(p.image_level_3), + mAutoUpdate(p.auto_update), + mSpeakerId(p.speaker_id) { //static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange); //static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red); @@ -99,10 +103,14 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p) //sRectHeightRatio = output_monitor_rect_height_ratio; mBorder = p.draw_border; + + //with checking mute state + setSpeakerId(mSpeakerId); } LLOutputMonitorCtrl::~LLOutputMonitorCtrl() { + LLMuteList::getInstance()->removeObserver(this); } void LLOutputMonitorCtrl::setPower(F32 val) @@ -121,6 +129,12 @@ void LLOutputMonitorCtrl::draw() const F32 LEVEL_1 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL * 2.f / 3.f; const F32 LEVEL_2 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; + if (getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull()) + { + setPower(gVoiceClient->getCurrentPower(mSpeakerId)); + setIsTalking(gVoiceClient->getUserPTTState()); + } + LLPointer<LLUIImage> icon; if (mIsMuted) { @@ -205,3 +219,29 @@ void LLOutputMonitorCtrl::draw() if(mBorder) gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE); } + +void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id) +{ + if (speaker_id.isNull()) return; + + mSpeakerId = speaker_id; + + //mute management + if (mAutoUpdate) + { + if (speaker_id == gAgentID) + { + setIsMuted(false); + } + else + { + setIsMuted(LLMuteList::getInstance()->isMuted(mSpeakerId)); + LLMuteList::getInstance()->addObserver(this); + } + } +} + +void LLOutputMonitorCtrl::onChange() +{ + setIsMuted(LLMuteList::getInstance()->isMuted(mSpeakerId)); +} |