summaryrefslogtreecommitdiff
path: root/indra/newview/lloutputmonitorctrl.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2010-02-24 17:04:48 -0800
committerRoxie Linden <roxie@lindenlab.com>2010-02-24 17:04:48 -0800
commit6bb43e1369d957a041c796120e87a89ff3fa10ee (patch)
tree678e25f3b62ab90e2940dfcae5feafa1acaa8ffc /indra/newview/lloutputmonitorctrl.cpp
parentff52ac089f9ed67410f80fe66d0b997f0f2dafcc (diff)
parentfc633fce71c6bdd43ab009558c7556f528335fe0 (diff)
Automated merge up from viewer 2.0 trunk.
Some llvoiceclient changes duplicated changes that had already been made in the voice modularization refactor, so the refactor versions were used.
Diffstat (limited to 'indra/newview/lloutputmonitorctrl.cpp')
-rw-r--r--indra/newview/lloutputmonitorctrl.cpp65
1 files changed, 64 insertions, 1 deletions
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index 953121bd6f..3b42fc1508 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -77,7 +77,9 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p)
mImageLevel3(p.image_level_3),
mAutoUpdate(p.auto_update),
mSpeakerId(p.speaker_id),
- mIsAgentControl(false)
+ mIsAgentControl(false),
+ mIsSwitchDirty(false),
+ mShouldSwitchOn(false)
{
//static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange);
//static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red);
@@ -108,6 +110,7 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p)
LLOutputMonitorCtrl::~LLOutputMonitorCtrl()
{
LLMuteList::getInstance()->removeObserver(this);
+ LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
}
void LLOutputMonitorCtrl::setPower(F32 val)
@@ -117,6 +120,26 @@ void LLOutputMonitorCtrl::setPower(F32 val)
void LLOutputMonitorCtrl::draw()
{
+ // see also switchIndicator()
+ if (mIsSwitchDirty)
+ {
+ mIsSwitchDirty = false;
+ if (mShouldSwitchOn)
+ {
+ // just notify parent visibility may have changed
+ notifyParentVisibilityChanged();
+ }
+ else
+ {
+ // make itself invisible and notify parent about this
+ setVisible(FALSE);
+ notifyParentVisibilityChanged();
+
+ // no needs to render for invisible element
+ return;
+ }
+ }
+
// Copied from llmediaremotectrl.cpp
// *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
// call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
@@ -229,6 +252,7 @@ void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id)
if (speaker_id.isNull() || speaker_id == mSpeakerId) return;
mSpeakerId = speaker_id;
+ LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this);
//mute management
if (mAutoUpdate)
@@ -251,3 +275,42 @@ void LLOutputMonitorCtrl::onChange()
// check only blocking on voice. EXT-3542
setIsMuted(LLMuteList::getInstance()->isMuted(mSpeakerId, LLMute::flagVoiceChat));
}
+
+// virtual
+void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
+{
+ // ensure indicator is visible in case it is not in visible chain
+ // to be called when parent became visible next time to notify parent that visibility is changed.
+ setVisible(TRUE);
+
+ // if parent is in visible chain apply switch_on state and notify it immediately
+ if (getParent() && getParent()->isInVisibleChain())
+ {
+ LL_DEBUGS("SpeakingIndicator") << "Indicator is in visible chain, notifying parent: " << mSpeakerId << LL_ENDL;
+ setVisible((BOOL)switch_on);
+ notifyParentVisibilityChanged();
+ }
+
+ // otherwise remember necessary state and mark itself as dirty.
+ // State will be applied i next draw when parents chain became visible.
+ else
+ {
+ LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL;
+ mIsSwitchDirty = true;
+ mShouldSwitchOn = switch_on;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE SECTION
+//////////////////////////////////////////////////////////////////////////
+void LLOutputMonitorCtrl::notifyParentVisibilityChanged()
+{
+ LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << " ,new_visibility: " << getVisible() << LL_ENDL;
+
+ LLSD params = LLSD().with("visibility_changed", getVisible());
+
+ notifyParent(params);
+}
+
+// EOF