diff options
author | Dave Parks <davep@lindenlab.com> | 2010-12-02 21:34:01 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-12-02 21:34:01 -0600 |
commit | 98802a1ef99b7e5fb586dc259118fd58dc34631a (patch) | |
tree | 51e183db55f7c3dfbc60bcc4ab09e700d8f7f51a /indra/newview/llfloaterpreference.cpp | |
parent | 0be7fcf2a95a6d885bbef583966757d12fc9d18c (diff) | |
parent | 680328dd78e1d31a2f8836919a0f6140a76af5f4 (diff) |
Merge
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 109 |
1 files changed, 103 insertions, 6 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 741388af41..b969ba29da 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -282,7 +282,9 @@ std::string LLFloaterPreference::sSkin = ""; LLFloaterPreference::LLFloaterPreference(const LLSD& key) : LLFloater(key), mGotPersonalInfo(false), - mOriginalIMViaEmail(false) + mOriginalIMViaEmail(false), + mLanguageChanged(false), + mDoubleClickActionDirty(false) { //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); @@ -320,6 +322,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); + mCommitCallbackRegistrar.add("Pref.CommitDoubleClickChekbox", boost::bind(&LLFloaterPreference::onDoubleClickCheckBox, this, _1)); + mCommitCallbackRegistrar.add("Pref.CommitRadioDoubleClick", boost::bind(&LLFloaterPreference::onDoubleClickRadio, this)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -342,10 +346,14 @@ BOOL LLFloaterPreference::postBuild() if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); + updateDoubleClickControls(); + getChild<LLUICtrl>("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); setCacheLocation(cache_location); + getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); + // if floater is opened before login set default localized busy message if (LLStartUp::getStartupState() < STATE_STARTED) { @@ -475,6 +483,12 @@ void LLFloaterPreference::apply() gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); } } + + if (mDoubleClickActionDirty) + { + updateDoubleClickSettings(); + mDoubleClickActionDirty = false; + } } void LLFloaterPreference::cancel() @@ -501,6 +515,12 @@ void LLFloaterPreference::cancel() // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); + + if (mDoubleClickActionDirty) + { + updateDoubleClickControls(); + mDoubleClickActionDirty = false; + } } void LLFloaterPreference::onOpen(const LLSD& key) @@ -553,6 +573,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) getChildView("maturity_desired_combobox")->setVisible( false); } + // Forget previous language changes. + mLanguageChanged = false; + // Display selected maturity icons. onChangeMaturity(); @@ -710,6 +733,18 @@ void LLFloaterPreference::onClickBrowserClearCache() LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); } +// Called when user changes language via the combobox. +void LLFloaterPreference::onLanguageChange() +{ + // Let the user know that the change will only take effect after restart. + // Do it only once so that we're not too irritating. + if (!mLanguageChanged) + { + LLNotificationsUtil::add("ChangeLanguage"); + mLanguageChanged = true; + } +} + void LLFloaterPreference::onClickSetCache() { std::string cur_name(gSavedSettings.getString("CacheLocation")); @@ -803,7 +838,7 @@ void LLFloaterPreference::buildPopupLists() LLScrollListItem* item = NULL; - bool show_popup = formp->getIgnored(); + bool show_popup = !formp->getIgnored(); if (!show_popup) { if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) @@ -1154,7 +1189,7 @@ void LLFloaterPreference::onClickDisablePopup() for (itor = items.begin(); itor != items.end(); ++itor) { LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - templatep->mForm->setIgnored(false); + templatep->mForm->setIgnored(true); } buildPopupLists(); @@ -1168,7 +1203,7 @@ void LLFloaterPreference::resetAllIgnored() { if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) { - iter->second->mForm->setIgnored(true); + iter->second->mForm->setIgnored(false); } } } @@ -1181,7 +1216,7 @@ void LLFloaterPreference::setAllIgnored() { if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) { - iter->second->mForm->setIgnored(false); + iter->second->mForm->setIgnored(true); } } } @@ -1245,7 +1280,7 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im getChildView("show_timestamps_check_im")->setEnabled(TRUE); getChildView("log_path_string")->setEnabled(FALSE);// LineEditor becomes readonly in this case. getChildView("log_path_button")->setEnabled(TRUE); - + childEnable("logfile_name_datestamp"); std::string display_email(email); getChild<LLUICtrl>("email_address")->setValue(display_email); @@ -1317,6 +1352,68 @@ void LLFloaterPreference::onClickBlockList() } } +void LLFloaterPreference::onDoubleClickCheckBox(LLUICtrl* ctrl) +{ + if (!ctrl) return; + mDoubleClickActionDirty = true; + LLRadioGroup* radio_double_click_action = getChild<LLRadioGroup>("double_click_action"); + if (!radio_double_click_action) return; + // select default value("teleport") in radio-group. + radio_double_click_action->setSelectedIndex(0); + // set radio-group enabled depending on state of checkbox + radio_double_click_action->setEnabled(ctrl->getValue()); +} + +void LLFloaterPreference::onDoubleClickRadio() +{ + mDoubleClickActionDirty = true; +} + +void LLFloaterPreference::updateDoubleClickSettings() +{ + LLCheckBoxCtrl* double_click_action_cb = getChild<LLCheckBoxCtrl>("double_click_chkbox"); + if (!double_click_action_cb) return; + bool enable = double_click_action_cb->getValue().asBoolean(); + + LLRadioGroup* radio_double_click_action = getChild<LLRadioGroup>("double_click_action"); + if (!radio_double_click_action) return; + + // enable double click radio-group depending on state of checkbox + radio_double_click_action->setEnabled(enable); + + if (!enable) + { + // set double click action settings values to false if checkbox was unchecked + gSavedSettings.setBOOL("DoubleClickAutoPilot", false); + gSavedSettings.setBOOL("DoubleClickTeleport", false); + } + else + { + std::string selected = radio_double_click_action->getValue().asString(); + bool teleport_selected = selected == "radio_teleport"; + // set double click action settings values depending on chosen radio-button + gSavedSettings.setBOOL( "DoubleClickTeleport", teleport_selected ); + gSavedSettings.setBOOL( "DoubleClickAutoPilot", !teleport_selected ); + } +} + +void LLFloaterPreference::updateDoubleClickControls() +{ + // check is one of double-click actions settings enabled + bool double_click_action_enabled = gSavedSettings.getBOOL("DoubleClickAutoPilot") || gSavedSettings.getBOOL("DoubleClickTeleport"); + LLCheckBoxCtrl* double_click_action_cb = getChild<LLCheckBoxCtrl>("double_click_chkbox"); + if (double_click_action_cb) + { + // check checkbox if one of double-click actions settings enabled, uncheck otherwise + double_click_action_cb->setValue(double_click_action_enabled); + } + LLRadioGroup* double_click_action_radio = getChild<LLRadioGroup>("double_click_action"); + if (!double_click_action_radio) return; + // set radio-group enabled if one of double-click actions settings enabled + double_click_action_radio->setEnabled(double_click_action_enabled); + // select button in radio-group depending on setting + double_click_action_radio->setSelectedIndex(gSavedSettings.getBOOL("DoubleClickAutoPilot")); +} void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { |