diff --git a/indra/newview/llprefsvoice.cpp b/indra/newview/llprefsvoice.cpp index 275778de4..eddfd2408 100644 --- a/indra/newview/llprefsvoice.cpp +++ b/indra/newview/llprefsvoice.cpp @@ -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("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("enable_voice_check")->setCommitCallback(boost::bind(&LLPrefsVoice::onCommitEnableVoiceChat, this, _2)); + getChild("set_voice_hotkey_button")->setCommitCallback(boost::bind(LLVoiceSetKeyDialog::start, this)); + getChild("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("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("enable_voice_check"), this); - - if (LLCheckBoxCtrl* check = getChild("enable_multivoice_check")) + if (LLCheckBoxCtrl* check = findChild("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("device_settings_panel")) + if (LLPanelVoiceDeviceSettings* voice_device_settings = findChild("device_settings_panel")) { voice_device_settings->apply(); } @@ -180,7 +169,7 @@ void LLPrefsVoice::apply() void LLPrefsVoice::cancel() { - if (LLPanelVoiceDeviceSettings* voice_device_settings = getChild("device_settings_panel")) + if (LLPanelVoiceDeviceSettings* voice_device_settings = findChild("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); } diff --git a/indra/newview/llprefsvoice.h b/indra/newview/llprefsvoice.h index a1cd8c933..70ce6a032 100644 --- a/indra/newview/llprefsvoice.h +++ b/indra/newview/llprefsvoice.h @@ -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 diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml index fe49f379d..988eb38da 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml @@ -1,23 +1,23 @@ - Voice Chat Is Not Available - - + Voice Chat Is Not Available + + - + Hear Voice Chat from camera position. Hear Voice Chat from avatar position. Hear Voice Chat equally from everyone. - Push To Talk - - Push-to-Talk trigger: - -