summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2015-01-20 18:24:02 -0500
committerJonathan Yap <jhwelch@gmail.com>2015-01-20 18:24:02 -0500
commit58577702a8c185683e089afc3f7fbcbaaf40122c (patch)
treed4454394c73aa12eabb6635145eb8156951bd84e /indra/newview
parent56f43a390015f3ba721554ef9a0e436b6bfad5f9 (diff)
STORM-2082 Finally(?) deal properly with dirty UI processing.
Code cleanup, some per bitbucket comments.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterloadprefpreset.cpp5
-rwxr-xr-xindra/newview/llfloaterpreference.cpp43
-rwxr-xr-xindra/newview/llfloaterpreference.h6
-rw-r--r--indra/newview/llpanelpresetspulldown.cpp6
-rw-r--r--indra/newview/llpresetsmanager.cpp14
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_preferences_graphics1.xml12
6 files changed, 45 insertions, 41 deletions
diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp
index 6ec2e5c09d..d831da43f5 100644
--- a/indra/newview/llfloaterloadprefpreset.cpp
+++ b/indra/newview/llfloaterloadprefpreset.cpp
@@ -82,11 +82,6 @@ void LLFloaterLoadPrefPreset::onBtnOk()
std::string name = combo->getSimple();
LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name);
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->refreshEnabledGraphics();
- }
closeFloater();
}
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 34c34ffd65..5938566b0a 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -735,9 +735,9 @@ void LLFloaterPreference::onOpen(const LLSD& key)
bool started = (LLStartUp::getStartupState() == STATE_STARTED);
- LLButton* load_btn = findChild<LLButton>("PrefLoadButton");
- LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
- LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
+ LLButton* load_btn = findChild<LLButton>("PrefLoadButton");
+ LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
+ LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
load_btn->setEnabled(started);
save_btn->setEnabled(started);
@@ -925,14 +925,12 @@ void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_
}
}
-
void LLFloaterPreference::refreshEnabledGraphics()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->refresh();
- //instance->refreshEnabledState();
}
}
@@ -1179,12 +1177,14 @@ void LLFloaterPreference::refreshEnabledState()
// WindLight
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
+ LLCheckBoxCtrl* ctrl_wind_light2 = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders2");
LLSliderCtrl* sky = getChild<LLSliderCtrl>("SkyMeshDetail");
LLTextBox* sky_text = getChild<LLTextBox>("SkyMeshDetailText");
// *HACK just checks to see if we can use shaders...
// maybe some cards that use shaders, but don't support windlight
ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders);
+ ctrl_wind_light2->setEnabled(ctrl_shader_enable->getEnabled() && shaders);
sky->setEnabled(ctrl_wind_light->get() && shaders);
sky_text->setEnabled(ctrl_wind_light->get() && shaders);
@@ -2002,9 +2002,9 @@ LLPanelPreference::LLPanelPreference()
{
mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1));
- mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::DeletePreset, this, _2));
- mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::SavePreset, this, _2));
- mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::LoadPreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2));
}
//virtual
@@ -2202,19 +2202,19 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl)
}
}
-void LLPanelPreference::DeletePreset(const LLSD& user_data)
+void LLPanelPreference::deletePreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("delete_pref_preset", subdirectory);
}
-void LLPanelPreference::SavePreset(const LLSD& user_data)
+void LLPanelPreference::savePreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("save_pref_preset", subdirectory);
}
-void LLPanelPreference::LoadPreset(const LLSD& user_data)
+void LLPanelPreference::loadPreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("load_pref_preset", subdirectory);
@@ -2303,16 +2303,17 @@ void LLPanelPreferenceGraphics::setPresetText()
{
LLTextBox* preset_text = getChild<LLTextBox>("preset_text");
- if (hasDirtyChilds())
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+
+ if (hasDirtyChilds() && !preset_graphic_active.empty())
{
gSavedSettings.setString("PresetGraphicActive", "");
+ preset_graphic_active.clear();
// This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown
// panel to update.
LLPresetsManager::getInstance()->triggerChangeSignal();
}
- std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
-
if (!preset_graphic_active.empty())
{
preset_text->setText(preset_graphic_active);
@@ -2321,6 +2322,8 @@ void LLPanelPreferenceGraphics::setPresetText()
{
preset_text->setText(LLTrans::getString("none_paren_cap"));
}
+
+ preset_text->resetDirty();
}
bool LLPanelPreferenceGraphics::hasDirtyChilds()
@@ -2338,7 +2341,15 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds()
{
if (ctrl->isDirty())
{
- return true;
+ LLControlVariable* control = ctrl->getControlVariable();
+ if (control)
+ {
+ std::string control_name = control->getName();
+ if (!control_name.empty())
+ {
+ return true;
+ }
+ }
}
}
// Push children onto the end of the work stack
@@ -2348,6 +2359,7 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds()
view_stack.push_back(*iter);
}
}
+
return false;
}
@@ -2377,7 +2389,6 @@ void LLPanelPreferenceGraphics::resetDirtyChilds()
void LLPanelPreferenceGraphics::cancel()
{
- resetDirtyChilds();
LLPanelPreference::cancel();
}
void LLPanelPreferenceGraphics::saveSettings()
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index bb6e848178..2810a1008b 100755
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -222,9 +222,9 @@ public:
// cancel() can restore them.
virtual void saveSettings();
- void DeletePreset(const LLSD& user_data);
- void SavePreset(const LLSD& user_data);
- void LoadPreset(const LLSD& user_data);
+ void deletePreset(const LLSD& user_data);
+ void savePreset(const LLSD& user_data);
+ void loadPreset(const LLSD& user_data);
class Updater;
diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp
index 2c5ae01b12..ceff5a54e8 100644
--- a/indra/newview/llpanelpresetspulldown.cpp
+++ b/indra/newview/llpanelpresetspulldown.cpp
@@ -145,11 +145,7 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data)
std::string name = item->getColumn(1)->getValue().asString();
LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name);
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->refreshEnabledGraphics();
- }
+
setVisible(FALSE);
}
}
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index a08f77eeb1..e67ebcc0c6 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -58,9 +58,8 @@ void LLPresetsManager::createMissingDefault()
if (!gDirUtilp->fileExists(default_file))
{
LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL;
+
// Write current graphic settings to default.xml
- // *TODO: If this name is to be localized additional code will be needed to delete the old default
- // when changing languages.
savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT);
if (gSavedSettings.getString("PresetGraphicActive").empty())
@@ -106,13 +105,10 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
{
std::string path = gDirUtilp->add(dir, file);
std::string name = gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true);
- // Two things are happening here:
- // 1 - Always put the active preset at the top of the list
- // 2 - Possibly hide the default preset
+
if (PRESETS_DEFAULT != name)
{
mPresetNames.push_back(name);
-
}
else
{
@@ -245,6 +241,12 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st
{
gSavedSettings.setString("PresetGraphicActive", name);
}
+
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->refreshEnabledGraphics();
+ }
triggerChangeSignal();
}
}
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index 6bc549ce94..ae44d03cb3 100755
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -51,7 +51,7 @@
<button
follows="top|left"
height="23"
- label="Delete..."
+ label="Delete preset..."
layout="topleft"
left_pad="5"
name="PrefDeleteButton"
@@ -263,7 +263,7 @@
height="23"
label="Reset all to recommended settings"
layout="topleft"
- left="10"
+ left="5"
name="Defaults"
top_delta="5"
width="250">
@@ -321,7 +321,7 @@
label="Advanced Lighting Model"
layout="topleft"
left="50"
- name="UseLightShaders2"
+ name="UseLightShaders"
top_delta="20"
width="256">
<check_box.commit_callback
@@ -369,7 +369,7 @@
height="23"
label="Reset all to recommended settings"
layout="topleft"
- left="5"
+ left="0"
name="Defaults"
top="0"
width="250">
@@ -782,7 +782,7 @@
label="Atmospheric shaders"
layout="topleft"
left="50"
- name="WindLightUseAtmosShaders"
+ name="WindLightUseAtmosShaders2"
top_delta="16"
width="280">
<check_box.commit_callback
@@ -831,7 +831,7 @@
label="Advanced Lighting Model"
layout="topleft"
left="70"
- name="UseLightShaders"
+ name="UseLightShaders2"
top_delta="16"
width="260">
<check_box.commit_callback