SL-18049 Part 2; Added a button to preferences to enable sound when possible

master
Andrey Kleshchev 2023-08-03 22:42:37 +03:00
parent a26573fefe
commit 08484cec5a
3 changed files with 51 additions and 4 deletions

View File

@ -70,11 +70,14 @@ BOOL LLPanelVoiceDeviceSettings::postBuild()
mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
mRetryBtn = getChild<LLButton>("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<bool> 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();
}

View File

@ -55,12 +55,14 @@ protected:
void onCommitOutputDevice();
void onOutputDevicesClicked();
void onInputDevicesClicked();
void onCommitRetry();
F32 mMicVolume;
std::string mInputDevice;
std::string mOutputDevice;
class LLComboBox *mCtrlInputDevices;
class LLComboBox *mCtrlOutputDevices;
class LLButton *mRetryBtn;
BOOL mDevicesUpdated;
bool mUseTuningMode;
std::map<std::string, std::string> mLocalizedDeviceNames;

View File

@ -122,7 +122,7 @@
layout="topleft"
left_pad="5"
name="wait_text"
top_delta="-1"
top_delta="2"
width="110">
Please wait
</text>
@ -132,7 +132,7 @@
layout="topleft"
left_delta="0"
name="bar0"
top_delta="-2"
top_delta="-5"
width="20" />
<locate
follows="right|top"
@ -166,4 +166,26 @@
name="bar4"
top_delta="0"
width="20" />
<text
type="string"
name="muted_text"
text_color="EmphasisColor"
length="1"
follows="right|top"
height="18"
layout="topleft"
left_delta="-100"
top_delta="5"
width="70">
Muted
</text>
<button
follows="right|top"
height="23"
image_overlay="Refresh_Off"
layout="topleft"
left_pad="1"
name="retry_btn"
top_delta="-5"
width="23" />
</panel>