From 34a79a6ece28fbc560bde907142ecaadf95e910f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 30 Nov 2014 07:15:00 -0500 Subject: STORM-2082 Implement delete floater --- indra/newview/llviewerfloaterreg.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewerfloaterreg.cpp') diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index e19fe9ca75..03360deaee 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -55,6 +55,7 @@ #include "llfloaterconversationlog.h" #include "llfloaterconversationpreview.h" #include "llfloaterdeleteenvpreset.h" +#include "llfloaterdeleteprefpreset.h" #include "llfloaterdestinations.h" #include "llfloaterdisplayname.h" #include "llfloatereditdaycycle.h" @@ -204,6 +205,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); -- cgit v1.3 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/CMakeLists.txt | 2 + indra/newview/llfloaterdeleteprefpreset.cpp | 12 ++- indra/newview/llfloaterdeleteprefpreset.h | 2 +- indra/newview/llfloaterpreference.cpp | 25 ++++-- indra/newview/llfloaterpreference.h | 5 +- indra/newview/llfloatersaveprefpreset.cpp | 97 ++++++++++++++++++++++ indra/newview/llfloatersaveprefpreset.h | 57 +++++++++++++ indra/newview/llpresetsmanager.cpp | 41 ++++----- indra/newview/llpresetsmanager.h | 4 +- indra/newview/llviewerfloaterreg.cpp | 2 + .../default/xui/en/floater_save_pref_preset.xml | 50 +++++++++++ .../newview/skins/default/xui/en/notifications.xml | 14 ++++ .../default/xui/en/panel_preferences_graphics1.xml | 6 +- 13 files changed, 274 insertions(+), 43 deletions(-) create mode 100644 indra/newview/llfloatersaveprefpreset.cpp create mode 100644 indra/newview/llfloatersaveprefpreset.h create mode 100644 indra/newview/skins/default/xui/en/floater_save_pref_preset.xml (limited to 'indra/newview/llviewerfloaterreg.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 213446ccfb..57fa11a0bf 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -279,6 +279,7 @@ set(viewer_SOURCE_FILES llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterregionrestarting.cpp + llfloatersaveprefpreset.cpp llfloatersceneloadstats.cpp llfloaterscriptdebug.cpp llfloaterscriptedprefs.cpp @@ -890,6 +891,7 @@ set(viewer_HEADER_FILES llfloaterregioninfo.h llfloaterreporter.h llfloaterregionrestarting.h + llfloatersaveprefpreset.h llfloatersceneloadstats.h llfloaterscriptdebug.h llfloaterscriptedprefs.h diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index bef5b4e3bf..74f8805d03 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -28,9 +28,11 @@ #include "llfloaterdeleteprefpreset.h" +#include "llpresetsmanager.h" + #include "llbutton.h" #include "llcombobox.h" -#include "llpresetsmanager.h" +#include "llnotificationsutil.h" LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key) : LLFloater(key) @@ -49,7 +51,7 @@ BOOL LLFloaterDeletePrefPreset::postBuild() void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { - std::string mSubdirectory = key.asString(); + mSubdirectory = key.asString(); std::string floater_title = getString(std::string("title_") + mSubdirectory); setTitle(floater_title); @@ -65,7 +67,11 @@ void LLFloaterDeletePrefPreset::onBtnDelete() std::string name = combo->getSimple(); // Ignore return status - LLPresetsManager::getInstance()->deletePreset(name); + LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name); + + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetDeleted", args); } void LLFloaterDeletePrefPreset::onPresetsListChange() diff --git a/indra/newview/llfloaterdeleteprefpreset.h b/indra/newview/llfloaterdeleteprefpreset.h index 356bc1a437..0ab3da7139 100644 --- a/indra/newview/llfloaterdeleteprefpreset.h +++ b/indra/newview/llfloaterdeleteprefpreset.h @@ -25,7 +25,7 @@ * $/LicenseInfo$ */ -#ifndef LL_LLFLOATERDELETPREFPRESET_H +#ifndef LL_LLFLOATERDELETEPREFPRESET_H #define LL_LLFLOATERDELETEPREFPRESET_H #include "llfloater.h" diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 508d82522e..2e1e1ba318 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1883,8 +1883,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.Preset", boost::bind(&LLPanelPreference::onChangePreset, this)); - mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::onDeletePreset, this)); + mCommitCallbackRegistrar.add("Pref.Preset", boost::bind(&LLPanelPreference::onChangePreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::DeletePreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::SavePreset, this, _2)); } //virtual @@ -2082,17 +2083,27 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) } } -void LLPanelPreference::onDeletePreset() +void LLPanelPreference::DeletePreset(const LLSD& user_data) { - LLFloaterReg::showInstance("delete_pref_preset", PRESETS_GRAPHIC); + std::string subdirectory = user_data.asString(); + LLFloaterReg::showInstance("delete_pref_preset", subdirectory); } -void LLPanelPreference::onChangePreset() +void LLPanelPreference::SavePreset(const LLSD& user_data) { - LLComboBox* combo = getChild("graphic_preset_combo"); + std::string subdirectory = user_data.asString(); + LLFloaterReg::showInstance("save_pref_preset", subdirectory); +} + +void LLPanelPreference::onChangePreset(const LLSD& user_data) +{ + std::string subdirectory = user_data.asString(); + + LLComboBox* combo = getChild(subdirectory + "_preset_combo"); std::string name = combo->getSimple(); - LLPresetsManager::getInstance()->loadPreset(name); + + LLPresetsManager::getInstance()->loadPreset(subdirectory, name); LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index be228c8625..5452dc6442 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -221,8 +221,9 @@ public: // cancel() can restore them. virtual void saveSettings(); - void onDeletePreset(); - void onChangePreset(); + void onChangePreset(const LLSD& user_data); + void DeletePreset(const LLSD& user_data); + void SavePreset(const LLSD& user_data); class Updater; 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(); +} diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h new file mode 100644 index 0000000000..09a87b8c62 --- /dev/null +++ b/indra/newview/llfloatersaveprefpreset.h @@ -0,0 +1,57 @@ +/** + * @file llfloatersaveprefpreset.h + * @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$ + */ + +#ifndef LL_LLFLOATERSAVEPREFPRESET_H +#define LL_LLFLOATERSAVEPREFPRESET_H + +#include "llfloater.h" + +class LLComboBox; + +class LLFloaterSavePrefPreset : public LLFloater +{ + +public: + LLFloaterSavePrefPreset(const LLSD &key); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + + void onBtnSave(); + void onBtnCancel(); + +private: + LLComboBox* mPresetCombo; + LLButton* mSaveButton; + + void onPresetsListChange(); + void onPresetNameEdited(); + + std::string mSubdirectory; +}; + +#endif // LL_LLFLOATERSAVEPREFPRESET_H diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 6e00a90ae5..f6f2275da9 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -165,7 +165,7 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st paramsData[ctrl_name]["Value"] = value; } - std::string pathName(getPresetsDir(subdirectory) + "\\" + LLURI::escape(name) + ".xml"); + std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); // write to file llofstream presetsXML(pathName); @@ -188,46 +188,35 @@ void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, std::list preset_names; loadPresetNamesFromDir(presets_dir, preset_names); - combo->setLabel(LLTrans::getString("preset_combo_label")); - - for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + if (preset_names.begin() != preset_names.end()) { - const std::string& name = *it; - combo->add(name, LLSD().with(0, name)); + for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + { + const std::string& name = *it; + combo->add(name, LLSD().with(0, name)); + } + } + else + { + combo->setLabel(LLTrans::getString("preset_combo_label")); } - } - else - { - LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; } } -void LLPresetsManager::loadPreset(const std::string& name) +void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::string& name) { - std::string full_path(getPresetsDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); + std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); gSavedSettings.loadFromFile(full_path, false, true); } -bool LLPresetsManager::deletePreset(const std::string& name) +bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name) { - // remove from param list - preset_name_list_t::iterator it = find(mPresetNames.begin(), mPresetNames.end(), name); - if (it == mPresetNames.end()) - { - LL_WARNS("Presets") << "No preset named " << name << LL_ENDL; - return false; - } - - if (gDirUtilp->deleteFilesInDir(getPresetsDir(PRESETS_GRAPHIC), LLURI::escape(name) + ".xml") < 1) + if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) { LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; return false; } - else - { - mPresetNames.erase(it); - } // signal interested parties mPresetListChangeSignal(); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 3a2542bda0..7bbaa778c6 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -46,8 +46,8 @@ public: void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo); void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets); void savePreset(const std::string& subdirectory, const std::string & name); - void loadPreset(const std::string & name); - bool deletePreset(const std::string& name); + void loadPreset(const std::string& subdirectory, const std::string & name); + bool deletePreset(const std::string& subdirectory, const std::string& name); /// Emitted when a preset gets loaded or deleted. boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 03360deaee..3ee67d8ac5 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -101,6 +101,7 @@ #include "llfloaterregioninfo.h" #include "llfloaterregionrestarting.h" #include "llfloaterreporter.h" +#include "llfloatersaveprefpreset.h" #include "llfloatersceneloadstats.h" #include "llfloaterscriptdebug.h" #include "llfloaterscriptedprefs.h" @@ -290,6 +291,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml new file mode 100644 index 0000000000..5919d9e3d7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -0,0 +1,50 @@ + + + + Save Graphic Preset + Save Camera Preset + + + Preset: + + + - + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 1c655c6559..023c6e5bbb 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4044,5 +4044,6 @@ Try enclosing path to the editor with double quotes. -Empty list- - + Default + Off -- cgit v1.3 From 611391a818746f560ad49847ae643613313ac216 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 20 Jan 2015 09:17:23 -0500 Subject: STORM-2082 Update to new UI design. Bugs are not worked out yet. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterdeleteprefpreset.cpp | 12 +- indra/newview/llfloaterloadprefpreset.cpp | 92 +++++++++++++++ indra/newview/llfloaterloadprefpreset.h | 53 +++++++++ indra/newview/llfloaterpreference.cpp | 123 +++++++++++++-------- indra/newview/llfloaterpreference.h | 9 +- indra/newview/llpanelpresetspulldown.h | 2 +- indra/newview/llpresetsmanager.cpp | 22 +++- indra/newview/llpresetsmanager.h | 4 +- indra/newview/llviewerfloaterreg.cpp | 2 + .../default/xui/en/floater_load_pref_preset.xml | 49 ++++++++ .../default/xui/en/panel_preferences_graphics1.xml | 83 +++++++++----- indra/newview/skins/default/xui/en/strings.xml | 1 + 13 files changed, 358 insertions(+), 96 deletions(-) create mode 100644 indra/newview/llfloaterloadprefpreset.cpp create mode 100644 indra/newview/llfloaterloadprefpreset.h create mode 100644 indra/newview/skins/default/xui/en/floater_load_pref_preset.xml (limited to 'indra/newview/llviewerfloaterreg.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 192be979fb..d1b0aae542 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -255,6 +255,7 @@ set(viewer_SOURCE_FILES llfloaterlagmeter.cpp llfloaterland.cpp llfloaterlandholdings.cpp + llfloaterloadprefpreset.cpp llfloatermap.cpp llfloatermediasettings.cpp llfloatermemleak.cpp @@ -866,6 +867,7 @@ set(viewer_HEADER_FILES llfloaterlagmeter.h llfloaterland.h llfloaterlandholdings.h + llfloaterloadprefpreset.h llfloatermap.h llfloatermediasettings.h llfloatermemleak.h diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index f147a5ee90..5cd37d61fc 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -1,5 +1,5 @@ /** - * @file llfloaterdeletprefpreset.cpp + * @file llfloaterdeleteprefpreset.cpp * @brief Floater to delete a graphics / camera preset * * $LicenseInfo:firstyear=2014&license=viewerlgpl$ @@ -67,15 +67,7 @@ void LLFloaterDeletePrefPreset::onBtnDelete() LLComboBox* combo = getChild("preset_combo"); std::string name = combo->getSimple(); - if (LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) - { - // If you delete the active preset (which should never happen) then recreate it. - if (name == gSavedSettings.getString("PresetGraphicActive")) - { - LLPresetsManager::getInstance()->savePreset(mSubdirectory, PRESETS_DEFAULT); - } - } - else + if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) { LLSD args; args["NAME"] = name; diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp new file mode 100644 index 0000000000..6ec2e5c09d --- /dev/null +++ b/indra/newview/llfloaterloadprefpreset.cpp @@ -0,0 +1,92 @@ +/** + * @file llfloateloadprefpreset.cpp + * @brief Floater to load a graphics / camera preset + * + * $LicenseInfo:firstyear=2015&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2015, 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 "llfloaterloadprefpreset.h" + +#include "llbutton.h" +#include "llcombobox.h" +#include "llfloaterpreference.h" +#include "llfloaterreg.h" +#include "llpresetsmanager.h" +#include "llviewercontrol.h" + +LLFloaterLoadPrefPreset::LLFloaterLoadPrefPreset(const LLSD &key) +: LLFloater(key) +{ +} + +// virtual +BOOL LLFloaterLoadPrefPreset::postBuild() +{ + getChild("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this)); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this)); + + return TRUE; +} + +void LLFloaterLoadPrefPreset::onOpen(const LLSD& key) +{ + mSubdirectory = key.asString(); + std::string floater_title = getString(std::string("title_") + mSubdirectory); + + setTitle(floater_title); + + LLComboBox* combo = getChild("preset_combo"); + + EDefaultOptions option = DEFAULT_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); +} + +void LLFloaterLoadPrefPreset::onPresetsListChange() +{ + LLComboBox* combo = getChild("preset_combo"); + + EDefaultOptions option = DEFAULT_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); +} + +void LLFloaterLoadPrefPreset::onBtnCancel() +{ + closeFloater(); +} + +void LLFloaterLoadPrefPreset::onBtnOk() +{ + LLComboBox* combo = getChild("preset_combo"); + std::string name = combo->getSimple(); + + LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name); + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } + + closeFloater(); +} diff --git a/indra/newview/llfloaterloadprefpreset.h b/indra/newview/llfloaterloadprefpreset.h new file mode 100644 index 0000000000..9471f6f1e1 --- /dev/null +++ b/indra/newview/llfloaterloadprefpreset.h @@ -0,0 +1,53 @@ +/** + * @file llfloaterloadprefpreset.h + * @brief Floater to load a graphics / camera preset + + * + * $LicenseInfo:firstyear=2015&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2015, 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$ + */ + +#ifndef LL_LLFLOATERLOADPREFPRESET_H +#define LL_LLFLOATERLOADPREFPRESET_H + +#include "llfloater.h" + +class LLComboBox; + +class LLFloaterLoadPrefPreset : public LLFloater +{ + +public: + LLFloaterLoadPrefPreset(const LLSD &key); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + + void onBtnOk(); + void onBtnCancel(); + +private: + void onPresetsListChange(); + + std::string mSubdirectory; +}; + +#endif // LL_LLFLOATERLOADPREFPRESET_H diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index cb59cc27d7..6dd030b280 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -107,6 +107,7 @@ #include "lllogininstance.h" // to check if logged in yet #include "llsdserialize.h" +#include "llpanelpresetspulldown.h" #include "llpresetsmanager.h" #include "llviewercontrol.h" #include "llpresetsmanager.h" @@ -735,11 +736,11 @@ void LLFloaterPreference::onOpen(const LLSD& key) bool started = (LLStartUp::getStartupState() == STATE_STARTED); - LLComboBox* combo = getChild("graphic_preset_combo"); + LLButton* load_btn = findChild("PrefLoadButton"); LLButton* save_btn = findChild("PrefSaveButton"); LLButton* delete_btn = findChild("PrefDeleteButton"); - combo->setEnabled(started); + load_btn->setEnabled(started); save_btn->setEnabled(started); delete_btn->setEnabled(started); } @@ -789,8 +790,6 @@ void LLFloaterPreference::setHardwareDefaults() if (panel) panel->setHardwareDefaults(); } - - LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); } void LLFloaterPreference::getControlNames(std::vector& names) @@ -899,11 +898,6 @@ void LLFloaterPreference::onBtnOK() LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); pPathfindingConsole->onRegionBoundaryCross(); } - - // Write settings to currently defined preset. This will recreate a missing preset file - // and ensure the preset file matches the current settings (which may have been changed - // via some other means). - LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, gSavedSettings.getString("PresetGraphicActive")); } // static @@ -1156,11 +1150,11 @@ void LLFloaterPreference::refreshEnabledState() if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) { - ctrl_avatar_cloth->setEnabled(false); + ctrl_avatar_cloth->setEnabled(FALSE); } else { - ctrl_avatar_cloth->setEnabled(true); + ctrl_avatar_cloth->setEnabled(TRUE); } // Vertex Shaders @@ -1174,14 +1168,16 @@ void LLFloaterPreference::refreshEnabledState() BOOL shaders = ctrl_shader_enable->get(); if (shaders) { +llwarns << "DBG terrain OFF" << llendl; terrain_detail->setValue(1); terrain_detail->setEnabled(FALSE); - terrain_text->setEnabled(false); + terrain_text->setEnabled(FALSE); } else { +llwarns << "DBG terrain ON" << llendl; terrain_detail->setEnabled(TRUE); - terrain_text->setEnabled(true); + terrain_text->setEnabled(TRUE); } // WindLight @@ -1331,12 +1327,12 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(FALSE); - sky->setEnabled(false); - sky_text->setEnabled(false); + sky->setEnabled(FALSE); + sky_text->setEnabled(FALSE); ctrl_reflections->setEnabled(FALSE); ctrl_reflections->setValue(0); - reflections_text->setEnabled(false); + reflections_text->setEnabled(FALSE); ctrl_avatar_vp->setEnabled(FALSE); ctrl_avatar_vp->setValue(FALSE); @@ -1346,7 +1342,7 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); - shadows_text->setEnabled(false); + shadows_text->setEnabled(FALSE); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1366,13 +1362,13 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(FALSE); - sky->setEnabled(false); - sky_text->setEnabled(false); + sky->setEnabled(FALSE); + sky_text->setEnabled(FALSE); //deferred needs windlight, disable deferred ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); - shadows_text->setEnabled(false); + shadows_text->setEnabled(FALSE); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1392,7 +1388,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); - shadows_text->setEnabled(false); + shadows_text->setEnabled(FALSE); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1418,7 +1414,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); - shadows_text->setEnabled(false); + shadows_text->setEnabled(FALSE); } // disabled reflections @@ -1426,7 +1422,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_reflections->setEnabled(FALSE); ctrl_reflections->setValue(FALSE); - reflections_text->setEnabled(false); + reflections_text->setEnabled(FALSE); } // disabled av @@ -1441,7 +1437,7 @@ void LLFloaterPreference::disableUnavailableSettings() //deferred needs AvatarVP, disable deferred ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); - shadows_text->setEnabled(false); + shadows_text->setEnabled(FALSE); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1488,7 +1484,6 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); - updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true)); updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); @@ -1782,8 +1777,11 @@ void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* te F32 value = (F32)ctrl->getValue().asReal(); - if (0.0f == value) + if (101.0f == value) { + // It has been decided that having the slider all the way to the right will be the off position, which + // is a value of 101, so it is necessary to change value to 0 disable impostor generation. + value = 0.0f; text_box->setText(LLTrans::getString("Off")); } else @@ -2007,9 +2005,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.Preset", boost::bind(&LLPanelPreference::onChangePreset, 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 @@ -2219,19 +2217,10 @@ void LLPanelPreference::SavePreset(const LLSD& user_data) LLFloaterReg::showInstance("save_pref_preset", subdirectory); } -void LLPanelPreference::onChangePreset(const LLSD& user_data) +void LLPanelPreference::LoadPreset(const LLSD& user_data) { std::string subdirectory = user_data.asString(); - - LLComboBox* combo = getChild(subdirectory + "_preset_combo"); - std::string name = combo->getSimple(); - - LLPresetsManager::getInstance()->loadPreset(subdirectory, name); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refreshEnabledGraphics(); - } + LLFloaterReg::showInstance("load_pref_preset", subdirectory); } void LLPanelPreference::setHardwareDefaults() @@ -2293,27 +2282,52 @@ BOOL LLPanelPreferenceGraphics::postBuild() } #endif - LLComboBox* combo = getChild("graphic_preset_combo"); - combo->setLabel(LLTrans::getString("preset_combo_label")); - - setPresetNamesInComboBox(); - + setPresetText(); LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); return LLPanelPreference::postBuild(); } +void LLPanelPreferenceGraphics::draw() +{ + LLPanelPreference::draw(); + setPresetText(); +} + void LLPanelPreferenceGraphics::onPresetsListChange() { - setPresetNamesInComboBox(); + resetDirtyChilds(); + setPresetText(); } -void LLPanelPreferenceGraphics::setPresetNamesInComboBox() +void LLPanelPreferenceGraphics::setPresetText() { - LLComboBox* combo = getChild("graphic_preset_combo"); + LLTextBox* preset_text = getChild("preset_text"); - EDefaultOptions option = DEFAULT_SHOW; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option); + if (hasDirtyChilds()) + { + gSavedSettings.setString("PresetGraphicActive", ""); + + LLPanelPresetsPulldown* instance = LLFloaterReg::findTypedInstance("presets_pulldown"); + if (instance) + { +llwarns << "DBG populate" << llendl; + instance->populatePanel(); + } + } + + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + + if (!preset_graphic_active.empty()) + { + preset_text->setText(preset_graphic_active); + } + else + { + preset_text->setText(LLTrans::getString("none_paren_cap")); + } + + preset_text->resetDirty(); } bool LLPanelPreferenceGraphics::hasDirtyChilds() @@ -2330,7 +2344,18 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds() if (ctrl) { if (ctrl->isDirty()) - return true; + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if ((control_name != "RenderDeferred") && (control_name != "RenderTerrainDetail")) + { +llwarns << "DBG " << control_name << llendl; + return true; + } + } + } } // Push children onto the end of the work stack for (child_list_t::const_iterator iter = curview->getChildList()->begin(); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 96d026277f..f73560e3c5 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -222,9 +222,9 @@ public: // cancel() can restore them. virtual void saveSettings(); - void onChangePreset(const LLSD& user_data); void DeletePreset(const LLSD& user_data); void SavePreset(const LLSD& user_data); + void LoadPreset(const LLSD& user_data); class Updater; @@ -248,15 +248,18 @@ class LLPanelPreferenceGraphics : public LLPanelPreference { public: BOOL postBuild(); + void draw(); void cancel(); void saveSettings(); + void resetDirtyChilds(); void setHardwareDefaults(); - void setPresetNamesInComboBox(); + void setPresetText(); + static const std::string getPresetsPath(); protected: bool hasDirtyChilds(); - void resetDirtyChilds(); +private: void onPresetsListChange(); }; diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h index f3e0340247..146ccc0b09 100644 --- a/indra/newview/llpanelpresetspulldown.h +++ b/indra/newview/llpanelpresetspulldown.h @@ -43,9 +43,9 @@ class LLPanelPresetsPulldown : public LLPanel /*virtual*/ void onTopLost(); /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); /*virtual*/ BOOL postBuild(); + void populatePanel(); private: - void populatePanel(); void onGraphicsButtonClick(const LLSD& user_data); void onRowClick(const LLSD& user_data); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 67d06ff5dd..05138ee0c3 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -54,14 +54,14 @@ void LLPresetsManager::createMissingDefault() { LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL; // Write current graphic settings to default.xml - // If this name is to be localized additional code will be needed to delete the old default + // *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()) - { - gSavedSettings.setString("PresetGraphicActive", PRESETS_DEFAULT); + if (gSavedSettings.getString("PresetGraphicActive").empty()) + { + gSavedSettings.setString("PresetGraphicActive", PRESETS_DEFAULT); + } } } @@ -187,6 +187,8 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::st formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); + gSavedSettings.setString("PresetGraphicActive", name); + // signal interested parties mPresetListChangeSignal(); @@ -234,6 +236,10 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st if(gSavedSettings.loadFromFile(full_path, false, true) > 0) { + if(PRESETS_GRAPHIC == subdirectory) + { + gSavedSettings.setString("PresetGraphicActive", name); + } mPresetListChangeSignal(); } } @@ -252,6 +258,12 @@ bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std:: return false; } + // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. + if (gSavedSettings.getString("PresetGraphicActive") == name) + { + gSavedSettings.setString("PresetGraphicActive", ""); + } + // signal interested parties mPresetListChangeSignal(); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index e9ed164322..50fe9f4216 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -59,9 +59,11 @@ public: void loadPreset(const std::string& subdirectory, const std::string & name); bool deletePreset(const std::string& subdirectory, const std::string& name); - /// Emitted when a preset gets loaded or deleted. + // Emitted when a preset gets loaded, deleted, or saved. boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb); + // Emitted when a preset gets loaded or saved. + preset_name_list_t mPresetNames; LLPresetsManager(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 8acb56d650..5ab7551849 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -79,6 +79,7 @@ #include "llfloaterlagmeter.h" #include "llfloaterland.h" #include "llfloaterlandholdings.h" +#include "llfloaterloadprefpreset.h" #include "llfloatermap.h" #include "llfloatermediasettings.h" #include "llfloatermemleak.h" @@ -242,6 +243,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_load_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_load_pref_preset.xml new file mode 100644 index 0000000000..72feeeef74 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_load_pref_preset.xml @@ -0,0 +1,49 @@ + + + + Load Graphic Preset + Load Camera Preset + + + Preset: + + + + + + + + + General @@ -471,14 +499,14 @@ control_name="MaximumARC" follows="left|top" height="16" - initial_value="0" + initial_value="101" increment="1" label="Maximum ARC:" label_width="165" layout="topleft" left="50" - min_val="0" - max_val="100" + min_val="1" + max_val="101" name="MaximumARC" show_text="false" top_delta="16" @@ -1185,14 +1213,15 @@ diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 023c6e5bbb..c09129c867 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4046,4 +4046,5 @@ Try enclosing path to the editor with double quotes. -Empty list- Default Off + (None) -- cgit v1.3 From b4c99cbb0aafc077c67b868ecb2d4c802355f472 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 11 Feb 2015 13:28:39 -0500 Subject: STORM-2082 Attempt to put advanced settings into separate floater --- indra/newview/llfloaterpreference.cpp | 121 ++- indra/newview/llfloaterpreference.h | 29 +- indra/newview/llviewerfloaterreg.cpp | 1 + .../en/floater_preferences_graphics_advanced.xml | 862 ++++++++++++++++ .../default/xui/en/panel_preferences_graphics1.xml | 1084 ++------------------ 5 files changed, 1079 insertions(+), 1018 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml (limited to 'indra/newview/llviewerfloaterreg.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 0ac18408db..d2dfb63f9d 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -351,6 +351,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this)); mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); + mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -621,6 +622,9 @@ void LLFloaterPreference::cancel() // hide spellchecker settings folder LLFloaterReg::hideInstance("prefs_spellchecker"); + + // hide advancede floater + LLFloaterReg::hideInstance("prefs_graphics_advanced"); // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); @@ -745,6 +749,22 @@ void LLFloaterPreference::onVertexShaderEnable() refreshEnabledGraphics(); } +void LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable() +{ + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refresh(); + } + + refreshEnabledGraphics(); +} + +void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledGraphics() +{ + refreshEnabledState(); +} + void LLFloaterPreference::onAvatarImpostorsEnable() { refreshEnabledGraphics(); @@ -792,10 +812,12 @@ void LLFloaterPreference::setHardwareDefaults() void LLFloaterPreference::getControlNames(std::vector& names) { LLView* view = findChild("display"); - if (view) + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (view && advanced) { std::list stack; stack.push_back(view); + stack.push_back(advanced); while(!stack.empty()) { // Process view on top of the stack @@ -930,6 +952,12 @@ void LLFloaterPreference::refreshEnabledGraphics() { instance->refresh(); } + + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (advanced) + { + advanced->refresh(); + } } void LLFloaterPreference::onClickClearCache() @@ -1111,7 +1139,37 @@ void LLFloaterPreference::buildPopupLists() } void LLFloaterPreference::refreshEnabledState() -{ +{ + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + + // if vertex shaders off, disable all shader related products + if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || + !LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + { + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + } + else + { + ctrl_wind_light->setEnabled(gSavedSettings.getBOOL("VertexShaderEnable")); + } + + //Deferred/SSAO/Shadows + BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); + BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable"); + BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + bumpshiny && + shaders && + gGLManager.mHasFramebufferObject && + gSavedSettings.getBOOL("RenderAvatarVP") && + (ctrl_wind_light->get()) ? TRUE : FALSE; + + ctrl_deferred->setEnabled(enabled); +} + +void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() +{ LLComboBox* ctrl_reflections = getChild("Reflections"); LLTextBox* reflections_text = getChild("ReflectionsText"); @@ -1175,22 +1233,18 @@ void LLFloaterPreference::refreshEnabledState() // WindLight LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLCheckBoxCtrl* ctrl_wind_light2 = getChild("WindLightUseAtmosShaders2"); LLSliderCtrl* sky = getChild("SkyMeshDetail"); LLTextBox* sky_text = getChild("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); //Deferred/SSAO/Shadows LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && @@ -1200,7 +1254,6 @@ void LLFloaterPreference::refreshEnabledState() (ctrl_wind_light->get()) ? TRUE : FALSE; ctrl_deferred->setEnabled(enabled); - ctrl_deferred2->setEnabled(enabled); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); @@ -1291,7 +1344,7 @@ void LLFloaterPreference::refreshEnabledState() getChild("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); } -void LLFloaterPreference::disableUnavailableSettings() +void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() { LLComboBox* ctrl_reflections = getChild("Reflections"); LLTextBox* reflections_text = getChild("ReflectionsText"); @@ -1302,7 +1355,6 @@ void LLFloaterPreference::disableUnavailableSettings() LLSliderCtrl* ctrl_maximum_arc = getChild("MaximumARC"); LLTextBox* maximum_arc_text = getChild("MaximumARCText"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); LLComboBox* ctrl_shadows = getChild("ShadowDetail"); LLTextBox* shadows_text = getChild("RenderShadowDetailText"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); @@ -1344,8 +1396,6 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); - ctrl_deferred2->setEnabled(FALSE); - ctrl_deferred2->setValue(FALSE); } // disabled windlight @@ -1370,8 +1420,6 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); - ctrl_deferred2->setEnabled(FALSE); - ctrl_deferred2->setValue(FALSE); } // disabled deferred @@ -1390,8 +1438,6 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); - ctrl_deferred2->setEnabled(FALSE); - ctrl_deferred2->setValue(FALSE); } // disabled deferred SSAO @@ -1439,8 +1485,6 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); - ctrl_deferred2->setEnabled(FALSE); - ctrl_deferred2->setValue(FALSE); } // disabled cloth @@ -1461,6 +1505,18 @@ void LLFloaterPreference::disableUnavailableSettings() void LLFloaterPreference::refresh() { LLPanel::refresh(); + refreshEnabledState(); +} + +void LLFloaterPreferenceGraphicsAdvanced::draw() +{ + refresh(); + LLFloater::draw(); +} + +void LLFloaterPreferenceGraphicsAdvanced::refresh() +{ + refreshEnabledState(); getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); @@ -1731,7 +1787,7 @@ void LLFloaterPreference::refreshUI() refresh(); } -void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) return; @@ -1760,7 +1816,7 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b } } -void LLFloaterPreference::updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreferenceGraphicsAdvanced::updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* text_box) { F32 value = (F32)ctrl->getValue().asReal(); @@ -1779,7 +1835,7 @@ void LLFloaterPreference::updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* tex } } -void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreferenceGraphicsAdvanced::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box) { F32 min_result = 20000.0f; F32 max_result = 300000.0f; @@ -1857,6 +1913,11 @@ void LLFloaterPreference::onClickSpellChecker() LLFloaterReg::showInstance("prefs_spellchecker"); } +void LLFloaterPreference::onClickAdvanced() +{ + LLFloaterReg::showInstance("prefs_graphics_advanced"); +} + void LLFloaterPreference::onClickActionChange() { mClickActionDirty = true; @@ -2115,10 +2176,13 @@ void LLPanelPreference::apply() void LLPanelPreference::saveSettings() { + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + // Save the value of all controls in the hierarchy mSavedValues.clear(); std::list view_stack; view_stack.push_back(this); + view_stack.push_back(advanced); while(!view_stack.empty()) { // Process view on top of the stack @@ -2279,6 +2343,9 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { + LLFloaterReg::showInstance("prefs_graphics_advanced"); + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + // Don't do this on Mac as their braindead GL versioning // sets this when 8x and 16x are indeed available // @@ -2340,8 +2407,10 @@ void LLPanelPreferenceGraphics::setPresetText() bool LLPanelPreferenceGraphics::hasDirtyChilds() { + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); std::list view_stack; view_stack.push_back(this); + view_stack.push_back(advanced); while(!view_stack.empty()) { // Process view on top of the stack @@ -2377,8 +2446,10 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds() void LLPanelPreferenceGraphics::resetDirtyChilds() { + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); std::list view_stack; view_stack.push_back(this); + view_stack.push_back(advanced); while(!view_stack.empty()) { // Process view on top of the stack @@ -2414,6 +2485,16 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() LLPanelPreference::setHardwareDefaults(); } +LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) + : LLFloater(key) +{ + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this)); +} + +LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() +{ +} + LLFloaterPreferenceProxy::LLFloaterPreferenceProxy(const LLSD& key) : LLFloater(key), mSocksSettingsDirty(false) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 10087f8aa3..cc3c85e340 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -117,10 +117,10 @@ protected: // callback for defaults void setHardwareDefaults(); void setRecommended(); - // callback for when client turns on shaders - void onVertexShaderEnable(); // callback for when client turns on impostors void onAvatarImpostorsEnable(); + // callback for when client turns on shaders + void onVertexShaderEnable(); // callback for commit in the "Single click on land" and "Double click on land" comboboxes. void onClickActionChange(); @@ -128,7 +128,7 @@ protected: void updateClickActionSettings(); // updates click/double-click action controls depending on values from settings.xml void updateClickActionControls(); - + // This function squirrels away the current values of the controls so that // cancel() can restore them. void saveSettings(); @@ -155,15 +155,11 @@ public: void enableHistory(); void setPersonalInfo(const std::string& visibility, bool im_via_email); void refreshEnabledState(); - void disableUnavailableSettings(); void onCommitWindowedMode(); void refresh(); // Refresh enable/disable // if the quality radio buttons are changed void onChangeQuality(const LLSD& data); - void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); - void updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* text_box); - void updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box); void refreshUI(); void onCommitParcelMediaAutoPlayEnable(); @@ -177,6 +173,7 @@ public: void onClickPermsDefault(); void onClickAutoReplace(); void onClickSpellChecker(); + void onClickAdvanced(); void applyUIColor(LLUICtrl* ctrl, const LLSD& param); void getUIColor(LLUICtrl* ctrl, const LLSD& param); void onLogChatHistorySaved(); @@ -269,6 +266,24 @@ private: void onPresetsListChange(); }; +class LLFloaterPreferenceGraphicsAdvanced : public LLFloater +{ +public: + LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); + ~LLFloaterPreferenceGraphicsAdvanced(); + + void disableUnavailableSettings(); + void refreshEnabledGraphics(); + void refreshEnabledState(); + void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void draw(); + void refresh(); + // callback for when client turns on shaders + void onVertexShaderEnable(); +}; + class LLFloaterPreferenceProxy : public LLFloater { public: diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 5ab7551849..5143d2c2ff 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -274,6 +274,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml new file mode 100644 index 0000000000..981a30b436 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -0,0 +1,862 @@ + + + + + + + + + General + + + + + m + + + + + + + + + Low + + + + Avatar + + + + + + + 0 + + + + + + + 0 + + + + + + + Low + + + + + + + Low + + + + Shaders + + + + + + + + + + + + + + + + + + + Low + + + + + + + + + + Water Reflections: + + + + + + + + + + + + + + + + + + Low + + + + + + + + + + + + + + + + Shadows: + + + + + + + + + Mesh + + + + + + + Low + + + + + + + Low + + + + + + + Low + + + + + + + Low + + + + Hardware + + + + + + + + + (0 = default brightness, lower = brighter) + + + + + + + + + + Antialiasing: + + + + + + + + + + (requires viewer restart) + + + + 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 756c765bbd..5d4bfdd17f 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -10,7 +10,6 @@ top="1" width="517"> - - - - - - - - - - - m - + - - - + + + m + - - - + + + + + + + - - - - - - - - - - - - General - - - - - m - - - - - - - - - Low - - - - Avatar - - - - - - - 0 - - - - - - - 0 - - - - - - - Low - - - - - - - Low - - - - Shaders - - - - - - - - - - - - - - - - - - - Low - - - - - - - - - - Water Reflections: - - - - - - - - - - - - - - - - - - Low - - - - - - - - - - - - - - - - Shadows: - - - - - - - - - Mesh - - - - - - - Low - - - - - - - Low - - - - - - - Low - - - - - - - Low - - - - Hardware - - - - - - - - - (0 = default brightness, lower = brighter) - - - - - - - - - - Antialiasing: - - - - - - - - - - (requires viewer restart) - - - - - + - - + -- cgit v1.3