From f3bb2e31dc6a1e8e02854a70db4ecd4cf586d4ba Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Wed, 4 May 2011 11:16:08 -0700
Subject: [PATCH] EXP-759 Opening the Voice preferences window from the up
 arrow on the speak button turns voice off for user without notice also causes
 calls to be ended

---
 indra/newview/llfloatersounddevices.cpp         |  7 ++++++-
 indra/newview/llpanelvoicedevicesettings.cpp    | 17 ++++++++++++-----
 indra/newview/llpanelvoicedevicesettings.h      |  3 +++
 .../default/xui/en/floater_sound_devices.xml    |  2 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/indra/newview/llfloatersounddevices.cpp b/indra/newview/llfloatersounddevices.cpp
index 4f3945c95ff..3903b9b0154 100644
--- a/indra/newview/llfloatersounddevices.cpp
+++ b/indra/newview/llfloatersounddevices.cpp
@@ -63,7 +63,12 @@ BOOL LLFloaterSoundDevices::postBuild()
 	if (mDragHandle)
 		mDragHandle->setTitleVisible(TRUE);
 	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
-	
+
+	LLPanelVoiceDeviceSettings* panel = findChild<LLPanelVoiceDeviceSettings>("device_settings_panel");
+	if (panel)
+	{
+		panel->setUseTuningMode(false);
+	}
 	return TRUE;
 }
 
diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp
index d13f57bd6a4..71bb4a5584a 100644
--- a/indra/newview/llpanelvoicedevicesettings.cpp
+++ b/indra/newview/llpanelvoicedevicesettings.cpp
@@ -51,6 +51,7 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
 	mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
 	mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
 	mDevicesUpdated = FALSE;
+	mUseTuningMode = true;
 
 	// grab "live" mic volume level
 	mMicVolume = gSavedSettings.getF32("AudioLevelMic");
@@ -96,7 +97,7 @@ void LLPanelVoiceDeviceSettings::draw()
 
 	// let user know that volume indicator is not yet available
 	bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
-	getChildView("wait_text")->setVisible( !is_in_tuning_mode);
+	getChildView("wait_text")->setVisible( !is_in_tuning_mode && mUseTuningMode);
 
 	LLPanel::draw();
 
@@ -292,14 +293,20 @@ void LLPanelVoiceDeviceSettings::initialize()
 	LLVoiceClient::getInstance()->refreshDeviceLists();
 
 	// put voice client in "tuning" mode
-	LLVoiceClient::getInstance()->tuningStart();
-	LLVoiceChannel::suspend();
+	if (mUseTuningMode)
+	{
+		LLVoiceClient::getInstance()->tuningStart();
+		LLVoiceChannel::suspend();
+	}
 }
 
 void LLPanelVoiceDeviceSettings::cleanup()
 {
-	LLVoiceClient::getInstance()->tuningStop();
-	LLVoiceChannel::resume();
+	if (mUseTuningMode)
+	{
+		LLVoiceClient::getInstance()->tuningStop();
+		LLVoiceChannel::resume();
+	}
 }
 
 void LLPanelVoiceDeviceSettings::onCommitInputDevice()
diff --git a/indra/newview/llpanelvoicedevicesettings.h b/indra/newview/llpanelvoicedevicesettings.h
index 636b8b99481..d09476d4697 100644
--- a/indra/newview/llpanelvoicedevicesettings.h
+++ b/indra/newview/llpanelvoicedevicesettings.h
@@ -45,6 +45,8 @@ class LLPanelVoiceDeviceSettings : public LLPanel
 	void cleanup();
 
 	/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
+
+	void setUseTuningMode(bool use) { mUseTuningMode = use; };
 	
 protected:
 	void onCommitInputDevice();
@@ -56,6 +58,7 @@ class LLPanelVoiceDeviceSettings : public LLPanel
 	class LLComboBox		*mCtrlInputDevices;
 	class LLComboBox		*mCtrlOutputDevices;
 	BOOL mDevicesUpdated;
+	bool mUseTuningMode;
 };
 
 #endif // LL_LLPANELVOICEDEVICESETTINGS_H
diff --git a/indra/newview/skins/default/xui/en/floater_sound_devices.xml b/indra/newview/skins/default/xui/en/floater_sound_devices.xml
index 584413c030c..b5d95aeca43 100644
--- a/indra/newview/skins/default/xui/en/floater_sound_devices.xml
+++ b/indra/newview/skins/default/xui/en/floater_sound_devices.xml
@@ -21,7 +21,7 @@
     follows="all"
     filename="panel_sound_devices.xml"
     name="device_settings_panel"
-    width="300"
+    width="400"
     left="2"
     top="26"
     class="panel_voice_device_settings"/>
-- 
GitLab