From 86769b40aac266701b56daa6c78b924aad4d3ca9 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 14 Jan 2010 16:48:06 +0200 Subject: Work on major bug EXT-3976 (Voice chat speaking indicators should only display when users are in the same voice channel) -- implemented functionality to have voice indicator visible only for avatars in the same voice channel with agent All speacking indicators should be registered in LLSpeakingIndicatorManager to be provcessed for the voice channel. They should implement switchIndicator(bool) as reaction on voice state changing --HG-- branch : product-engine --- indra/newview/lloutputmonitorctrl.cpp | 74 ++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutputmonitorctrl.cpp') diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 63803469dd..89b0105ae9 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 gVoiceClient 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,51 @@ void LLOutputMonitorCtrl::onChange() // check only blocking on voice. EXT-3542 setIsMuted(LLMuteList::getInstance()->isMuted(mSpeakerId, LLMute::flagVoiceChat)); } + +// virtual +void LLOutputMonitorCtrl::switchIndicator(bool switch_on) +{ + if (switch_on) + { + setVisible((BOOL)switch_on); + if (isInVisibleChain()) + { + notifyParentVisibilityChanged(); + } + else + { + LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL; + mIsSwitchDirty = true; + mShouldSwitchOn = true; + } + } + else + { + if (isInVisibleChain()) + { + LL_DEBUGS("SpeakingIndicator") << "Indicator is in visible chain, notifying parent: " << mSpeakerId << LL_ENDL; + setVisible((BOOL)switch_on); + notifyParentVisibilityChanged(); + } + else + { + LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL; + mIsSwitchDirty = true; + mShouldSwitchOn = false; + } + } +} + +////////////////////////////////////////////////////////////////////////// +// 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 -- cgit v1.2.3 From f606a5b300a5f4a84523761df4ba6f5198c06c10 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 14 Jan 2010 17:14:43 +0200 Subject: Work on major bug EXT-3976 (Voice chat speaking indicators should only display when users are in the same voice channel) -- fixed bug: "Indicator does not appear if two indicators are visible for the same avatar on second switching to the same voice channel" --HG-- branch : product-engine --- indra/newview/lloutputmonitorctrl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lloutputmonitorctrl.cpp') diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 89b0105ae9..80477c1041 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -282,7 +282,7 @@ void LLOutputMonitorCtrl::switchIndicator(bool switch_on) if (switch_on) { setVisible((BOOL)switch_on); - if (isInVisibleChain()) + if (getParent() && getParent()->isInVisibleChain()) { notifyParentVisibilityChanged(); } @@ -295,7 +295,7 @@ void LLOutputMonitorCtrl::switchIndicator(bool switch_on) } else { - if (isInVisibleChain()) + if (getParent() && getParent()->isInVisibleChain()) { LL_DEBUGS("SpeakingIndicator") << "Indicator is in visible chain, notifying parent: " << mSpeakerId << LL_ENDL; setVisible((BOOL)switch_on); -- cgit v1.2.3 From 44e1f34f962c0e75172286b63f3514c60fee536b Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 14 Jan 2010 17:29:56 +0200 Subject: Work on major bug EXT-3976 (Voice chat speaking indicators should only display when users are in the same voice channel) -- refactoring: implemented processing of switching indicator on/off in the same way --HG-- branch : product-engine --- indra/newview/lloutputmonitorctrl.cpp | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'indra/newview/lloutputmonitorctrl.cpp') diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 80477c1041..47e519df8d 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -279,34 +279,19 @@ void LLOutputMonitorCtrl::onChange() // virtual void LLOutputMonitorCtrl::switchIndicator(bool switch_on) { - if (switch_on) + setVisible(TRUE); + + if (getParent() && getParent()->isInVisibleChain()) { + LL_DEBUGS("SpeakingIndicator") << "Indicator is in visible chain, notifying parent: " << mSpeakerId << LL_ENDL; setVisible((BOOL)switch_on); - if (getParent() && getParent()->isInVisibleChain()) - { - notifyParentVisibilityChanged(); - } - else - { - LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL; - mIsSwitchDirty = true; - mShouldSwitchOn = true; - } + notifyParentVisibilityChanged(); } else { - if (getParent() && getParent()->isInVisibleChain()) - { - LL_DEBUGS("SpeakingIndicator") << "Indicator is in visible chain, notifying parent: " << mSpeakerId << LL_ENDL; - setVisible((BOOL)switch_on); - notifyParentVisibilityChanged(); - } - else - { - LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL; - mIsSwitchDirty = true; - mShouldSwitchOn = false; - } + LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL; + mIsSwitchDirty = true; + mShouldSwitchOn = switch_on; } } -- cgit v1.2.3 From 2029bf92e2ba846274f99cb740cf0fade4ea2796 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 14 Jan 2010 17:35:57 +0200 Subject: Work on major bug EXT-3976 (Voice chat speaking indicators should only display when users are in the same voice channel) -- improvements: added more comment for LLOutputMonitorCtrl::switchIndicator --HG-- branch : product-engine --- indra/newview/lloutputmonitorctrl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/lloutputmonitorctrl.cpp') diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 47e519df8d..f816dc589d 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -279,14 +279,20 @@ void LLOutputMonitorCtrl::onChange() // 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; -- cgit v1.2.3