From af827615acc6cce0457ba00810136c41283f6158 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 28 Nov 2014 10:00:41 -0500 Subject: STORM-2082 Initial support for presets popup from status bar --- indra/newview/llpanelpresetspulldown.cpp | 155 +++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 indra/newview/llpanelpresetspulldown.cpp (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp new file mode 100644 index 0000000000..d93afd674c --- /dev/null +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -0,0 +1,155 @@ +/** + * @file llpanelpresetspulldown.cpp + * @author Tofu Linden + * @brief A panel showing a quick way to pick presets + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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 "llpanelpresetspulldown.h" + +// Viewer libs +#include "llviewercontrol.h" +#include "llstatusbar.h" + +// Linden libs +#include "llbutton.h" +#include "lltabcontainer.h" +#include "llfloaterreg.h" +#include "llfloaterpreference.h" +#include "llsliderctrl.h" + +/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f; +/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 5.0f; + +///---------------------------------------------------------------------------- +/// Class LLPanelPresetsPulldown +///---------------------------------------------------------------------------- + +// Default constructor +LLPanelPresetsPulldown::LLPanelPresetsPulldown() +{ + mHoverTimer.stop(); + + mCommitCallbackRegistrar.add("Presets.GoMoveViewPrefs", boost::bind(&LLPanelPresetsPulldown::onMoveViewButtonClick, this, _2)); + mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2)); + buildFromFile( "panel_presets_pulldown.xml"); +} + +BOOL LLPanelPresetsPulldown::postBuild() +{ + return LLPanel::postBuild(); +} + +/*virtual*/ +void LLPanelPresetsPulldown::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mHoverTimer.stop(); + LLPanel::onMouseEnter(x,y,mask); +} + +/*virtual*/ +void LLPanelPresetsPulldown::onTopLost() +{ + setVisible(FALSE); +} + +/*virtual*/ +void LLPanelPresetsPulldown::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mHoverTimer.start(); + LLPanel::onMouseLeave(x,y,mask); +} + +/*virtual*/ +void LLPanelPresetsPulldown::onVisibilityChange ( BOOL new_visibility ) +{ + if (new_visibility) + { + mHoverTimer.start(); // timer will be stopped when mouse hovers over panel + } + else + { + mHoverTimer.stop(); + + } +} + +void LLPanelPresetsPulldown::onMoveViewButtonClick(const LLSD& user_data) +{ + // close the minicontrol, we're bringing up the big one + setVisible(FALSE); + + // bring up the prefs floater + LLFloaterPreference* prefsfloater = dynamic_cast + (LLFloaterReg::showInstance("preferences")); + if (prefsfloater) + { + // grab the 'move' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* movepanel = prefsfloater->getChild("move"); + if (tabcontainer && movepanel) + { + tabcontainer->selectTabPanel(movepanel); + } + } +} + +void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data) +{ + // close the minicontrol, we're bringing up the big one + setVisible(FALSE); + + // bring up the prefs floater + LLFloaterPreference* prefsfloater = dynamic_cast + (LLFloaterReg::showInstance("preferences")); + if (prefsfloater) + { + // grab the 'graphics' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* graphicspanel = prefsfloater->getChild("display"); + if (tabcontainer && graphicspanel) + { + tabcontainer->selectTabPanel(graphicspanel); + } + } +} + +//virtual +void LLPanelPresetsPulldown::draw() +{ + F32 alpha = mHoverTimer.getStarted() + ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), sAutoCloseFadeStartTimeSec, sAutoCloseTotalTimeSec, 1.f, 0.f) + : 1.0f; + LLViewDrawContext context(alpha); + + LLPanel::draw(); + + if (alpha == 0.f) + { + setVisible(FALSE); + } +} -- cgit v1.3 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/CMakeLists.txt | 2 + indra/newview/llfloaterdeleteprefpreset.cpp | 80 ++++++++++++++++++++++ indra/newview/llfloaterdeleteprefpreset.h | 51 ++++++++++++++ indra/newview/llfloaterpreference.cpp | 36 ++++------ indra/newview/llfloaterpreference.h | 3 +- indra/newview/llpanelpresetspulldown.cpp | 13 ++-- indra/newview/llpanelpresetspulldown.h | 5 +- indra/newview/llpresetsmanager.cpp | 53 ++++++++++---- indra/newview/llpresetsmanager.h | 9 ++- indra/newview/llviewerfloaterreg.cpp | 2 + .../default/xui/en/floater_delete_pref_preset.xml | 49 +++++++++++++ .../default/xui/en/panel_preferences_graphics1.xml | 4 +- indra/newview/skins/default/xui/en/strings.xml | 5 +- 13 files changed, 257 insertions(+), 55 deletions(-) create mode 100644 indra/newview/llfloaterdeleteprefpreset.cpp create mode 100644 indra/newview/llfloaterdeleteprefpreset.h create mode 100644 indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e29506bdf5..213446ccfb 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -225,6 +225,7 @@ set(viewer_SOURCE_FILES llfloaterconversationlog.cpp llfloaterconversationpreview.cpp llfloaterdeleteenvpreset.cpp + llfloaterdeleteprefpreset.cpp llfloaterdestinations.cpp llfloaterdisplayname.cpp llfloatereditdaycycle.cpp @@ -831,6 +832,7 @@ set(viewer_HEADER_FILES llfloatercolorpicker.h llfloaterconversationlog.h llfloaterconversationpreview.h + llfloaterdeleteprefpreset.h llfloaterdeleteenvpreset.h llfloaterdestinations.h llfloaterdisplayname.h diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp new file mode 100644 index 0000000000..5dc51c4223 --- /dev/null +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -0,0 +1,80 @@ +/** + * @file llfloaterdeletprefpreset.cpp + * @brief Floater to delete 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 "llfloaterdeleteprefpreset.h" + +#include "llbutton.h" +#include "llcombobox.h" +#include "llpresetsmanager.h" + +LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key) +: LLFloater(key) +{ +} + +// virtual +BOOL LLFloaterDeletePrefPreset::postBuild() +{ + getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this)); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this)); + + return TRUE; +} + +void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) +{ + std::string param = key.asString(); + std::string floater_title = getString(std::string("title_") + param); + + setTitle(floater_title); + + LLComboBox* combo = getChild("preset_combo"); + + LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); +} + +void LLFloaterDeletePrefPreset::onBtnDelete() +{ + LLComboBox* combo = getChild("preset_combo"); + std::string name = combo->getSimple(); + + LLPresetsManager::getInstance()->deletePreset(name); +} + +void LLFloaterDeletePrefPreset::onPresetsListChange() +{ + LLComboBox* combo = getChild("preset_combo"); + + LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); +} + +void LLFloaterDeletePrefPreset::onBtnCancel() +{ + closeFloater(); +} diff --git a/indra/newview/llfloaterdeleteprefpreset.h b/indra/newview/llfloaterdeleteprefpreset.h new file mode 100644 index 0000000000..fc531ca1b7 --- /dev/null +++ b/indra/newview/llfloaterdeleteprefpreset.h @@ -0,0 +1,51 @@ +/** + * @file llfloaterdeleteprefpreset.h + * @brief Floater to delete 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_LLFLOATERDELETPREFPRESET_H +#define LL_LLFLOATERDELETEPREFPRESET_H + +#include "llfloater.h" + +class LLComboBox; + +class LLFloaterDeletePrefPreset : public LLFloater +{ + +public: + LLFloaterDeletePrefPreset(const LLSD &key); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + + void onBtnDelete(); + void onBtnCancel(); + +private: + void onPresetsListChange(); +}; + +#endif // LL_LLFLOATERDELETEPREFPRESET_H diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index e8590fc9dc..6b798f6549 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -110,6 +110,7 @@ #include "llsdserialize.h" #include "llpresetsmanager.h" #include "llviewercontrol.h" +#include "llpresetsmanager.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -743,7 +744,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) saveSettings(); // Make sure there is a default preference file - std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, PRESETS_GRAPHIC_DIR, "default.xml"); + std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, PRESETS_GRAPHIC, "default.xml"); if (!gDirUtilp->fileExists(default_file)) { LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL; @@ -1881,6 +1882,7 @@ 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)); } //virtual @@ -2078,6 +2080,11 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) } } +void LLPanelPreference::onDeletePreset() +{ + LLFloaterReg::showInstance("delete_pref_preset", PRESETS_GRAPHIC); +} + void LLPanelPreference::onChangePreset() { LLComboBox* combo = getChild("graphic_preset_combo"); @@ -2135,9 +2142,9 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { LLComboBox* combo = getChild("graphic_preset_combo"); - combo->setLabel(getString("graphic_preset_combo_label")); + combo->setLabel(LLTrans::getString("preset_combo_label")); - setPresetNamesInCombobox(); + setPresetNamesInComboBox(); LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); @@ -2146,31 +2153,14 @@ BOOL LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::onPresetsListChange() { - setPresetNamesInCombobox(); + setPresetNamesInComboBox(); } -void LLPanelPreferenceGraphics::setPresetNamesInCombobox() +void LLPanelPreferenceGraphics::setPresetNamesInComboBox() { LLComboBox* combo = getChild("graphic_preset_combo"); - combo->clearRows(); - - std::string presets_dir = LLPresetsManager::getGraphicPresetsDir(); - if (!presets_dir.empty()) - { - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir); - std::list preset_names; - LLPresetsManager::getInstance()->getPresetNames(preset_names); - - 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 { - LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; - } + LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); } void LLPanelPreferenceGraphics::draw() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 66442a0b51..be228c8625 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -221,6 +221,7 @@ public: // cancel() can restore them. virtual void saveSettings(); + void onDeletePreset(); void onChangePreset(); class Updater; @@ -250,7 +251,7 @@ public: void cancel(); void saveSettings(); void setHardwareDefaults(); - void setPresetNamesInCombobox(); + void setPresetNamesInComboBox(); static const std::string getPresetsPath(); protected: diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index d93afd674c..fc459a27e7 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -1,11 +1,10 @@ /** * @file llpanelpresetspulldown.cpp - * @author Tofu Linden * @brief A panel showing a quick way to pick presets * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * 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 @@ -29,11 +28,9 @@ #include "llpanelpresetspulldown.h" -// Viewer libs #include "llviewercontrol.h" #include "llstatusbar.h" -// Linden libs #include "llbutton.h" #include "lltabcontainer.h" #include "llfloaterreg.h" @@ -102,8 +99,7 @@ void LLPanelPresetsPulldown::onMoveViewButtonClick(const LLSD& user_data) setVisible(FALSE); // bring up the prefs floater - LLFloaterPreference* prefsfloater = dynamic_cast - (LLFloaterReg::showInstance("preferences")); + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); if (prefsfloater) { // grab the 'move' panel from the preferences floater and @@ -123,8 +119,7 @@ void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data) setVisible(FALSE); // bring up the prefs floater - LLFloaterPreference* prefsfloater = dynamic_cast - (LLFloaterReg::showInstance("preferences")); + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); if (prefsfloater) { // grab the 'graphics' panel from the preferences floater and diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h index 400dd73a4c..0cabf4aaad 100644 --- a/indra/newview/llpanelpresetspulldown.h +++ b/indra/newview/llpanelpresetspulldown.h @@ -1,11 +1,10 @@ /** * @file llpanelpresetspulldown.h - * @author Tofu Linden * @brief A panel showing a quick way to pick presets * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * 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 diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 642d9819fe..6b0023d97a 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -31,7 +31,9 @@ #include "llpresetsmanager.h" #include "lldiriterator.h" +#include "llfloater.h" #include "llsdserialize.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -64,12 +66,12 @@ std::string LLPresetsManager::getUserDir(const std::string& subdirectory) std::string LLPresetsManager::getCameraPresetsDir() { - return getUserDir(PRESETS_CAMERA_DIR); + return getUserDir(PRESETS_CAMERA); } std::string LLPresetsManager::getGraphicPresetsDir() { - return getUserDir(PRESETS_GRAPHIC_DIR); + return getUserDir(PRESETS_GRAPHIC); } void LLPresetsManager::getPresetNames(preset_name_list_t& presets) const @@ -164,7 +166,7 @@ void LLPresetsManager::savePreset(const std::string& name) paramsData[ctrl_name]["Value"] = value; } - std::string pathName(getUserDir(PRESETS_GRAPHIC_DIR) + "\\" + LLURI::escape(name) + ".xml"); + std::string pathName(getUserDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); // write to file llofstream presetsXML(pathName); @@ -176,14 +178,40 @@ void LLPresetsManager::savePreset(const std::string& name) mPresetListChangeSignal(); } +void LLPresetsManager::setPresetNamesInComboBox(LLComboBox* combo) +{ + combo->clearRows(); + + std::string presets_dir = getGraphicPresetsDir(); + + if (!presets_dir.empty()) + { + loadPresetNamesFromDir(presets_dir); + std::list preset_names; + getPresetNames(preset_names); + + combo->setLabel(LLTrans::getString("preset_combo_label")); + + 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 + { + LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; + } +} + void LLPresetsManager::loadPreset(const std::string& name) { - std::string pathName(getUserDir(PRESETS_GRAPHIC_DIR) + "\\" + LLURI::escape(name) + ".xml"); + std::string pathName(getUserDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); gSavedSettings.loadFromFile(pathName, false, true); } -bool LLPresetsManager::removeParamSet(const std::string& name, bool delete_from_disk) +bool LLPresetsManager::deletePreset(const std::string& name) { // remove from param list preset_name_list_t::iterator it = find(mPresetNames.begin(), mPresetNames.end(), name); @@ -193,15 +221,14 @@ bool LLPresetsManager::removeParamSet(const std::string& name, bool delete_from_ return false; } - mPresetNames.erase(it); - - // remove from file system if requested - if (delete_from_disk) + // (*TODO Should the name be escaped here? + if (gDirUtilp->deleteFilesInDir(getUserDir(PRESETS_GRAPHIC), name + ".xml") < 1) { - if (gDirUtilp->deleteFilesInDir(getUserDir(PRESETS_GRAPHIC_DIR), LLURI::escape(name) + ".xml") < 1) - { - LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; - } + LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; + } + else + { + mPresetNames.erase(it); } // signal interested parties diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 9b0de887ce..128c5850f2 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -27,12 +27,14 @@ #ifndef LL_PRESETSMANAGER_H #define LL_PRESETSMANAGER_H +#include "llcombobox.h" + #include #include static const std::string PRESETS_DIR = "presets"; -static const std::string PRESETS_GRAPHIC_DIR = "graphic"; -static const std::string PRESETS_CAMERA_DIR = "camera"; +static const std::string PRESETS_GRAPHIC = "graphic"; +static const std::string PRESETS_CAMERA = "camera"; class LLPresetsManager : public LLSingleton { @@ -40,13 +42,14 @@ public: typedef std::list preset_name_list_t; typedef boost::signals2::signal preset_list_signal_t; + void setPresetNamesInComboBox(LLComboBox* combo); void getPresetNames(preset_name_list_t& presets) const; void loadPresetNamesFromDir(const std::string& dir); void savePreset(const std::string & name); void loadPreset(const std::string & name); static std::string getCameraPresetsDir(); static std::string getGraphicPresetsDir(); - bool removeParamSet(const std::string& name, bool delete_from_disk); + bool deletePreset(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 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); diff --git a/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml new file mode 100644 index 0000000000..03c5a412b6 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml @@ -0,0 +1,49 @@ + + + + Delete Graphic Preset + Delete Camera Preset + + + Preset: + + + Loading... - + + + -None saved yet- + -- cgit v1.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/llfloaterdeleteprefpreset.cpp | 18 +++++---- indra/newview/llfloaterpreference.cpp | 17 ++++----- indra/newview/llfloaterpreference.h | 2 +- indra/newview/llfloatersaveprefpreset.cpp | 6 ++- indra/newview/llpanelpresetspulldown.cpp | 4 ++ indra/newview/llpresetsmanager.cpp | 43 +++++++++++++++++++--- indra/newview/llpresetsmanager.h | 14 ++++++- .../default/xui/en/panel_preferences_graphics1.xml | 4 +- 8 files changed, 77 insertions(+), 31 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 74f8805d03..50abf1038b 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -58,7 +58,8 @@ void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) LLComboBox* combo = getChild("preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo); + EDefaultOptions option = DEFAULT_HIDE; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterDeletePrefPreset::onBtnDelete() @@ -66,19 +67,20 @@ void LLFloaterDeletePrefPreset::onBtnDelete() LLComboBox* combo = getChild("preset_combo"); std::string name = combo->getSimple(); - // Ignore return status - LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name); - - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetDeleted", args); + if (LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetDeleted", args); + } } void LLFloaterDeletePrefPreset::onPresetsListChange() { LLComboBox* combo = getChild("preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo); + EDefaultOptions option = DEFAULT_HIDE; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterDeletePrefPreset::onBtnCancel() diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 521cc59dda..97af9d6ce0 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -744,15 +744,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) saveSettings(); // Make sure there is a default preference file - std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, PRESETS_GRAPHIC, "default.xml"); - if (!gDirUtilp->fileExists(default_file)) - { - 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 - // when changing languages. - LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, "Default"); - } + LLPresetsManager::getInstance()->createMissingDefault(); bool started = (LLStartUp::getStartupState() == STATE_STARTED); @@ -2121,6 +2113,10 @@ void LLPanelPreference::onChangePreset(const LLSD& user_data) } } +void LLPanelPreference::setHardwareDefaults() +{ +} + class LLPanelPreferencePrivacy : public LLPanelPreference { public: @@ -2183,7 +2179,8 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox() { LLComboBox* combo = getChild("graphic_preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo); + EDefaultOptions option = DEFAULT_POSITION_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option); } void LLPanelPreferenceGraphics::draw() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 5452dc6442..99d133c1ac 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -211,7 +211,7 @@ public: virtual void apply(); virtual void cancel(); void setControlFalse(const LLSD& user_data); - virtual void setHardwareDefaults(){}; + virtual void setHardwareDefaults(); // Disables "Allow Media to auto play" check box only when both // "Streaming Music" and "Media" are unchecked. Otherwise enables it. 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() diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index fc459a27e7..977e9ff5e2 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -35,6 +35,7 @@ #include "lltabcontainer.h" #include "llfloaterreg.h" #include "llfloaterpreference.h" +#include "llpresetsmanager.h" #include "llsliderctrl.h" /* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f; @@ -56,6 +57,9 @@ LLPanelPresetsPulldown::LLPanelPresetsPulldown() BOOL LLPanelPresetsPulldown::postBuild() { + // Make sure there is a default preference file + LLPresetsManager::getInstance()->createMissingDefault(); + return LLPanel::postBuild(); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index f6f2275da9..b9497efde6 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -45,7 +45,19 @@ LLPresetsManager::~LLPresetsManager() { } -//std::string LLPresetsManager::getUserDir(const std::string& subdirectory) +void LLPresetsManager::createMissingDefault() +{ + std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, PRESETS_GRAPHIC, "default.xml"); + if (!gDirUtilp->fileExists(default_file)) + { + 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 + // when changing languages. + LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); + } +} + std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) { std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR); @@ -65,7 +77,7 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) return full_path; } -void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets) +void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option) { LL_INFOS("AppInit") << "Loading presets from " << dir << LL_ENDL; @@ -82,13 +94,26 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam { std::string path = gDirUtilp->add(dir, file); std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); - if ("Default" != name) + if (PRESETS_DEFAULT != name) { mPresetNames.push_back(name); } else { - mPresetNames.insert(mPresetNames.begin(), name); + switch (default_option) + { + case DEFAULT_POSITION_TOP: + mPresetNames.insert(mPresetNames.begin(), name); + break; + + case DEFAULT_POSITION_NORMAL: + mPresetNames.push_back(name); + break; + + case DEFAULT_HIDE: + default: + break; + } } } } @@ -177,7 +202,7 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st mPresetListChangeSignal(); } -void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo) +void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) { combo->clearRows(); @@ -186,7 +211,7 @@ void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, if (!presets_dir.empty()) { std::list preset_names; - loadPresetNamesFromDir(presets_dir, preset_names); + loadPresetNamesFromDir(presets_dir, preset_names, default_option); if (preset_names.begin() != preset_names.end()) { @@ -212,6 +237,12 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name) { + if (PRESETS_DEFAULT == name) + { + LL_WARNS("Presets") << "You are not allowed to delete the default preset." << LL_ENDL; + return false; + } + if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) { LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 878116e5aa..1bac2c65e1 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -32,19 +32,29 @@ #include #include +static const std::string PRESETS_DEFAULT = "Default"; static const std::string PRESETS_DIR = "presets"; static const std::string PRESETS_GRAPHIC = "graphic"; static const std::string PRESETS_CAMERA = "camera"; +enum EDefaultOptions +{ + DEFAULT_POSITION_TOP, // Put "Default" as the first item in the combobox + DEFAULT_POSITION_NORMAL, // No special positioning + DEFAULT_HIDE // Do not display "Default" in the combobox +}; + class LLPresetsManager : public LLSingleton { public: + typedef std::list preset_name_list_t; typedef boost::signals2::signal preset_list_signal_t; + void createMissingDefault(); static std::string getPresetsDir(const std::string& subdirectory); - void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo); - void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets); + void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); + void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option); void savePreset(const std::string& subdirectory, const std::string & name); void loadPreset(const std::string& subdirectory, const std::string & name); bool deletePreset(const std::string& subdirectory, const std::string& name); 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 32de123895..4248de4d96 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -962,9 +962,9 @@ diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml index 697bfd58e7..652d85656c 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml @@ -12,29 +12,60 @@ layout="topleft" name="presets_pulldown" width="225"> - Graphic Presets + + + + + + + -- cgit v1.3 From afd12a6e784574e69ef3b3e7cac14573fe7c3197 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 3 Dec 2014 09:38:10 -0500 Subject: STORM-2082 Send signal to pulldown panel to refresh itself --- indra/newview/llpanelpresetspulldown.cpp | 2 -- indra/newview/llpresetsmanager.cpp | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index cd049712e1..093b5caad9 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -150,8 +150,6 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) instance->refreshEnabledGraphics(); } setVisible(FALSE); - // This line shouldn't be necessary but it is. - populatePanel(); } } } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index ddcd54162c..260f2c9547 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -242,6 +242,9 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); gSavedSettings.loadFromFile(full_path, false, true); + + // signal interested parties + mPresetListChangeSignal(); } bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name) -- cgit v1.3 From 5be238b127ff30f09105ad6f0d9b8ee3dec8b40f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 4 Dec 2014 14:27:15 -0500 Subject: STORM-2082 Revert name of Reset button from Undo back to Reset. Hopefully this will be renamed Recommended Settings. Display a test icon (artwork needed) in the pulldown panel --- indra/newview/llfloaterpreference.cpp | 8 -------- indra/newview/llpanelpresetspulldown.cpp | 5 +++-- indra/newview/llpresetsmanager.h | 1 - .../skins/default/xui/en/panel_preferences_graphics1.xml | 16 ++-------------- .../skins/default/xui/en/panel_presets_pulldown.xml | 8 +++----- 5 files changed, 8 insertions(+), 30 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7b9c4c3035..7b252ebd4f 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -342,7 +342,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this)); mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); - mCommitCallbackRegistrar.add("Pref.Recommended", boost::bind(&LLFloaterPreference::setRecommended, this)); mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); @@ -798,13 +797,6 @@ void LLFloaterPreference::setHardwareDefaults() if (panel) panel->setHardwareDefaults(); } -} - -void LLFloaterPreference::setRecommended() -{ - LLFeatureManager::getInstance()->applyRecommendedSettings(); - - refreshEnabledGraphics(); LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); } diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 093b5caad9..1918623cab 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -89,8 +89,9 @@ void LLPanelPresetsPulldown::populatePanel() if (name == gSavedSettings.getString("PresetGraphicActive")) { - row["columns"][1]["column"] = "active_name"; - row["columns"][1]["value"] = "X"; + row["columns"][1]["column"] = "icon"; + row["columns"][1]["type"] = "icon"; + row["columns"][1]["value"] = "Inv_Landmark"; } scroll->addElement(row); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 1bac2c65e1..d7d84b5746 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -64,7 +64,6 @@ public: preset_name_list_t mPresetNames; -//protected: LLPresetsManager(); ~LLPresetsManager(); 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 6df4a4f2ea..24f3dd803f 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -37,7 +37,7 @@ - - + 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 d1bc2fe292edcea60b49ce8111a495974e9415a2 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 14 Jan 2015 19:55:58 -0500 Subject: STORM-2082 Assorted UI tweaks, better MaximumARC formula, pulldowns disappear faster --- indra/newview/llfloaterpreference.cpp | 54 ++++++++------ indra/newview/llfloaterpreference.h | 1 + indra/newview/llpanelnearbymedia.cpp | 6 +- indra/newview/llpanelpresetspulldown.cpp | 8 +- indra/newview/llpanelvolumepulldown.cpp | 4 +- indra/newview/llpresetsmanager.cpp | 14 ++-- indra/newview/llpresetsmanager.h | 1 + .../default/xui/en/panel_preferences_graphics1.xml | 86 +++++++++++++--------- 8 files changed, 97 insertions(+), 77 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6e340864bc..4b83b104fd 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1475,7 +1475,7 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); - updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); + updateMaximumArcText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1731,8 +1731,6 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b { if (text_box == NULL || ctrl== NULL) return; - - std::string name = ctrl->getName(); // get range and points when text should change F32 value = (F32)ctrl->getValue().asReal(); @@ -1756,35 +1754,43 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b { text_box->setText(LLTrans::getString("GraphicsQualityHigh")); } +} + +void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + F32 min_result = 20000.0f; + F32 max_result = 300000.0f; - if ("MaximumARC" == name) + F32 value = (F32)ctrl->getValue().asReal(); + + if (0.0f == value) + { + text_box->setText(LLTrans::getString("Off")); + } + else { - F32 control_value = value; - if (0.0f == control_value) - { - text_box->setText(LLTrans::getString("Off")); - } - else - { - // 100 is the maximum value of this control set in panel_preferences_graphics1.xml - F32 minp = 0.0f; - F32 maxp = 100.0f; - // The result should be between 20,000 and 500,000 - F32 minv = log(20000.0f); - F32 maxv = log(500000.0f); + // Invert value because a higher value on the slider control needs a decreasing final + // value in order to obtain larger numbers of imposters + value = 100.0f - value; - // calculate adjustment factor - F32 scale = (maxv - minv) / (maxp - minp); + // 100 is the maximum value of this control set in panel_preferences_graphics1.xml + F32 minp = 0.0f; + F32 maxp = 99.0f; - control_value = exp(minv + scale * (control_value - minp)); + // The result should be between min_result and max_result + F32 minv = log(min_result); + F32 maxv = log(max_result); - // Invert result - control_value = 500000.0f - control_value; - } + // calculate adjustment factor + F32 scale = (maxv - minv) / (maxp - minp); - gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)control_value); + value = exp(minv + scale * (value - minp)); + + text_box->setText(llformat("%0.0f", value)); } + + gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)value); } void LLFloaterPreference::onChangeMaturity() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index f6b5f5229d..98b05cca03 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -157,6 +157,7 @@ public: void onChangeQuality(const LLSD& data); void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box); void refreshUI(); void onCommitParcelMediaAutoPlayEnable(); diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 1cdd1b664e..737ae2e32d 100755 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -65,6 +65,9 @@ extern LLControlGroup gSavedSettings; static const LLUUID PARCEL_MEDIA_LIST_ITEM_UUID = LLUUID("CAB5920F-E484-4233-8621-384CF373A321"); static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5D-CA970D694822"); +const F32 AUTO_CLOSE_FADE_TIME_START= 2.0f; +const F32 AUTO_CLOSE_FADE_TIME_END = 3.0f; + // // LLPanelNearByMedia // @@ -227,9 +230,6 @@ void LLPanelNearByMedia::reshape(S32 width, S32 height, BOOL called_from_parent) } -const F32 AUTO_CLOSE_FADE_TIME_START= 4.0f; -const F32 AUTO_CLOSE_FADE_TIME_END = 5.0f; - /*virtual*/ void LLPanelNearByMedia::draw() { diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 4756f3bd75..66f2f4c3f3 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -39,8 +39,8 @@ #include "llsliderctrl.h" #include "llscrolllistctrl.h" -/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f; -/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 5.0f; +/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 2.0f; +/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 3.0f; ///---------------------------------------------------------------------------- /// Class LLPanelPresetsPulldown @@ -71,7 +71,7 @@ BOOL LLPanelPresetsPulldown::postBuild() void LLPanelPresetsPulldown::populatePanel() { std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_SHOW); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); LLScrollListCtrl* scroll = getChild("preset_list"); @@ -91,7 +91,7 @@ void LLPanelPresetsPulldown::populatePanel() { row["columns"][1]["column"] = "icon"; row["columns"][1]["type"] = "icon"; - row["columns"][1]["value"] = "Inv_Landmark"; + row["columns"][1]["value"] = "Checkbox_On"; } scroll->addElement(row); diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp index cb00f742cc..6595da235c 100755 --- a/indra/newview/llpanelvolumepulldown.cpp +++ b/indra/newview/llpanelvolumepulldown.cpp @@ -40,8 +40,8 @@ #include "llfloaterpreference.h" #include "llsliderctrl.h" -/* static */ const F32 LLPanelVolumePulldown::sAutoCloseFadeStartTimeSec = 4.0f; -/* static */ const F32 LLPanelVolumePulldown::sAutoCloseTotalTimeSec = 5.0f; +/* static */ const F32 LLPanelVolumePulldown::sAutoCloseFadeStartTimeSec = 2.0f; +/* static */ const F32 LLPanelVolumePulldown::sAutoCloseTotalTimeSec = 3.0f; ///---------------------------------------------------------------------------- /// Class LLPanelVolumePulldown diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 36a82db916..67d06ff5dd 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -106,14 +106,8 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam // 2 - Possibly hide the default preset if (PRESETS_DEFAULT != name) { - if (name != gSavedSettings.getString("PresetGraphicActive")) - { - mPresetNames.push_back(name); - } - else - { - mPresetNames.insert(mPresetNames.begin(), name); - } + mPresetNames.push_back(name); + } else { @@ -123,6 +117,10 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); break; + case DEFAULT_TOP: + mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT)); + break; + case DEFAULT_HIDE: default: break; diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index bf6a531d48..e9ed164322 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -40,6 +40,7 @@ static const std::string PRESETS_CAMERA = "camera"; enum EDefaultOptions { DEFAULT_SHOW, + DEFAULT_TOP, DEFAULT_HIDE // Do not display "Default" in a list }; 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 40b359eb1d..c540000489 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -244,7 +244,6 @@ top_delta="25" width="517"> - + + + + + @@ -457,40 +471,6 @@ Low - - - - - Low - - + + + + + Low + + Date: Thu, 15 Jan 2015 16:43:43 -0500 Subject: STORM-2082 Use correct icon for checkmark Redo UI layout to indicate the two dependencies on the Imposters checkbox Reverse the ARC slider --- indra/newview/llfloaterpreference.cpp | 27 +++++++-- indra/newview/llfloaterpreference.h | 2 + indra/newview/llpanelpresetspulldown.cpp | 2 +- .../default/xui/en/panel_preferences_graphics1.xml | 70 ++++++++++++---------- 4 files changed, 61 insertions(+), 40 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 4b83b104fd..cb59cc27d7 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -341,6 +341,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); + mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); @@ -748,6 +749,11 @@ void LLFloaterPreference::onVertexShaderEnable() refreshEnabledGraphics(); } +void LLFloaterPreference::onAvatarImpostorsEnable() +{ + refreshEnabledGraphics(); +} + //static void LLFloaterPreference::initDoNotDisturbResponse() { @@ -1223,6 +1229,13 @@ void LLFloaterPreference::refreshEnabledState() ctrl_shadow->setEnabled(enabled); shadow_text->setEnabled(enabled); + LLTextBox* maximum_arc_text = getChild("MaximumARCText"); + + enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors") && gSavedSettings.getBOOL("RenderUseImpostors"); + getChildView("MaximumARC")->setEnabled(enabled); + maximum_arc_text->setEnabled(enabled); + getChildView("MaxNumberAvatarDrawn")->setEnabled(enabled); + // Hardware settings F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); @@ -1297,6 +1310,9 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); LLCheckBoxCtrl* ctrl_avatar_impostors = getChild("AvatarImpostors"); + LLSliderCtrl* ctrl_maximum_arc = getChild("MaximumARC"); + LLTextBox* maximum_arc_text = getChild("MaximumARCText"); + LLSliderCtrl* ctrl_max_visible = getChild("MaxNumberAvatarDrawn"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); LLComboBox* ctrl_shadows = getChild("ShadowDetail"); @@ -1451,6 +1467,9 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_avatar_impostors->setEnabled(FALSE); ctrl_avatar_impostors->setValue(FALSE); + ctrl_maximum_arc->setEnabled(FALSE); + maximum_arc_text->setEnabled(FALSE); + ctrl_max_visible->setEnabled(FALSE); } } @@ -1770,13 +1789,9 @@ void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* te else { - // Invert value because a higher value on the slider control needs a decreasing final - // value in order to obtain larger numbers of imposters - value = 100.0f - value; - // 100 is the maximum value of this control set in panel_preferences_graphics1.xml - F32 minp = 0.0f; - F32 maxp = 99.0f; + F32 minp = 1.0f; + F32 maxp = 100.0f; // The result should be between min_result and max_result F32 minv = log(min_result); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 98b05cca03..96d026277f 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -116,6 +116,8 @@ protected: void setRecommended(); // callback for when client turns on shaders void onVertexShaderEnable(); + // callback for when client turns on impostors + void onAvatarImpostorsEnable(); // callback for commit in the "Single click on land" and "Double click on land" comboboxes. void onClickActionChange(); diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 66f2f4c3f3..2c5ae01b12 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -91,7 +91,7 @@ void LLPanelPresetsPulldown::populatePanel() { row["columns"][1]["column"] = "icon"; row["columns"][1]["type"] = "icon"; - row["columns"][1]["value"] = "Checkbox_On"; + row["columns"][1]["value"] = "Check_Mark"; } scroll->addElement(row); 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 888b86482a..983e0edb97 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -453,6 +453,20 @@ Avatar + + + + + width="280"> @@ -480,12 +494,30 @@ height="16" layout="topleft" top_delta="0" - left_delta="304" + left_delta="284" + text_readonly_color="LabelDisabledColor" name="MaximumARCText" width="128"> - Low + 0 + + - - - - Date: Tue, 20 Jan 2015 18:24:02 -0500 Subject: STORM-2082 Finally(?) deal properly with dirty UI processing. Code cleanup, some per bitbucket comments. --- indra/newview/llfloaterloadprefpreset.cpp | 5 --- indra/newview/llfloaterpreference.cpp | 43 ++++++++++++++-------- indra/newview/llfloaterpreference.h | 6 +-- indra/newview/llpanelpresetspulldown.cpp | 6 +-- indra/newview/llpresetsmanager.cpp | 14 ++++--- .../default/xui/en/panel_preferences_graphics1.xml | 12 +++--- 6 files changed, 45 insertions(+), 41 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp index 6ec2e5c09d..d831da43f5 100644 --- a/indra/newview/llfloaterloadprefpreset.cpp +++ b/indra/newview/llfloaterloadprefpreset.cpp @@ -82,11 +82,6 @@ void LLFloaterLoadPrefPreset::onBtnOk() 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/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 34c34ffd65..5938566b0a 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -735,9 +735,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) bool started = (LLStartUp::getStartupState() == STATE_STARTED); - LLButton* load_btn = findChild("PrefLoadButton"); - LLButton* save_btn = findChild("PrefSaveButton"); - LLButton* delete_btn = findChild("PrefDeleteButton"); + LLButton* load_btn = findChild("PrefLoadButton"); + LLButton* save_btn = findChild("PrefSaveButton"); + LLButton* delete_btn = findChild("PrefDeleteButton"); load_btn->setEnabled(started); save_btn->setEnabled(started); @@ -925,14 +925,12 @@ void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_ } } - void LLFloaterPreference::refreshEnabledGraphics() { LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance) { instance->refresh(); - //instance->refreshEnabledState(); } } @@ -1179,12 +1177,14 @@ 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); @@ -2002,9 +2002,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.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)); + 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 @@ -2202,19 +2202,19 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) } } -void LLPanelPreference::DeletePreset(const LLSD& user_data) +void LLPanelPreference::deletePreset(const LLSD& user_data) { std::string subdirectory = user_data.asString(); LLFloaterReg::showInstance("delete_pref_preset", subdirectory); } -void LLPanelPreference::SavePreset(const LLSD& user_data) +void LLPanelPreference::savePreset(const LLSD& user_data) { std::string subdirectory = user_data.asString(); LLFloaterReg::showInstance("save_pref_preset", subdirectory); } -void LLPanelPreference::LoadPreset(const LLSD& user_data) +void LLPanelPreference::loadPreset(const LLSD& user_data) { std::string subdirectory = user_data.asString(); LLFloaterReg::showInstance("load_pref_preset", subdirectory); @@ -2303,16 +2303,17 @@ void LLPanelPreferenceGraphics::setPresetText() { LLTextBox* preset_text = getChild("preset_text"); - if (hasDirtyChilds()) + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + + if (hasDirtyChilds() && !preset_graphic_active.empty()) { gSavedSettings.setString("PresetGraphicActive", ""); + preset_graphic_active.clear(); // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown // panel to update. LLPresetsManager::getInstance()->triggerChangeSignal(); } - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - if (!preset_graphic_active.empty()) { preset_text->setText(preset_graphic_active); @@ -2321,6 +2322,8 @@ void LLPanelPreferenceGraphics::setPresetText() { preset_text->setText(LLTrans::getString("none_paren_cap")); } + + preset_text->resetDirty(); } bool LLPanelPreferenceGraphics::hasDirtyChilds() @@ -2338,7 +2341,15 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds() { if (ctrl->isDirty()) { - return true; + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (!control_name.empty()) + { + return true; + } + } } } // Push children onto the end of the work stack @@ -2348,6 +2359,7 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds() view_stack.push_back(*iter); } } + return false; } @@ -2377,7 +2389,6 @@ void LLPanelPreferenceGraphics::resetDirtyChilds() void LLPanelPreferenceGraphics::cancel() { - resetDirtyChilds(); LLPanelPreference::cancel(); } void LLPanelPreferenceGraphics::saveSettings() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index bb6e848178..2810a1008b 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -222,9 +222,9 @@ public: // cancel() can restore them. virtual void saveSettings(); - void DeletePreset(const LLSD& user_data); - void SavePreset(const LLSD& user_data); - void LoadPreset(const LLSD& user_data); + void deletePreset(const LLSD& user_data); + void savePreset(const LLSD& user_data); + void loadPreset(const LLSD& user_data); class Updater; diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 2c5ae01b12..ceff5a54e8 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -145,11 +145,7 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) std::string name = item->getColumn(1)->getValue().asString(); LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refreshEnabledGraphics(); - } + setVisible(FALSE); } } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index a08f77eeb1..e67ebcc0c6 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -58,9 +58,8 @@ void LLPresetsManager::createMissingDefault() if (!gDirUtilp->fileExists(default_file)) { LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL; + // Write current graphic settings to default.xml - // *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()) @@ -106,13 +105,10 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam { std::string path = gDirUtilp->add(dir, file); std::string name = gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true); - // Two things are happening here: - // 1 - Always put the active preset at the top of the list - // 2 - Possibly hide the default preset + if (PRESETS_DEFAULT != name) { mPresetNames.push_back(name); - } else { @@ -245,6 +241,12 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st { gSavedSettings.setString("PresetGraphicActive", name); } + + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } triggerChangeSignal(); } } 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 6bc549ce94..ae44d03cb3 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -51,7 +51,7 @@