diff options
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 76 |
1 files changed, 51 insertions, 25 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index b395e1128c..c47c7b073c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -111,26 +111,38 @@ const F32 MIN_USER_FAR_CLIP = 64.f; const S32 ASPECT_RATIO_STR_LEN = 100; class LLVoiceSetKeyDialog : public LLModalDialog - { - public: - LLVoiceSetKeyDialog(LLFloaterPreference* parent); - ~LLVoiceSetKeyDialog(); - - BOOL handleKeyHere(KEY key, MASK mask); - static void onCancel(void* user_data); +{ +public: + LLVoiceSetKeyDialog(const LLSD& key); + ~LLVoiceSetKeyDialog(); + + /*virtual*/ BOOL postBuild(); + + void setParent(LLFloaterPreference* parent) { mParent = parent; } + + BOOL handleKeyHere(KEY key, MASK mask); + static void onCancel(void* user_data); - private: - LLFloaterPreference* mParent; - }; +private: + LLFloaterPreference* mParent; +}; -LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLFloaterPreference* parent) -: LLModalDialog(LLSD(), 240, 100), mParent(parent) +LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key) + : LLModalDialog(key), + mParent(NULL) +{ +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml", NULL); +} + +//virtual +BOOL LLVoiceSetKeyDialog::postBuild() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml", NULL); childSetAction("Cancel", onCancel, this); childSetFocus("Cancel"); gFocusMgr.setKeystrokesOnly(TRUE); + + return TRUE; } LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() @@ -145,7 +157,7 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { result = FALSE; } - else + else if (mParent) { mParent->setKey(key); } @@ -294,7 +306,14 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mOriginalIMViaEmail(false) { //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); - + + static bool registered_dialog = false; + if (!registered_dialog) + { + LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLVoiceSetKeyDialog>); + registered_dialog = true; + } + mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this)); mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this)); @@ -497,6 +516,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) { gAgent.sendAgentUserInfoRequest(); LLPanelLogin::setAlwaysRefresh(true); + refresh(); } void LLFloaterPreference::onVertexShaderEnable() @@ -585,6 +605,7 @@ void LLFloaterPreference::onBtnCancel() { cur_focus->onCommit(); } + refresh(); } closeFloater(); // side effect will also cancel any unsaved changes. } @@ -943,13 +964,13 @@ void LLFloaterPreference::refresh() // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes - updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail"), getChild<LLTextBox>("ObjectMeshDetailText")); - updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail"), getChild<LLTextBox>("FlexibleMeshDetailText")); - updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail"), getChild<LLTextBox>("TreeMeshDetailText")); - updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail"), getChild<LLTextBox>("AvatarMeshDetailText")); - updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail"), getChild<LLTextBox>("TerrainMeshDetailText")); - updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess"), getChild<LLTextBox>("PostProcessText")); - updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail"), getChild<LLTextBox>("SkyMeshDetailText")); + updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail", true), getChild<LLTextBox>("ObjectMeshDetailText", true)); + updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail", true), getChild<LLTextBox>("FlexibleMeshDetailText", true)); + updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail", true), getChild<LLTextBox>("TreeMeshDetailText", true)); + updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail", true), getChild<LLTextBox>("AvatarMeshDetailText", true)); + updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true)); + updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true)); + updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true)); refreshEnabledState(); } @@ -980,8 +1001,11 @@ void LLFloaterPreference::cleanupBadSetting() void LLFloaterPreference::onClickSetKey() { - LLVoiceSetKeyDialog* dialog = new LLVoiceSetKeyDialog(this); - dialog->startModal(); + LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE); + if (dialog) + { + dialog->setParent(this); + } } void LLFloaterPreference::setKey(KEY key) @@ -1146,7 +1170,9 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name) { - if(name.asString() =="" || !hasChild("name")) + std::string ctrl_name = name.asString(); + + if((ctrl_name =="" )|| !hasChild(ctrl_name, true)) return; LLTextBox* text_box = getChild<LLTextBox>(name.asString()); |