summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterdeleteenvpreset.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-07 00:17:21 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-07 00:17:21 +0300
commit4e05ea6ebda88f3e2af4b585f629b11f3729096e (patch)
tree89ae134019175416da4f75fab5b8685213150796 /indra/newview/llfloaterdeleteenvpreset.cpp
parent9f4779e09997e70246c3c0c5f831bf55d4ed6a4f (diff)
STORM-1255 WIP Implemented creating, editing and removing local sky presets.
Diffstat (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp')
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp
index d791c29a96..74c837af53 100644
--- a/indra/newview/llfloaterdeleteenvpreset.cpp
+++ b/indra/newview/llfloaterdeleteenvpreset.cpp
@@ -89,7 +89,6 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key)
else if (param == "sky")
{
populateSkyPresetsList();
- getChild<LLButton>("delete")->setEnabled(FALSE); // not implemented yet
}
else if (param == "day_cycle")
{
@@ -104,6 +103,7 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key)
void LLFloaterDeleteEnvPreset::onBtnDelete()
{
std::string param = mKey.asString();
+ std::string preset_name = mPresetCombo->getValue().asString();
boost::function<void()> confirm_cb;
if (param == "water")
@@ -113,13 +113,20 @@ void LLFloaterDeleteEnvPreset::onBtnDelete()
}
else if (param == "sky")
{
- llwarns << "Deleting sky presets not implemented" << llendl;
- return;
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+
+ // Don't allow deleting system presets.
+ if (wl_mgr.isSystemPreset(preset_name))
+ {
+ LLNotificationsUtil::add("WLNoEditDefault");
+ return;
+ }
+
+ confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation, this);
}
else if (param == "day_cycle")
{
LLDayCycleManager& day_mgr = LLDayCycleManager::instance();
- std::string preset_name = mPresetCombo->getValue().asString();
// Don't allow deleting system presets.
if (day_mgr.isSystemPreset(preset_name))
@@ -167,16 +174,22 @@ void LLFloaterDeleteEnvPreset::populateSkyPresetsList()
{
mPresetCombo->removeall();
+ std::string cur_preset;
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ if (!env_mgr.getUseRegionSettings() && env_mgr.getUseFixedSky())
+ {
+ cur_preset = env_mgr.getSkyPresetName();
+ }
+
// *TODO: Reload the list when user preferences change.
LLWLParamManager& sky_mgr = LLWLParamManager::instance();
- LL_DEBUGS("Windlight") << "Current sky preset: " << sky_mgr.mCurParams.mName << LL_ENDL;
-
const std::map<LLWLParamKey, LLWLParamSet> &sky_params_map = sky_mgr.mParamList;
for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++)
{
- if (it->first.scope == LLEnvKey::SCOPE_REGION) continue; // list only local presets
- bool enabled = (it->first.name != sky_mgr.mCurParams.mName);
- mPresetCombo->add(it->first.name, ADD_BOTTOM, enabled);
+ const LLWLParamKey& key = it->first;
+ if (key.scope == LLEnvKey::SCOPE_REGION) continue; // list only local presets
+ bool enabled = key.name != cur_preset && !sky_mgr.isSystemPreset(key.name);
+ mPresetCombo->add(key.name, ADD_BOTTOM, enabled);
}
}
@@ -197,6 +210,12 @@ void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation()
LLDayCycleManager::instance().deletePreset(mPresetCombo->getValue().asString());
}
+void LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation()
+{
+ LLWLParamKey key(mPresetCombo->getValue().asString(), LLEnvKey::SCOPE_LOCAL);
+ LLWLParamManager::instance().removeParamSet(key, true);
+}
+
void LLFloaterDeleteEnvPreset::onDayCycleListChange()
{
populateDayCyclesList();