From ebfbf2a561a98e5af4dde319edb49a663e27de26 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 23:06:41 +0300 Subject: STORM-1285 WIP Connected "Delete Water / Sky / Day Cycle" floaters (not functional) to the main menu. --- indra/newview/llfloaterdeleteenvpreset.cpp | 139 +++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 indra/newview/llfloaterdeleteenvpreset.cpp (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp new file mode 100644 index 0000000000..e014eedeb1 --- /dev/null +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -0,0 +1,139 @@ +/** + * @file llfloaterdeleteenvpreset.cpp + * @brief Floater to delete a water / sky / day cycle preset. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterdeleteenvpreset.h" + +// libs +#include "llbutton.h" +#include "llcombobox.h" + +// newview +#include "lldaycyclemanager.h" +#include "llwaterparammanager.h" + +LLFloaterDeleteEnvPreset::LLFloaterDeleteEnvPreset(const LLSD &key) +: LLFloater(key) +, mPresetCombo(NULL) +{ +} + +// virtual +BOOL LLFloaterDeleteEnvPreset::postBuild() +{ + mPresetCombo = getChild("preset_combo"); + + getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this)); + + // Deletion is not implemented yet, so disable the button for now. + getChild("delete")->setEnabled(FALSE); + + return TRUE; +} + +// virtual +void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key) +{ + std::string param = key.asString(); + std::string floater_title = getString(std::string("title_") + param); + std::string combo_label = getString(std::string("label_" + param)); + + // Update floater title. + setTitle(floater_title); + + // Update the combobox label. + getChild("label")->setValue(combo_label); + + // Populate the combobox. + mPresetCombo->removeall(); + if (param == "water") + { + populateWaterPresetsList(); + } + else if (param == "sky") + { + populateSkyPresetsList(); + } + else if (param == "day_cycle") + { + populateDayCyclesList(); + } + else + { + llwarns << "Unrecognized key" << llendl; + } +} + +void LLFloaterDeleteEnvPreset::onBtnDelete() +{ + closeFloater(); +} + +void LLFloaterDeleteEnvPreset::onBtnCancel() +{ + closeFloater(); +} + +void LLFloaterDeleteEnvPreset::populateWaterPresetsList() +{ + // *TODO: Reload the list when user preferences change. + LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); + LL_DEBUGS("Windlight") << "Current water preset: " << water_mgr.mCurParams.mName << LL_ENDL; + + const std::map &water_params_map = water_mgr.mParamList; + for (std::map::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) + { + std::string name = it->first; + bool enabled = (name != water_mgr.mCurParams.mName); // don't allow deleting current preset + mPresetCombo->add(name, ADD_BOTTOM, enabled); + } +} + +void LLFloaterDeleteEnvPreset::populateSkyPresetsList() +{ + LLWLParamManager& sky_mgr = LLWLParamManager::instance(); + LL_DEBUGS("Windlight") << "Current sky preset: " << sky_mgr.mCurParams.mName << LL_ENDL; + + const std::map &sky_params_map = sky_mgr.mParamList; + for (std::map::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); + } +} + +void LLFloaterDeleteEnvPreset::populateDayCyclesList() +{ + // *TODO: Disable current day cycle. + const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); + for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + { + mPresetCombo->add(it->first); + } +} -- cgit v1.2.3 From 657e434fd59139436e8b97e5ecd01ca686e82269 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 30 May 2011 22:34:56 +0300 Subject: STORM-1253 WIP New day cycle editor. Done: * Creating new local day cycles. * Editing existing local day cycles. * Deleting day cycles. To do: * Editing region day cycle, dealing with skies in region scope. * Handle teleport while editing a day cycle. * Update UI when a day cycle or sky preset gets deleted. * Make the time ctrl increase/decrease consistently. --- indra/newview/llfloaterdeleteenvpreset.cpp | 68 +++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index e014eedeb1..d2f0f6e520 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -31,11 +31,23 @@ // libs #include "llbutton.h" #include "llcombobox.h" +#include "llnotificationsutil.h" // newview #include "lldaycyclemanager.h" #include "llwaterparammanager.h" +static bool confirmation_callback(const LLSD& notification, const LLSD& response, boost::function cb) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + cb(); + } + return false; + +} + LLFloaterDeleteEnvPreset::LLFloaterDeleteEnvPreset(const LLSD &key) : LLFloater(key) , mPresetCombo(NULL) @@ -50,9 +62,6 @@ BOOL LLFloaterDeleteEnvPreset::postBuild() getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this)); getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this)); - // Deletion is not implemented yet, so disable the button for now. - getChild("delete")->setEnabled(FALSE); - return TRUE; } @@ -70,14 +79,15 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key) getChild("label")->setValue(combo_label); // Populate the combobox. - mPresetCombo->removeall(); if (param == "water") { populateWaterPresetsList(); + getChild("delete")->setEnabled(FALSE); // not implemented yet } else if (param == "sky") { populateSkyPresetsList(); + getChild("delete")->setEnabled(FALSE); // not implemented yet } else if (param == "day_cycle") { @@ -91,7 +101,42 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key) void LLFloaterDeleteEnvPreset::onBtnDelete() { - closeFloater(); + std::string param = mKey.asString(); + boost::function confirm_cb; + + if (param == "water") + { + llwarns << "Deleting water presets not implemented" << llendl; + return; + } + else if (param == "sky") + { + llwarns << "Deleting sky presets not implemented" << llendl; + return; + } + 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)) + { + LLNotificationsUtil::add("WLNoEditDefault"); + return; + } + + confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation, this); + } + else + { + llwarns << "Unrecognized key" << llendl; + } + + LLSD args; + args["MESSAGE"] = getString("msg_confirm_deletion"); + LLNotificationsUtil::add("GenericAlertYesCancel", args, LLSD(), + boost::bind(&confirmation_callback, _1, _2, confirm_cb)); } void LLFloaterDeleteEnvPreset::onBtnCancel() @@ -101,6 +146,8 @@ void LLFloaterDeleteEnvPreset::onBtnCancel() void LLFloaterDeleteEnvPreset::populateWaterPresetsList() { + mPresetCombo->removeall(); + // *TODO: Reload the list when user preferences change. LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); LL_DEBUGS("Windlight") << "Current water preset: " << water_mgr.mCurParams.mName << LL_ENDL; @@ -116,6 +163,9 @@ void LLFloaterDeleteEnvPreset::populateWaterPresetsList() void LLFloaterDeleteEnvPreset::populateSkyPresetsList() { + mPresetCombo->removeall(); + + // *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; @@ -130,6 +180,8 @@ void LLFloaterDeleteEnvPreset::populateSkyPresetsList() void LLFloaterDeleteEnvPreset::populateDayCyclesList() { + mPresetCombo->removeall(); + // *TODO: Disable current day cycle. const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) @@ -137,3 +189,9 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() mPresetCombo->add(it->first); } } + +void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation() +{ + LLDayCycleManager::instance().deletePreset(mPresetCombo->getValue().asString()); + populateDayCyclesList(); +} -- cgit v1.2.3 From 995a006b58f2be1d7236b32be3570b6d7250013b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 1 Jun 2011 18:26:36 +0300 Subject: STORM-1253 WIP Update UI when a day cycle gets added or deleted. --- indra/newview/llfloaterdeleteenvpreset.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index d2f0f6e520..d791c29a96 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -62,6 +62,8 @@ BOOL LLFloaterDeleteEnvPreset::postBuild() getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this)); getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this)); + LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::onDayCycleListChange, this)); + return TRUE; } @@ -193,5 +195,9 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation() { LLDayCycleManager::instance().deletePreset(mPresetCombo->getValue().asString()); +} + +void LLFloaterDeleteEnvPreset::onDayCycleListChange() +{ populateDayCyclesList(); } -- cgit v1.2.3 From 4e05ea6ebda88f3e2af4b585f629b11f3729096e Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 00:17:21 +0300 Subject: STORM-1255 WIP Implemented creating, editing and removing local sky presets. --- indra/newview/llfloaterdeleteenvpreset.cpp | 37 ++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') 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("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 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 &sky_params_map = sky_mgr.mParamList; for (std::map::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(); -- cgit v1.2.3 From 7151a4e6b02f02155387fc595034a42aebd7ec9c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 17:41:26 +0300 Subject: STORM-1255 WIP Consistency pass on sky presets removal. * Update all related floaters when a sky preset gets removed. * Don't allow removing skies referenced by (local) day cycles. * Other minor fixes. --- indra/newview/llfloaterdeleteenvpreset.cpp | 51 +++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index 74c837af53..b78e124e07 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -62,7 +62,9 @@ BOOL LLFloaterDeleteEnvPreset::postBuild() getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this)); getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this)); - LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::onDayCycleListChange, this)); + // Listen to presets addition/removal. + LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateDayCyclesList, this)); + LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateSkyPresetsList, this)); return TRUE; } @@ -113,6 +115,13 @@ void LLFloaterDeleteEnvPreset::onBtnDelete() } else if (param == "sky") { + // Don't allow deleting presets referenced by local day cycles. + if (LLDayCycleManager::instance().isSkyPresetReferenced(preset_name)) + { + LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", getString("msg_sky_is_referenced"))); + return; + } + LLWLParamManager& wl_mgr = LLWLParamManager::instance(); // Don't allow deleting system presets. @@ -155,6 +164,8 @@ void LLFloaterDeleteEnvPreset::onBtnCancel() void LLFloaterDeleteEnvPreset::populateWaterPresetsList() { + if (mKey.asString() != "water") return; + mPresetCombo->removeall(); // *TODO: Reload the list when user preferences change. @@ -168,10 +179,14 @@ void LLFloaterDeleteEnvPreset::populateWaterPresetsList() bool enabled = (name != water_mgr.mCurParams.mName); // don't allow deleting current preset mPresetCombo->add(name, ADD_BOTTOM, enabled); } + + postPopulate(); } void LLFloaterDeleteEnvPreset::populateSkyPresetsList() { + if (mKey.asString() != "sky") return; + mPresetCombo->removeall(); std::string cur_preset; @@ -187,14 +202,24 @@ void LLFloaterDeleteEnvPreset::populateSkyPresetsList() for (std::map::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++) { 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); + + // list only local user presets + if (key.scope == LLEnvKey::SCOPE_REGION || sky_mgr.isSystemPreset(key.name)) + { + continue; + } + + bool enabled = (key.name != cur_preset); mPresetCombo->add(key.name, ADD_BOTTOM, enabled); } + + postPopulate(); } void LLFloaterDeleteEnvPreset::populateDayCyclesList() { + if (mKey.asString() != "day_cycle") return; + mPresetCombo->removeall(); // *TODO: Disable current day cycle. @@ -203,6 +228,21 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() { mPresetCombo->add(it->first); } + + postPopulate(); +} + +void LLFloaterDeleteEnvPreset::postPopulate() +{ + // Handle empty list. + S32 n_items = mPresetCombo->getItemCount(); + + if (n_items == 0) + { + mPresetCombo->setLabel(getString("combo_label")); + } + + getChild("delete")->setEnabled(n_items > 0); } void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation() @@ -215,8 +255,3 @@ void LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation() LLWLParamKey key(mPresetCombo->getValue().asString(), LLEnvKey::SCOPE_LOCAL); LLWLParamManager::instance().removeParamSet(key, true); } - -void LLFloaterDeleteEnvPreset::onDayCycleListChange() -{ - populateDayCyclesList(); -} -- cgit v1.2.3 From 4ebfc47e40692b16a057321a9c8b6f28e1601cdd Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 19:19:02 +0300 Subject: STORM-1253 WIP Disable removing current day cycle. --- indra/newview/llfloaterdeleteenvpreset.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index b78e124e07..4fed5b9d5a 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -222,11 +222,17 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() mPresetCombo->removeall(); - // *TODO: Disable current day cycle. + std::string cur_day; + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + if (!env_mgr.getUseRegionSettings() && env_mgr.getUseDayCycle()) + { + cur_day = env_mgr.getDayCycleName(); + } + const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) { - mPresetCombo->add(it->first); + mPresetCombo->add(it->first, ADD_BOTTOM, it->first != cur_day); } postPopulate(); -- cgit v1.2.3 From ebdb41e5d630cad91dab5372ffc0b4f461a85426 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 9 Jun 2011 18:48:24 +0300 Subject: STORM-1254 WIP Implemented deleting local water presets. --- indra/newview/llfloaterdeleteenvpreset.cpp | 44 +++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index 4fed5b9d5a..3fdbbcae9e 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -58,6 +58,7 @@ LLFloaterDeleteEnvPreset::LLFloaterDeleteEnvPreset(const LLSD &key) BOOL LLFloaterDeleteEnvPreset::postBuild() { mPresetCombo = getChild("preset_combo"); + mPresetCombo->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::postPopulate, this)); getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this)); getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this)); @@ -65,6 +66,7 @@ BOOL LLFloaterDeleteEnvPreset::postBuild() // Listen to presets addition/removal. LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateDayCyclesList, this)); LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateSkyPresetsList, this)); + LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateWaterPresetsList, this)); return TRUE; } @@ -86,7 +88,6 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key) if (param == "water") { populateWaterPresetsList(); - getChild("delete")->setEnabled(FALSE); // not implemented yet } else if (param == "sky") { @@ -110,8 +111,14 @@ void LLFloaterDeleteEnvPreset::onBtnDelete() if (param == "water") { - llwarns << "Deleting water presets not implemented" << llendl; - return; + // Don't allow deleting system presets. + if (LLWaterParamManager::instance().isSystemPreset(preset_name)) + { + LLNotificationsUtil::add("WLNoEditDefault"); + return; + } + + confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteWaterPresetConfirmation, this); } else if (param == "sky") { @@ -168,15 +175,27 @@ void LLFloaterDeleteEnvPreset::populateWaterPresetsList() mPresetCombo->removeall(); + std::string cur_preset; + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + if (!env_mgr.getUseRegionSettings()) + { + cur_preset = env_mgr.getWaterPresetName(); + } + // *TODO: Reload the list when user preferences change. LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); - LL_DEBUGS("Windlight") << "Current water preset: " << water_mgr.mCurParams.mName << LL_ENDL; - const std::map &water_params_map = water_mgr.mParamList; for (std::map::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) { std::string name = it->first; - bool enabled = (name != water_mgr.mCurParams.mName); // don't allow deleting current preset + + // list only user presets + if (water_mgr.isSystemPreset(name)) + { + continue; + } + + bool enabled = (name != cur_preset); // don't allow deleting current preset mPresetCombo->add(name, ADD_BOTTOM, enabled); } @@ -240,15 +259,15 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() void LLFloaterDeleteEnvPreset::postPopulate() { - // Handle empty list. - S32 n_items = mPresetCombo->getItemCount(); + // Handle empty list and empty selection. + bool has_selection = mPresetCombo->getItemCount() > 1 && mPresetCombo->getSelectedValue().isDefined(); - if (n_items == 0) + if (!has_selection) { mPresetCombo->setLabel(getString("combo_label")); } - getChild("delete")->setEnabled(n_items > 0); + getChild("delete")->setEnabled(has_selection); } void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation() @@ -261,3 +280,8 @@ void LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation() LLWLParamKey key(mPresetCombo->getValue().asString(), LLEnvKey::SCOPE_LOCAL); LLWLParamManager::instance().removeParamSet(key, true); } + +void LLFloaterDeleteEnvPreset::onDeleteWaterPresetConfirmation() +{ + LLWaterParamManager::instance().removeParamSet(mPresetCombo->getValue().asString(), true); +} -- cgit v1.2.3 From 17ce17096f66143776ae1b9dafefcc2dbc85760a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 9 Jun 2011 19:00:25 +0300 Subject: STORM-1253 WIP Disabled removing system day cycles. --- indra/newview/llfloaterdeleteenvpreset.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index 3fdbbcae9e..ef50ace357 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -248,10 +248,19 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() cur_day = env_mgr.getDayCycleName(); } - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); + LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); + const LLDayCycleManager::dc_map_t& map = day_mgr.getPresets(); for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) { - mPresetCombo->add(it->first, ADD_BOTTOM, it->first != cur_day); + const std::string& name = it->first; + + // list only user presets + if (day_mgr.isSystemPreset(name)) + { + continue; + } + + mPresetCombo->add(name, ADD_BOTTOM, name != cur_day); } postPopulate(); -- cgit v1.2.3 From 3e81c9bcc9f364dfa1dfcfd0d52139fd9c7f12c0 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 18:42:16 +0300 Subject: STORM-1254 WIP Refresh the presets list in the Delete Preset floater when user preference change. This is needed to disable removal of the [new] current preset. --- indra/newview/llfloaterdeleteenvpreset.cpp | 43 +++++++++++++++++++----------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') 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("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this)); getChild("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("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; -- cgit v1.2.3 From 5b5355f2e90a59ac60f4e3c961677f90faea90f6 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 19:08:42 +0300 Subject: STORM-1254 WIP Removed obsolete TODO markers. --- indra/newview/llfloaterdeleteenvpreset.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index c72a044e79..73e62ca6f8 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -193,7 +193,6 @@ void LLFloaterDeleteEnvPreset::populateWaterPresetsList() cur_preset = env_mgr.getWaterPresetName(); } - // *TODO: Reload the list when user preferences change. LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); const std::map &water_params_map = water_mgr.mParamList; for (std::map::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) @@ -226,7 +225,6 @@ void LLFloaterDeleteEnvPreset::populateSkyPresetsList() cur_preset = env_mgr.getSkyPresetName(); } - // *TODO: Reload the list when user preferences change. LLWLParamManager& sky_mgr = LLWLParamManager::instance(); const std::map &sky_params_map = sky_mgr.mParamList; for (std::map::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++) -- cgit v1.2.3 From 150c18169de8b7155658e676b86014716f62aeed Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 19:55:30 +0300 Subject: STORM-1305 WIP Made LLWaterParamManager::mParamList private and typedef'ed its type. --- indra/newview/llfloaterdeleteenvpreset.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index 73e62ca6f8..56412acc07 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -194,8 +194,8 @@ void LLFloaterDeleteEnvPreset::populateWaterPresetsList() } LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); - const std::map &water_params_map = water_mgr.mParamList; - for (std::map::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) + const LLWaterParamManager::preset_map_t &water_params_map = water_mgr.getPresets(); + for (LLWaterParamManager::preset_map_t::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) { std::string name = it->first; -- cgit v1.2.3 From 23d8fb9750afc158d97fdf51633ed59b1b36f223 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 21:21:04 +0300 Subject: STORM-1305 WIP User water presets now go first in all lists. Besides, removed all cases of direct access to the water presets map in preparation for future lazy loading. --- indra/newview/llfloaterdeleteenvpreset.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index 56412acc07..0b4104affd 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -193,17 +193,11 @@ void LLFloaterDeleteEnvPreset::populateWaterPresetsList() cur_preset = env_mgr.getWaterPresetName(); } - LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); - const LLWaterParamManager::preset_map_t &water_params_map = water_mgr.getPresets(); - for (LLWaterParamManager::preset_map_t::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) + LLWaterParamManager::preset_name_list_t presets; + LLWaterParamManager::instance().getUserPresetNames(presets); // list only user presets + for (LLWaterParamManager::preset_name_list_t::const_iterator it = presets.begin(); it != presets.end(); ++it) { - std::string name = it->first; - - // list only user presets - if (water_mgr.isSystemPreset(name)) - { - continue; - } + std::string name = *it; bool enabled = (name != cur_preset); // don't allow deleting current preset mPresetCombo->add(name, ADD_BOTTOM, enabled); -- cgit v1.2.3 From 4fd946fa3e5217b8f64e0fcd91d268c7eaf1bbf5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 23:44:13 +0300 Subject: STORM-1305 WIP User sky presets now go first in all lists. --- indra/newview/llfloaterdeleteenvpreset.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index 0b4104affd..cd9f46e5a2 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -219,20 +219,12 @@ void LLFloaterDeleteEnvPreset::populateSkyPresetsList() cur_preset = env_mgr.getSkyPresetName(); } - LLWLParamManager& sky_mgr = LLWLParamManager::instance(); - const std::map &sky_params_map = sky_mgr.mParamList; - for (std::map::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++) + LLWLParamManager::preset_name_list_t user_presets; + LLWLParamManager::instance().getUserPresetNames(user_presets); + for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) { - const LLWLParamKey& key = it->first; - - // list only local user presets - if (key.scope == LLEnvKey::SCOPE_REGION || sky_mgr.isSystemPreset(key.name)) - { - continue; - } - - bool enabled = (key.name != cur_preset); - mPresetCombo->add(key.name, ADD_BOTTOM, enabled); + const std::string& name = *it; + mPresetCombo->add(name, ADD_BOTTOM, /*enabled = */ name != cur_preset); } postPopulate(); -- cgit v1.2.3 From ab431d1774d5b282836a3327dd0bfa8b3b91632b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 14 Jun 2011 18:04:29 +0300 Subject: STORM-1305 WIP User day cycles now go first in all lists. --- indra/newview/llfloaterdeleteenvpreset.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterdeleteenvpreset.cpp') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index cd9f46e5a2..4fefd2242a 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -244,17 +244,11 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() } LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); - const LLDayCycleManager::dc_map_t& map = day_mgr.getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + LLDayCycleManager::preset_name_list_t user_days; + day_mgr.getUserPresetNames(user_days); // list only user presets + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) { - const std::string& name = it->first; - - // list only user presets - if (day_mgr.isSystemPreset(name)) - { - continue; - } - + const std::string& name = *it; mPresetCombo->add(name, ADD_BOTTOM, name != cur_day); } -- cgit v1.2.3