[Preferences Refactor] Cleanup of voice prefs code
Also attempt to add a local enablement control, it's not quite clear where these are supposed to hook in, so it's unused for now, but it would have replaced onCommitEnableVoiceCheck. Also fix the location of the voice is disabled textytext, it was too on top of the next checkbox.
This commit is contained in:
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
BOOL handleKeyHere(KEY key, MASK mask);
|
||||
|
||||
static void onCancel(void* user_data);
|
||||
static void start(LLPrefsVoice* p) { (new LLVoiceSetKeyDialog(p))->startModal(); }
|
||||
|
||||
private:
|
||||
LLPrefsVoice* mParent;
|
||||
@@ -63,8 +63,11 @@ LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLPrefsVoice* parent)
|
||||
: LLModalDialog(LLStringUtil::null, 240, 100), mParent(parent)
|
||||
{
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml");
|
||||
childSetAction("Cancel", onCancel, this);
|
||||
childSetFocus("Cancel");
|
||||
if (LLUICtrl* ctrl = findChild<LLUICtrl>("Cancel"))
|
||||
{
|
||||
ctrl->setCommitCallback(boost::bind(&LLModalDialog::close, this, false));
|
||||
ctrl->setFocus(true);
|
||||
}
|
||||
|
||||
gFocusMgr.setKeystrokesOnly(TRUE);
|
||||
}
|
||||
@@ -77,7 +80,7 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
|
||||
{
|
||||
BOOL result = TRUE;
|
||||
|
||||
if(key == 'Q' && mask == MASK_CONTROL)
|
||||
if (key == 'Q' && mask == MASK_CONTROL)
|
||||
{
|
||||
result = FALSE;
|
||||
}
|
||||
@@ -90,13 +93,6 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
|
||||
return result;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLVoiceSetKeyDialog::onCancel(void* user_data)
|
||||
{
|
||||
LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data;
|
||||
self->close();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void* createDevicePanel(void*)
|
||||
@@ -121,20 +117,13 @@ LLPrefsVoice::~LLPrefsVoice()
|
||||
|
||||
BOOL LLPrefsVoice::postBuild()
|
||||
{
|
||||
childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this);
|
||||
childSetAction("set_voice_hotkey_button", onClickSetKey, this);
|
||||
childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this);
|
||||
getChild<LLUICtrl>("enable_voice_check")->setCommitCallback(boost::bind(&LLPrefsVoice::onCommitEnableVoiceChat, this, _2));
|
||||
getChild<LLUICtrl>("set_voice_hotkey_button")->setCommitCallback(boost::bind(LLVoiceSetKeyDialog::start, this));
|
||||
getChild<LLUICtrl>("set_voice_middlemouse_button")->setCommitCallback(boost::bind(&LLView::setValue, getChildView("modifier_combo"), "MiddleMouse"));
|
||||
|
||||
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
|
||||
childSetVisible("voice_unavailable", voice_disabled);
|
||||
childSetVisible("enable_voice_check", !voice_disabled);
|
||||
childSetEnabled("enable_voice_check", !voice_disabled);
|
||||
getChild<LLUICtrl>("set_voice_middlemouse_button")->setEnabled(!gSavedSettings.getBOOL("CmdLineDisableVoice") && gSavedSettings.getBOOL("EnableVoiceChat"));
|
||||
|
||||
bool enable = !voice_disabled && gSavedSettings.getBOOL("EnableVoiceChat");
|
||||
childSetValue("enable_voice_check", enable);
|
||||
onCommitEnableVoiceChat(getChild<LLCheckBoxCtrl>("enable_voice_check"), this);
|
||||
|
||||
if (LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("enable_multivoice_check"))
|
||||
if (LLCheckBoxCtrl* check = findChild<LLCheckBoxCtrl>("enable_multivoice_check"))
|
||||
{
|
||||
check->setValue(gSavedSettings.getBOOL("VoiceMultiInstance"));
|
||||
check->setLabel(getString("multivoice_label", LLTrans::getDefaultArgs()));
|
||||
@@ -160,7 +149,7 @@ void LLPrefsVoice::apply()
|
||||
gSavedSettings.setBOOL("LipSyncEnabled", childGetValue("enable_lip_sync_check"));
|
||||
gSavedSettings.setBOOL("VoiceMultiInstance", childGetValue("enable_multivoice_check"));
|
||||
|
||||
if (LLPanelVoiceDeviceSettings* voice_device_settings = getChild<LLPanelVoiceDeviceSettings>("device_settings_panel"))
|
||||
if (LLPanelVoiceDeviceSettings* voice_device_settings = findChild<LLPanelVoiceDeviceSettings>("device_settings_panel"))
|
||||
{
|
||||
voice_device_settings->apply();
|
||||
}
|
||||
@@ -180,7 +169,7 @@ void LLPrefsVoice::apply()
|
||||
|
||||
void LLPrefsVoice::cancel()
|
||||
{
|
||||
if (LLPanelVoiceDeviceSettings* voice_device_settings = getChild<LLPanelVoiceDeviceSettings>("device_settings_panel"))
|
||||
if (LLPanelVoiceDeviceSettings* voice_device_settings = findChild<LLPanelVoiceDeviceSettings>("device_settings_panel"))
|
||||
{
|
||||
voice_device_settings->cancel();
|
||||
}
|
||||
@@ -188,42 +177,23 @@ void LLPrefsVoice::cancel()
|
||||
|
||||
void LLPrefsVoice::setKey(KEY key)
|
||||
{
|
||||
childSetValue("modifier_combo", LLKeyboard::stringFromKey(key));
|
||||
getChildView("modifier_combo")->setValue(LLKeyboard::stringFromKey(key));
|
||||
}
|
||||
|
||||
//static
|
||||
void LLPrefsVoice::onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data)
|
||||
void LLPrefsVoice::onCommitEnableVoiceChat(const LLSD& value)
|
||||
{
|
||||
LLPrefsVoice* self = (LLPrefsVoice*)user_data;
|
||||
LLCheckBoxCtrl* enable_voice_chat = (LLCheckBoxCtrl*)ctrl;
|
||||
bool enable = value.asBoolean();
|
||||
|
||||
bool enable = enable_voice_chat->getValue();
|
||||
|
||||
self->childSetEnabled("modifier_combo", enable);
|
||||
self->childSetEnabled("push_to_talk_label", enable);
|
||||
self->childSetEnabled("voice_call_friends_only_check", enable);
|
||||
self->childSetEnabled("auto_disengage_mic_check", enable);
|
||||
self->childSetEnabled("push_to_talk_toggle_check", enable);
|
||||
self->childSetEnabled("ear_location", enable);
|
||||
self->childSetEnabled("enable_lip_sync_check", enable);
|
||||
self->childSetEnabled("set_voice_hotkey_button", enable);
|
||||
self->childSetEnabled("set_voice_middlemouse_button", enable);
|
||||
self->childSetEnabled("device_settings_btn", enable);
|
||||
self->childSetEnabled("device_settings_panel", enable);
|
||||
}
|
||||
|
||||
//static
|
||||
void LLPrefsVoice::onClickSetKey(void* user_data)
|
||||
{
|
||||
LLPrefsVoice* self = (LLPrefsVoice*)user_data;
|
||||
LLVoiceSetKeyDialog* dialog = new LLVoiceSetKeyDialog(self);
|
||||
dialog->startModal();
|
||||
}
|
||||
|
||||
//static
|
||||
void LLPrefsVoice::onClickSetMiddleMouse(void* user_data)
|
||||
{
|
||||
LLPrefsVoice* self = (LLPrefsVoice*)user_data;
|
||||
self->childSetValue("modifier_combo", "MiddleMouse");
|
||||
getChildView("modifier_combo")->setEnabled(enable);
|
||||
getChildView("push_to_talk_label")->setEnabled(enable);
|
||||
getChildView("voice_call_friends_only_check")->setEnabled(enable);
|
||||
getChildView("auto_disengage_mic_check")->setEnabled(enable);
|
||||
getChildView("push_to_talk_toggle_check")->setEnabled(enable);
|
||||
getChildView("ear_location")->setEnabled(enable);
|
||||
getChildView("enable_lip_sync_check")->setEnabled(enable);
|
||||
getChildView("set_voice_hotkey_button")->setEnabled(enable);
|
||||
getChildView("set_voice_middlemouse_button")->setEnabled(enable);
|
||||
getChildView("device_settings_btn")->setEnabled(enable);
|
||||
getChildView("device_settings_panel")->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,7 @@ public:
|
||||
void setKey(KEY key);
|
||||
|
||||
private:
|
||||
static void onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data);
|
||||
static void onClickSetKey(void* user_data);
|
||||
static void onClickSetMiddleMouse(void* user_data);
|
||||
void onCommitEnableVoiceChat(const LLSD& value);
|
||||
};
|
||||
|
||||
#endif // LLPREFSVOICE_H
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<panel border="true" bottom="-409" height="408" label="Voice Chat" left="102" name="chat" width="517">
|
||||
<text bottom_delta="-20" follows="left|top" left_delta="12" name="voice_unavailable">Voice Chat Is Not Available</text>
|
||||
<check_box bottom_delta="0" follows="top" height="16" initial_value="false" label="Enable voice chat" left="8" name="enable_voice_check"/>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" name="enable_multivoice_check"/>
|
||||
<text visibility_control="CmdLineDisableVoice" bottom_delta="-14" follows="left|top" left_delta="12" name="voice_unavailable">Voice Chat Is Not Available</text>
|
||||
<check_box control_name="local_enable" invisibility_control="CmdLineDisableVoice" bottom_delta="-6" follows="top" height="16" initial_value="false" label="Enable voice chat" left="8" name="enable_voice_check"/>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" name="enable_multivoice_check"/>
|
||||
<string value="Allow multiple instances of [APP_NAME] to use voice simultaneously (requires restart)" name="multivoice_label"/>
|
||||
<radio_group bottom_delta="-66" draw_border="false" follows="top" height="60" left_delta="20" name="ear_location" width="364">
|
||||
<radio_group enabled_control="local_enable" bottom_delta="-66" draw_border="false" follows="top" height="60" left_delta="20" name="ear_location" width="364">
|
||||
<radio_item bottom="-19" height="16" left="3" name="0">Hear Voice Chat from camera position.</radio_item>
|
||||
<radio_item bottom="-35" height="16" name="1">Hear Voice Chat from avatar position.</radio_item>
|
||||
<radio_item bottom="-51" height="16" name="3">Hear Voice Chat equally from everyone.</radio_item>
|
||||
</radio_group>
|
||||
<text bottom_delta="-20" follows="top" height="16" name="push_to_talk_heading">Push To Talk</text>
|
||||
<check_box bottom_delta="-20" follows="top" height="16" initial_value="false" label="Use Push-to-Talk in toggle mode" name="push_to_talk_toggle_check" tool_tip="When enabled, press the push-to-talk trigger to switch your microphone on and off. When disabled, the microphone is off unless the trigger is being held down."/>
|
||||
<text bottom_delta="-20" follows="top" height="16" left_delta="4" name="push_to_talk_label">Push-to-Talk trigger:</text>
|
||||
<line_editor bottom_delta="-20" follows="top" height="19" name="modifier_combo" width="280"/>
|
||||
<button bottom_delta="-25" follows="top" height="20" label="Set Key" name="set_voice_hotkey_button" width="115"/>
|
||||
<button bottom_delta="0" follows="top" height="20" label="Middle Mouse Button" left_delta="120" name="set_voice_middlemouse_button" width="160"/>
|
||||
<check_box bottom_delta="-24" follows="top" height="16" initial_value="false" label="Enable lip sync animation" left="28" name="enable_lip_sync_check"/>
|
||||
<check_box bottom_delta="-20" follows="top" height="16" initial_value="false" label="Only accept voice calls from people on My Friends list" name="voice_call_friends_only_check"/>
|
||||
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Switch off microphone when ending IM calls" name="auto_disengage_mic_check"/>
|
||||
<button control_name="ShowDeviceSettings" toggle="true" bottom_delta="-40" follows="top" height="20" label="Device Settings" mouse_opaque="true" name="device_settings_btn" width="155" tool_tip="Running the Device Settings will temporarily disconnect you from Voice Chat, and changes you make will be immediately applied."/>
|
||||
<panel visibility_control="ShowDeviceSettings" name="device_settings_panel" filename="panel_sound_devices.xml" follows="all"/>
|
||||
<text enabled_control="local_enable" bottom_delta="-20" follows="top" height="16" name="push_to_talk_heading">Push To Talk</text>
|
||||
<check_box enabled_control="local_enable" bottom_delta="-20" follows="top" height="16" initial_value="false" label="Use Push-to-Talk in toggle mode" name="push_to_talk_toggle_check" tool_tip="When enabled, press the push-to-talk trigger to switch your microphone on and off. When disabled, the microphone is off unless the trigger is being held down."/>
|
||||
<text enabled_control="local_enable" bottom_delta="-20" follows="top" height="16" left_delta="4" name="push_to_talk_label">Push-to-Talk trigger:</text>
|
||||
<line_editor enabled_control="local_enable" bottom_delta="-20" follows="top" height="19" name="modifier_combo" width="280"/>
|
||||
<button enabled_control="local_enable" bottom_delta="-25" follows="top" height="20" label="Set Key" name="set_voice_hotkey_button" width="115"/>
|
||||
<button enabled_control="local_enable" bottom_delta="0" follows="top" height="20" label="Middle Mouse Button" left_delta="120" name="set_voice_middlemouse_button" width="160"/>
|
||||
<check_box enabled_control="local_enable" bottom_delta="-24" follows="top" height="16" initial_value="false" label="Enable lip sync animation" left="28" name="enable_lip_sync_check"/>
|
||||
<check_box enabled_control="local_enable" bottom_delta="-20" follows="top" height="16" initial_value="false" label="Only accept voice calls from people on My Friends list" name="voice_call_friends_only_check"/>
|
||||
<check_box enabled_control="local_enable" bottom_delta="-18" follows="top" height="16" initial_value="false" label="Switch off microphone when ending IM calls" name="auto_disengage_mic_check"/>
|
||||
<button enabled_control="local_enable" control_name="ShowDeviceSettings" toggle="true" bottom_delta="-40" follows="top" height="20" label="Device Settings" mouse_opaque="true" name="device_settings_btn" width="155" tool_tip="Running the Device Settings will temporarily disconnect you from Voice Chat, and changes you make will be immediately applied."/>
|
||||
<panel enabled_control="local_enable" visibility_control="ShowDeviceSettings" name="device_settings_panel" filename="panel_sound_devices.xml" follows="all"/>
|
||||
</panel>
|
||||
|
||||
Reference in New Issue
Block a user