From bce1630e269c0f39f9fa9a5e0840154da6b0d727 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Fri, 22 Mar 2019 17:31:26 +0200
Subject: SL-10780 FIXED Speaker icon is shown for all friends

---
 indra/newview/llavatarlistitem.cpp    |  1 +
 indra/newview/lloutputmonitorctrl.cpp | 15 ++++++++++-----
 indra/newview/lloutputmonitorctrl.h   | 11 ++++++++++-
 3 files changed, 21 insertions(+), 6 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index af3fac91bc..396b69ae3a 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -119,6 +119,7 @@ BOOL  LLAvatarListItem::postBuild()
 	mIconPermissionEditTheirs->setVisible(false);
 
 	mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
+	mSpeakingIndicator->setChannelState(LLOutputMonitorCtrl::UNDEFINED_CHANNEL);
 	mInfoBtn = getChild<LLButton>("info_btn");
 	mProfileBtn = getChild<LLButton>("profile_btn");
 
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index a873ccf98b..7f6c065bb9 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -74,9 +74,9 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p)
 	mSpeakerId(p.speaker_id),
 	mIsModeratorMuted(false),
 	mIsAgentControl(false),
-	mIsActiveChannel(false),
 	mIndicatorToggled(false),
-	mShowParticipantsSpeaking(false)
+	mShowParticipantsSpeaking(false),
+	mChannelState(INACTIVE_CHANNEL)
 {
 	//static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange);
 	//static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red);
@@ -259,8 +259,13 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
 
 void LLOutputMonitorCtrl::setIsActiveChannel(bool val)
 {
-    mIsActiveChannel = val;
-    if (!val)
+    setChannelState(val ? ACTIVE_CHANNEL : INACTIVE_CHANNEL);
+}
+
+void LLOutputMonitorCtrl::setChannelState(EChannelState state)
+{
+    mChannelState = state;
+    if (state == INACTIVE_CHANNEL)
     {
         // switchIndicator will set it to TRUE when channel becomes active
         setVisible(FALSE);
@@ -316,7 +321,7 @@ void LLOutputMonitorCtrl::onChange()
 // virtual
 void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
 {
-    if (mIsActiveChannel && getVisible() != (BOOL)switch_on)
+    if ((mChannelState != INACTIVE_CHANNEL) && (getVisible() != (BOOL)switch_on))
     {
         setVisible(switch_on);
         
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index 307cd30ab3..98966d39ee 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -81,8 +81,16 @@ public:
 	void			setIsAgentControl(bool val) { mIsAgentControl = val; }
 	void			setIsTalking(bool val) { mIsTalking = val; }
 
+	enum EChannelState
+	{
+		ACTIVE_CHANNEL,
+		INACTIVE_CHANNEL,
+		UNDEFINED_CHANNEL
+	};
+
 	// switchIndicator controls visibility, 'active channel' governs if we are allowed to show indicator
 	void			setIsActiveChannel(bool val);
+	void			setChannelState(EChannelState state);
 
 	void			setShowParticipantsSpeaking(bool show) { mShowParticipantsSpeaking = show; }
 
@@ -139,7 +147,6 @@ private:
 	bool			mIsModeratorMuted;
 	bool			mIsMuted;
 	bool			mIsTalking;
-	bool			mIsActiveChannel;
 	bool			mShowParticipantsSpeaking;
 	LLPointer<LLUIImage> mImageMute;
 	LLPointer<LLUIImage> mImageOff;
@@ -155,6 +162,8 @@ private:
 	LLUUID			mSpeakerId;
 
     bool mIndicatorToggled;
+
+    EChannelState	mChannelState;
 };
 
 #endif
-- 
cgit v1.2.3