From 4258b7c3bdfb801a333e0c826da3a18ef9c61c54 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 12 Aug 2010 18:10:19 -0700 Subject: Added 'Reset Voice' button to Preferences > Voice from Emerald --- linden/indra/newview/llprefsvoice.cpp | 26 ++++++++++++++++++++++ linden/indra/newview/llprefsvoice.h | 1 + linden/indra/newview/llvoiceclient.cpp | 4 ++-- .../default/xui/en-us/panel_preferences_voice.xml | 3 +++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/linden/indra/newview/llprefsvoice.cpp b/linden/indra/newview/llprefsvoice.cpp index c2f42ff..167e079 100644 --- a/linden/indra/newview/llprefsvoice.cpp +++ b/linden/indra/newview/llprefsvoice.cpp @@ -111,6 +111,7 @@ LLPrefsVoice::~LLPrefsVoice() BOOL LLPrefsVoice::postBuild() { childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this); + childSetAction("reset_voice", onClickResetVoice, this); childSetAction("set_voice_hotkey_button", onClickSetKey, this); childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this); childSetAction("device_settings_btn", onClickVoiceDeviceSettings, NULL); @@ -192,6 +193,31 @@ void LLPrefsVoice::onClickSetKey(void* user_data) dialog->startModal(); } + +void LLPrefsVoice::onClickResetVoice(void* user_data) +{ + // *TODO: Change this to make voice really reset + BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); + bool enable = !voice_disabled && gSavedSettings.getBOOL("EnableVoiceChat"); + if(enable) + { + //Seems to make voice at least reconnect to the current channel. + //Was hopeing it would have actualy restarted voice. --Liny + gSavedSettings.setBOOL("EnableVoiceChat", FALSE); + LLFloaterVoiceDeviceSettings* voice_device_settings = LLFloaterVoiceDeviceSettings::getInstance(); + if(voice_device_settings) + { + voice_device_settings->apply(); + } + gSavedSettings.setBOOL("EnableVoiceChat", TRUE); + voice_device_settings = LLFloaterVoiceDeviceSettings::getInstance(); + if(voice_device_settings) + { + voice_device_settings->apply(); + } + } +} + //static void LLPrefsVoice::onClickSetMiddleMouse(void* user_data) { diff --git a/linden/indra/newview/llprefsvoice.h b/linden/indra/newview/llprefsvoice.h index 49f6035..af298c5 100644 --- a/linden/indra/newview/llprefsvoice.h +++ b/linden/indra/newview/llprefsvoice.h @@ -50,6 +50,7 @@ public: private: static void onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data); + static void onClickResetVoice(void* user_data); static void onClickSetKey(void* user_data); static void onClickSetMiddleMouse(void* user_data); static void onClickVoiceDeviceSettings(void* user_data); diff --git a/linden/indra/newview/llvoiceclient.cpp b/linden/indra/newview/llvoiceclient.cpp index 908bedb..660b60a 100644 --- a/linden/indra/newview/llvoiceclient.cpp +++ b/linden/indra/newview/llvoiceclient.cpp @@ -1215,7 +1215,7 @@ void LLVoiceClient::terminate() void LLVoiceClient::updateSettings() { - setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat")); + setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice")); setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled")); std::string keyString = gSavedSettings.getString("PushToTalkButton"); setPTTKey(keyString); @@ -5821,7 +5821,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled) bool LLVoiceClient::voiceEnabled() { - return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); + return LLVoiceClient::getInstance()->mVoiceEnabled;//gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); } void LLVoiceClient::setLipSyncEnabled(BOOL enabled) diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml index 8712be5..8e6fc0d 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml @@ -76,6 +76,9 @@