summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rwxr-xr-xindra/newview/llfloaterpreference.cpp93
1 files changed, 28 insertions, 65 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index d65928e385..9630d7b29f 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -304,7 +304,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mOriginalIMViaEmail(false),
mLanguageChanged(false),
mAvatarDataInitialized(false),
- mDoubleClickActionDirty(false)
+ mClickActionDirty(false)
{
//Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
@@ -348,8 +348,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
sSkin = gSavedSettings.getString("SkinCurrent");
- mCommitCallbackRegistrar.add("Pref.CommitDoubleClickChekbox", boost::bind(&LLFloaterPreference::onDoubleClickCheckBox, this, _1));
- mCommitCallbackRegistrar.add("Pref.CommitRadioDoubleClick", boost::bind(&LLFloaterPreference::onDoubleClickRadio, this));
+ mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this));
gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
@@ -439,8 +438,6 @@ 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);
@@ -581,10 +578,10 @@ void LLFloaterPreference::apply()
saveAvatarProperties();
- if (mDoubleClickActionDirty)
+ if (mClickActionDirty)
{
- updateDoubleClickSettings();
- mDoubleClickActionDirty = false;
+ updateClickActionSettings();
+ mClickActionDirty = false;
}
}
@@ -613,11 +610,12 @@ void LLFloaterPreference::cancel()
// reverts any changes to current skin
gSavedSettings.setString("SkinCurrent", sSkin);
- if (mDoubleClickActionDirty)
+ if (mClickActionDirty)
{
- updateDoubleClickControls();
- mDoubleClickActionDirty = false;
+ updateClickActionControls();
+ mClickActionDirty = false;
}
+
LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_proxy");
if (advanced_proxy_settings)
{
@@ -681,6 +679,9 @@ void LLFloaterPreference::onOpen(const LLSD& key)
// Display selected maturity icons.
onChangeMaturity();
+
+ // Load (double-)click to walk/teleport settings.
+ updateClickActionControls();
// Enabled/disabled popups, might have been changed by user actions
// while preferences floater was closed.
@@ -1503,72 +1504,34 @@ void LLFloaterPreference::onClickBlockList()
}
}
-void LLFloaterPreference::onDoubleClickCheckBox(LLUICtrl* ctrl)
+void LLFloaterPreference::onClickProxySettings()
{
- 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());
+ LLFloaterReg::showInstance("prefs_proxy");
}
-void LLFloaterPreference::onDoubleClickRadio()
+void LLFloaterPreference::onClickActionChange()
{
- mDoubleClickActionDirty = true;
+ mClickActionDirty = true;
}
-void LLFloaterPreference::updateDoubleClickSettings()
+void LLFloaterPreference::updateClickActionSettings()
{
- LLCheckBoxCtrl* double_click_action_cb = getChild<LLCheckBoxCtrl>("double_click_chkbox");
- if (!double_click_action_cb) return;
- bool enable = double_click_action_cb->getValue().asBoolean();
+ const int single_clk_action = getChild<LLComboBox>("single_click_action_combo")->getValue().asInteger();
+ const int double_clk_action = getChild<LLComboBox>("double_click_action_combo")->getValue().asInteger();
- 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 );
- }
+ gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1);
+ gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1);
+ gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2);
}
-void LLFloaterPreference::onClickProxySettings()
+void LLFloaterPreference::updateClickActionControls()
{
- LLFloaterReg::showInstance("prefs_proxy");
-}
+ const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk");
+ const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot");
+ const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport");
-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"));
+ getChild<LLComboBox>("single_click_action_combo")->setValue((int)click_to_walk);
+ getChild<LLComboBox>("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk);
}
void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)