From 08484cec5ac1933fdc689ddd3dcbca72229f8118 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 3 Aug 2023 22:42:37 +0300 Subject: SL-18049 Part 2; Added a button to preferences to enable sound when possible --- indra/newview/llpanelvoicedevicesettings.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelvoicedevicesettings.cpp') diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp index 28631e2b7b..5e1cf801b9 100644 --- a/indra/newview/llpanelvoicedevicesettings.cpp +++ b/indra/newview/llpanelvoicedevicesettings.cpp @@ -70,11 +70,14 @@ BOOL LLPanelVoiceDeviceSettings::postBuild() mCtrlInputDevices = getChild("voice_input_device"); mCtrlOutputDevices = getChild("voice_output_device"); + mRetryBtn = getChild("retry_btn"); mCtrlInputDevices->setCommitCallback( boost::bind(&LLPanelVoiceDeviceSettings::onCommitInputDevice, this)); mCtrlOutputDevices->setCommitCallback( boost::bind(&LLPanelVoiceDeviceSettings::onCommitOutputDevice, this)); + mRetryBtn->setCommitCallback( + boost::bind(&LLPanelVoiceDeviceSettings::onCommitRetry, this)); mLocalizedDeviceNames[DEFAULT_DEVICE] = getString("default_text"); mLocalizedDeviceNames["No Device"] = getString("name_no_device"); @@ -108,11 +111,25 @@ 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 && mUseTuningMode); + bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled(); + if (voice_enabled) + { + getChildView("wait_text")->setVisible( !is_in_tuning_mode && mUseTuningMode); + getChildView("muted_text")->setVisible(FALSE); + mRetryBtn->setVisible(FALSE); + } + else + { + getChildView("wait_text")->setVisible(FALSE); + getChildView("muted_text")->setVisible(TRUE); + + static LLCachedControl voice_enabled(gSavedSettings, "EnableVoiceChat"); + mRetryBtn->setVisible(!voice_enabled || LLVoiceClient::isMutedVoiceInstance()); + } LLPanel::draw(); - if (is_in_tuning_mode) + if (is_in_tuning_mode && voice_enabled) { const S32 num_bars = 5; F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL; @@ -339,3 +356,9 @@ void LLPanelVoiceDeviceSettings::onInputDevicesClicked() { LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed. } + +void LLPanelVoiceDeviceSettings::onCommitRetry() +{ + gSavedSettings.setBOOL("EnableVoiceChat", TRUE); + LLVoiceClient::unmuteVoiceInstance(); +} -- cgit v1.2.3 From a16babdf7d96fbbe345d9e0c5df178e48539751c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 4 Aug 2023 18:17:50 +0300 Subject: SL-18049 Part 4; Adjustments and fixes --- indra/newview/llpanelvoicedevicesettings.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelvoicedevicesettings.cpp') diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp index 5e1cf801b9..af57169f3b 100644 --- a/indra/newview/llpanelvoicedevicesettings.cpp +++ b/indra/newview/llpanelvoicedevicesettings.cpp @@ -32,6 +32,7 @@ // Viewer includes #include "llcombobox.h" #include "llsliderctrl.h" +#include "llstartup.h" #include "llviewercontrol.h" #include "llvoiceclient.h" #include "llvoicechannel.h" @@ -70,14 +71,14 @@ BOOL LLPanelVoiceDeviceSettings::postBuild() mCtrlInputDevices = getChild("voice_input_device"); mCtrlOutputDevices = getChild("voice_output_device"); - mRetryBtn = getChild("retry_btn"); + mUnmuteBtn = getChild("unmute_btn"); mCtrlInputDevices->setCommitCallback( boost::bind(&LLPanelVoiceDeviceSettings::onCommitInputDevice, this)); mCtrlOutputDevices->setCommitCallback( boost::bind(&LLPanelVoiceDeviceSettings::onCommitOutputDevice, this)); - mRetryBtn->setCommitCallback( - boost::bind(&LLPanelVoiceDeviceSettings::onCommitRetry, this)); + mUnmuteBtn->setCommitCallback( + boost::bind(&LLPanelVoiceDeviceSettings::onCommitUnmute, this)); mLocalizedDeviceNames[DEFAULT_DEVICE] = getString("default_text"); mLocalizedDeviceNames["No Device"] = getString("name_no_device"); @@ -115,16 +116,18 @@ void LLPanelVoiceDeviceSettings::draw() if (voice_enabled) { getChildView("wait_text")->setVisible( !is_in_tuning_mode && mUseTuningMode); - getChildView("muted_text")->setVisible(FALSE); - mRetryBtn->setVisible(FALSE); + getChildView("disabled_text")->setVisible(FALSE); + mUnmuteBtn->setVisible(FALSE); } else { getChildView("wait_text")->setVisible(FALSE); - getChildView("muted_text")->setVisible(TRUE); - static LLCachedControl voice_enabled(gSavedSettings, "EnableVoiceChat"); - mRetryBtn->setVisible(!voice_enabled || LLVoiceClient::isMutedVoiceInstance()); + static LLCachedControl chat_enabled(gSavedSettings, "EnableVoiceChat"); + // If voice isn't enabled, it is either disabled or muted + bool voice_disabled = chat_enabled() || LLStartUp::getStartupState() <= STATE_LOGIN_WAIT; + getChildView("disabled_text")->setVisible(voice_disabled); + mUnmuteBtn->setVisible(!voice_disabled); } LLPanel::draw(); @@ -357,8 +360,7 @@ void LLPanelVoiceDeviceSettings::onInputDevicesClicked() LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed. } -void LLPanelVoiceDeviceSettings::onCommitRetry() +void LLPanelVoiceDeviceSettings::onCommitUnmute() { gSavedSettings.setBOOL("EnableVoiceChat", TRUE); - LLVoiceClient::unmuteVoiceInstance(); } -- cgit v1.2.3