summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.cpp43
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.h1
2 files changed, 28 insertions, 16 deletions
diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp
index ef50ace357..c72a044e79 100644
--- a/indra/newview/llfloaterdeleteenvpreset.cpp
+++ b/indra/newview/llfloaterdeleteenvpreset.cpp
@@ -63,6 +63,10 @@ BOOL LLFloaterDeleteEnvPreset::postBuild()
getChild<LLButton>("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this));
getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this));
+ // Listen to user preferences change, in which case we need to rebuild the presets list
+ // to disable the [new] current preset.
+ LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populatePresetsList, this));
+
// Listen to presets addition/removal.
LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateDayCyclesList, this));
LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateSkyPresetsList, this));
@@ -85,22 +89,7 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key)
getChild<LLUICtrl>("label")->setValue(combo_label);
// Populate the combobox.
- if (param == "water")
- {
- populateWaterPresetsList();
- }
- else if (param == "sky")
- {
- populateSkyPresetsList();
- }
- else if (param == "day_cycle")
- {
- populateDayCyclesList();
- }
- else
- {
- llwarns << "Unrecognized key" << llendl;
- }
+ populatePresetsList();
}
void LLFloaterDeleteEnvPreset::onBtnDelete()
@@ -169,6 +158,28 @@ void LLFloaterDeleteEnvPreset::onBtnCancel()
closeFloater();
}
+void LLFloaterDeleteEnvPreset::populatePresetsList()
+{
+ std::string param = mKey.asString();
+
+ if (param == "water")
+ {
+ populateWaterPresetsList();
+ }
+ else if (param == "sky")
+ {
+ populateSkyPresetsList();
+ }
+ else if (param == "day_cycle")
+ {
+ populateDayCyclesList();
+ }
+ else
+ {
+ llwarns << "Unrecognized key" << llendl;
+ }
+}
+
void LLFloaterDeleteEnvPreset::populateWaterPresetsList()
{
if (mKey.asString() != "water") return;
diff --git a/indra/newview/llfloaterdeleteenvpreset.h b/indra/newview/llfloaterdeleteenvpreset.h
index 567962dc84..1211505273 100644
--- a/indra/newview/llfloaterdeleteenvpreset.h
+++ b/indra/newview/llfloaterdeleteenvpreset.h
@@ -45,6 +45,7 @@ public:
void onBtnCancel();
private:
+ void populatePresetsList();
void populateWaterPresetsList();
void populateSkyPresetsList();
void populateDayCyclesList();