From 6d1296f71640c9c25affcff4e784ea5798ba2d5c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 08:09:17 -0500 Subject: STORM-2082 Implement save floater and some code cleanup. --- indra/newview/llfloatersaveprefpreset.cpp | 97 +++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 indra/newview/llfloatersaveprefpreset.cpp (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp new file mode 100644 index 0000000000..16d77c0750 --- /dev/null +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -0,0 +1,97 @@ +/** + * @file llfloatersaveprefpreset.cpp + * @brief Floater to save a graphics / camera preset + * + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2014, 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 "llfloatersaveprefpreset.h" + +#include "llbutton.h" +#include "llcombobox.h" +#include "llnotificationsutil.h" +#include "llpresetsmanager.h" + +LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) +: LLFloater(key) +{ +} + +// virtual +BOOL LLFloaterSavePrefPreset::postBuild() +{ + getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); + + mSaveButton = getChild("save"); + mPresetCombo = getChild("preset_combo"); + + return TRUE; +} + +void LLFloaterSavePrefPreset::onPresetNameEdited() +{ + // Disable saving a preset having empty name. + std::string name = mPresetCombo->getSimple(); + + mSaveButton->setEnabled(!name.empty()); +} + +void LLFloaterSavePrefPreset::onOpen(const LLSD& key) +{ + mSubdirectory = key.asString(); + + std::string floater_title = getString(std::string("title_") + mSubdirectory); + + setTitle(floater_title); + + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo); + + onPresetNameEdited(); +} + +void LLFloaterSavePrefPreset::onBtnSave() +{ + std::string name = mPresetCombo->getSimple(); + + LLPresetsManager::getInstance()->savePreset(mSubdirectory, name); + + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetSaved", args); +} + +void LLFloaterSavePrefPreset::onPresetsListChange() +{ + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo); +} + +void LLFloaterSavePrefPreset::onBtnCancel() +{ + closeFloater(); +} -- cgit v1.2.3 From 7360f046634d013fec1e9b37c60840a83b470ce1 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 15:36:59 -0500 Subject: STORM-2082 Better control on how (or if) to display Default preset Make sure default preset is created when flyout panel is activated Only display deleted notification upon successful deletion --- indra/newview/llfloatersaveprefpreset.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 16d77c0750..3148978778 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -70,7 +70,8 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) setTitle(floater_title); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo); + EDefaultOptions option = DEFAULT_POSITION_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); onPresetNameEdited(); } @@ -88,7 +89,8 @@ void LLFloaterSavePrefPreset::onBtnSave() void LLFloaterSavePrefPreset::onPresetsListChange() { - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo); + EDefaultOptions option = DEFAULT_POSITION_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); } void LLFloaterSavePrefPreset::onBtnCancel() -- cgit v1.2.3 From 77b9793c2eb357184aedee85000c90c4b1c3e574 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 20:36:09 -0500 Subject: STORM-2082 Improve text in notifications. Disable delete button when thre is nothing to be deleted. --- indra/newview/llfloatersaveprefpreset.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 3148978778..31598a8d12 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -82,7 +82,11 @@ void LLFloaterSavePrefPreset::onBtnSave() LLPresetsManager::getInstance()->savePreset(mSubdirectory, name); + std::string preset = mSubdirectory; + preset[0] = std::toupper(preset[0]); + LLSD args; + args["TYPE"] = preset; args["NAME"] = name; LLNotificationsUtil::add("PresetSaved", args); } -- cgit v1.2.3 From ade3953e380d9211ad6d332b9b27fa23e57a7d81 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 2 Dec 2014 07:42:32 -0500 Subject: STORM-2082 Add Recommended button --- indra/newview/llfloatersaveprefpreset.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 31598a8d12..3148978778 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -82,11 +82,7 @@ void LLFloaterSavePrefPreset::onBtnSave() LLPresetsManager::getInstance()->savePreset(mSubdirectory, name); - std::string preset = mSubdirectory; - preset[0] = std::toupper(preset[0]); - LLSD args; - args["TYPE"] = preset; args["NAME"] = name; LLNotificationsUtil::add("PresetSaved", args); } -- cgit v1.2.3 From cc22efa4c0d6b06bac6f49b6243df7726f89c7c4 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 3 Dec 2014 06:35:46 -0500 Subject: STORM-2082 Remove Apply button. Add new control variable to track which preset is active. Save settings to active preset when clicking on Ok button. Initial work to make pulldown operational. Still to do: add pretty icon for current preset. Notifications do not appear when called from this panel. --- indra/newview/llfloatersaveprefpreset.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 3148978778..a5fc356c36 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -85,6 +85,8 @@ void LLFloaterSavePrefPreset::onBtnSave() LLSD args; args["NAME"] = name; LLNotificationsUtil::add("PresetSaved", args); + + closeFloater(); } void LLFloaterSavePrefPreset::onPresetsListChange() -- cgit v1.2.3 From 47282ceb7e8b8083cf816dd26bd4907aba313959 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 9 Dec 2014 16:48:00 -0500 Subject: STORM-2082 Improve file error handling, add help topic labels to new floaters. --- indra/newview/llfloatersaveprefpreset.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index a5fc356c36..02281d8b3c 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -80,11 +80,12 @@ void LLFloaterSavePrefPreset::onBtnSave() { std::string name = mPresetCombo->getSimple(); - LLPresetsManager::getInstance()->savePreset(mSubdirectory, name); - - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetSaved", args); + if (LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetSaved", args); + } closeFloater(); } -- cgit v1.2.3 From 8d12072979ee46a1eb2d13fdfef8bef62ff3f619 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 12 Dec 2014 11:13:11 -0500 Subject: STORM-2082 Merge Hardware floater into main graphics preferences display Change notifications so they are emitted only when an error occurs Put active preset at top of list Add Maximum ARC slider Merge two small methods into slider update code --- indra/newview/llfloatersaveprefpreset.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 02281d8b3c..610c701d8d 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -70,7 +70,7 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) setTitle(floater_title); - EDefaultOptions option = DEFAULT_POSITION_TOP; + EDefaultOptions option = DEFAULT_SHOW; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); onPresetNameEdited(); @@ -80,11 +80,11 @@ void LLFloaterSavePrefPreset::onBtnSave() { std::string name = mPresetCombo->getSimple(); - if (LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) { LLSD args; args["NAME"] = name; - LLNotificationsUtil::add("PresetSaved", args); + LLNotificationsUtil::add("PresetNotSaved", args); } closeFloater(); @@ -92,7 +92,7 @@ void LLFloaterSavePrefPreset::onBtnSave() void LLFloaterSavePrefPreset::onPresetsListChange() { - EDefaultOptions option = DEFAULT_POSITION_TOP; + EDefaultOptions option = DEFAULT_SHOW; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); } -- cgit v1.2.3 From 60311c6409b2ec6590b0f08135c7715f982c94ea Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 21 Jan 2015 04:57:42 -0500 Subject: STORM-2082 Put "Default" at the top of the non-Delete comboboxes. --- indra/newview/llfloatersaveprefpreset.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 610c701d8d..686a2f3269 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -70,7 +70,7 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) setTitle(floater_title); - EDefaultOptions option = DEFAULT_SHOW; + EDefaultOptions option = DEFAULT_TOP; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); onPresetNameEdited(); @@ -92,7 +92,7 @@ void LLFloaterSavePrefPreset::onBtnSave() void LLFloaterSavePrefPreset::onPresetsListChange() { - EDefaultOptions option = DEFAULT_SHOW; + EDefaultOptions option = DEFAULT_TOP; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); } -- cgit v1.2.3 From 1b7c00b558c55dd2c7a8edd8a82632dcb1219fce Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 22 Feb 2015 10:19:41 -0500 Subject: STORM-2082 Rearrange Reset, load, save, delete buttons. Make load, save, and delete floaters close when preferences floater closes. --- indra/newview/llfloatersaveprefpreset.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersaveprefpreset.cpp') diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 686a2f3269..bdef718d0e 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -30,6 +30,8 @@ #include "llbutton.h" #include "llcombobox.h" +#include "llfloaterpreference.h" +#include "llfloaterreg.h" #include "llnotificationsutil.h" #include "llpresetsmanager.h" @@ -40,7 +42,11 @@ LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) // virtual BOOL LLFloaterSavePrefPreset::postBuild() -{ +{ LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); -- cgit v1.2.3