From b92dd27878c73d23dec9859b317babfde749b33b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 23 Nov 2014 12:11:51 -0500 Subject: STORM-2082 Allow saving and loading of graphic settings --- indra/newview/llfloaterpreference.cpp | 43 +++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d3773767d0..3b64ffcf4c 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1099,8 +1099,7 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { - LLComboBox* ctrl_reflections = getChild("Reflections"); - LLRadioGroup* radio_reflection_detail = getChild("ReflectionDetailRadio"); + LLUICtrl* ctrl_reflections = getChild("Reflections"); // Reflections BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") @@ -1113,8 +1112,6 @@ void LLFloaterPreference::refreshEnabledState() bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); - radio_reflection_detail->setEnabled(reflections); - // Avatar Mode // Enable Avatar Shaders LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); @@ -1143,20 +1140,19 @@ void LLFloaterPreference::refreshEnabledState() // Vertex Shaders // Global Shader Enable LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - // radio set for terrain detail mode - LLRadioGroup* mRadioTerrainDetail = getChild("TerrainDetailRadio"); // can be linked with control var + LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); BOOL shaders = ctrl_shader_enable->get(); if (shaders) { - mRadioTerrainDetail->setValue(1); - mRadioTerrainDetail->setEnabled(FALSE); + terrain_detail->setValue(1); + terrain_detail->setEnabled(FALSE); } else { - mRadioTerrainDetail->setEnabled(TRUE); + terrain_detail->setEnabled(TRUE); } // WindLight @@ -1209,7 +1205,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::disableUnavailableSettings() { - LLComboBox* ctrl_reflections = getChild("Reflections"); + LLUICtrl* ctrl_reflections = getChild("Reflections"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); @@ -1360,6 +1356,8 @@ void LLFloaterPreference::refresh() { LLPanel::refresh(); + refreshEnabledState(); + // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes @@ -1372,8 +1370,9 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); - - refreshEnabledState(); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + updateReflectionsText(getChild("Reflections", true), getChild("ReflectionsText", true)); + updateRenderShadowDetailText(getChild("RenderShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1625,6 +1624,23 @@ void LLFloaterPreference::refreshUI() refresh(); } +void LLFloaterPreference::updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + if (text_box == NULL || ctrl== NULL) + return; + + U32 value = (U32)ctrl->getValue().asInteger(); + text_box->setText(getString("Reflections" + llformat("%d", value))); +} +void LLFloaterPreference::updateRenderShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + if (text_box == NULL || ctrl== NULL) + return; + + U32 value = (U32)ctrl->getValue().asInteger(); + text_box->setText(getString("RenderShadowDetail" + llformat("%d", value))); +} + void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) @@ -2093,6 +2109,9 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { + LLComboBox* graphic_preset = getChild("graphic_preset_combo"); + graphic_preset->setLabel(getString("graphic_preset_combo_label")); + return LLPanelPreference::postBuild(); } void LLPanelPreferenceGraphics::draw() -- cgit v1.2.3 From 78060b7fd2688b113917b58dea25b072779ac4f6 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 26 Nov 2014 16:28:11 -0500 Subject: STORM-2082 Start to convert code to support xml file processing --- indra/newview/llfloaterpreference.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 3b64ffcf4c..cea17aeef4 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -108,6 +108,7 @@ #include "lllogininstance.h" // to check if logged in yet #include "llsdserialize.h" +#include "llpresetsmanager.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -661,7 +662,7 @@ void LLFloaterPreference::cancel() void LLFloaterPreference::onOpen(const LLSD& key) { - + // this variable and if that follows it are used to properly handle do not disturb mode response message static bool initialized = FALSE; // if user is logged in and we haven't initialized do not disturb mode response yet, do it @@ -739,6 +740,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) // when the floater is opened. That will make cancel do its // job saveSettings(); + + // Make sure there is a default preference file + } void LLFloaterPreference::onVertexShaderEnable() @@ -1179,7 +1183,7 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLComboBox* ctrl_shadow = getChild("ShadowDetail"); + LLUICtrl* ctrl_shadow = getChild("ShadowDetail"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); @@ -1213,7 +1217,7 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_avatar_impostors = getChild("AvatarImpostors"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); - LLComboBox* ctrl_shadows = getChild("ShadowDetail"); + LLUICtrl* ctrl_shadows = getChild("ShadowDetail"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); @@ -1372,7 +1376,7 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); updateReflectionsText(getChild("Reflections", true), getChild("ReflectionsText", true)); - updateRenderShadowDetailText(getChild("RenderShadowDetail", true), getChild("RenderShadowDetailText", true)); + updateShadowDetailText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1632,7 +1636,7 @@ void LLFloaterPreference::updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* t U32 value = (U32)ctrl->getValue().asInteger(); text_box->setText(getString("Reflections" + llformat("%d", value))); } -void LLFloaterPreference::updateRenderShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreference::updateShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) return; @@ -2112,8 +2116,18 @@ BOOL LLPanelPreferenceGraphics::postBuild() LLComboBox* graphic_preset = getChild("graphic_preset_combo"); graphic_preset->setLabel(getString("graphic_preset_combo_label")); + std::string presets_dir = LLPresetsManager::getGraphicPresetsDir(); + if (!presets_dir.empty()) + { + LLPresetsManager::getInstance()->getPresetsFromDir(presets_dir); + } + else { + LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; + } + return LLPanelPreference::postBuild(); } + void LLPanelPreferenceGraphics::draw() { LLPanelPreference::draw(); -- cgit v1.2.3 From f71247ea542805819b82640759e1f44fd0599e7f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 26 Nov 2014 18:03:36 -0500 Subject: STORM-2082 Code now fills combobox --- indra/newview/llfloaterpreference.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index cea17aeef4..39f37f4e50 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2117,9 +2117,18 @@ BOOL LLPanelPreferenceGraphics::postBuild() graphic_preset->setLabel(getString("graphic_preset_combo_label")); std::string presets_dir = LLPresetsManager::getGraphicPresetsDir(); + if (!presets_dir.empty()) { - LLPresetsManager::getInstance()->getPresetsFromDir(presets_dir); + LLPresetsManager::getInstance()->loadPresetsFromDir(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; + graphic_preset->add(name, LLSD().with(0, name)); + } } else { LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; -- cgit v1.2.3 From f30e518f1774cc3c1b4641e97c26afa496fb85e5 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 27 Nov 2014 16:20:39 -0500 Subject: STORM-2082 Get writing out and loading presets working --- indra/newview/llfloaterpreference.cpp | 50 ++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 39f37f4e50..e8590fc9dc 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -109,6 +109,7 @@ #include "lllogininstance.h" // to check if logged in yet #include "llsdserialize.h" #include "llpresetsmanager.h" +#include "llviewercontrol.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -742,7 +743,13 @@ 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"); + if (!gDirUtilp->fileExists(default_file)) + { + LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL; + // Write current graphic settings to default.xml + LLPresetsManager::getInstance()->savePreset("Default"); + } } void LLFloaterPreference::onVertexShaderEnable() @@ -1873,6 +1880,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)); } //virtual @@ -2070,6 +2078,19 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) } } +void LLPanelPreference::onChangePreset() +{ + LLComboBox* combo = getChild("graphic_preset_combo"); + std::string name = combo->getSimple(); + + LLPresetsManager::getInstance()->loadPreset(name); + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } +} + class LLPanelPreferencePrivacy : public LLPanelPreference { public: @@ -2113,28 +2134,43 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { - LLComboBox* graphic_preset = getChild("graphic_preset_combo"); - graphic_preset->setLabel(getString("graphic_preset_combo_label")); + LLComboBox* combo = getChild("graphic_preset_combo"); + combo->setLabel(getString("graphic_preset_combo_label")); + + setPresetNamesInCombobox(); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); + + return LLPanelPreference::postBuild(); +} + +void LLPanelPreferenceGraphics::onPresetsListChange() +{ + setPresetNamesInCombobox(); +} + +void LLPanelPreferenceGraphics::setPresetNamesInCombobox() +{ + LLComboBox* combo = getChild("graphic_preset_combo"); + combo->clearRows(); std::string presets_dir = LLPresetsManager::getGraphicPresetsDir(); if (!presets_dir.empty()) { - LLPresetsManager::getInstance()->loadPresetsFromDir(presets_dir); + 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; - graphic_preset->add(name, LLSD().with(0, name)); + combo->add(name, LLSD().with(0, name)); } } else { LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; } - - return LLPanelPreference::postBuild(); } void LLPanelPreferenceGraphics::draw() -- cgit v1.2.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/llfloaterpreference.cpp | 36 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') 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() -- cgit v1.2.3 From 563e22e81c6bf14bca6370b098a257f94f4f843f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 30 Nov 2014 11:24:22 -0500 Subject: STORM-2082 Make code more generic to handle the future camera presets. --- indra/newview/llfloaterpreference.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6b798f6549..508d82522e 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -749,7 +749,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) { LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL; // Write current graphic settings to default.xml - LLPresetsManager::getInstance()->savePreset("Default"); + // 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"); } } @@ -2160,7 +2162,7 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox() { LLComboBox* combo = getChild("graphic_preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo); } void LLPanelPreferenceGraphics::draw() -- cgit v1.2.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/llfloaterpreference.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') 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) { -- cgit v1.2.3 From e510c786d9b5eea96b9331596c77a79b239de809 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 13:54:32 -0500 Subject: STORM-2082 Disable preset controls unless logged in --- indra/newview/llfloaterpreference.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 2e1e1ba318..521cc59dda 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -753,6 +753,16 @@ void LLFloaterPreference::onOpen(const LLSD& key) // when changing languages. LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, "Default"); } + + bool started = (LLStartUp::getStartupState() == STATE_STARTED); + + LLComboBox* combo = getChild("graphic_preset_combo"); + LLButton* save_btn = findChild("PrefSaveButton"); + LLButton* delete_btn = findChild("PrefDeleteButton"); + + combo->setEnabled(started); + save_btn->setEnabled(started); + delete_btn->setEnabled(started); } void LLFloaterPreference::onVertexShaderEnable() -- cgit v1.2.3 From 7360f046634d013fec1e9b37c60840a83b470ce1 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 15:36:59 -0500 Subject: STORM-2082 Better control on how (or if) to display Default preset Make sure default preset is created when flyout panel is activated Only display deleted notification upon successful deletion --- indra/newview/llfloaterpreference.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') 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() -- cgit v1.2.3 From ade3953e380d9211ad6d332b9b27fa23e57a7d81 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 2 Dec 2014 07:42:32 -0500 Subject: STORM-2082 Add Recommended button --- indra/newview/llfloaterpreference.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 97af9d6ce0..c80ec1a976 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -111,6 +111,7 @@ #include "llpresetsmanager.h" #include "llviewercontrol.h" #include "llpresetsmanager.h" +#include "llfeaturemanager.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -342,6 +343,7 @@ 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,6 +800,15 @@ void LLFloaterPreference::setHardwareDefaults() } } +void LLFloaterPreference::setRecommended() +{ + LLFeatureManager::getInstance()->applyRecommendedSettings(); + + refreshEnabledGraphics(); + + LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); +} + //virtual void LLFloaterPreference::onClose(bool app_quitting) { -- cgit v1.2.3 From cc22efa4c0d6b06bac6f49b6243df7726f89c7c4 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 3 Dec 2014 06:35:46 -0500 Subject: STORM-2082 Remove Apply button. Add new control variable to track which preset is active. Save settings to active preset when clicking on Ok button. Initial work to make pulldown operational. Still to do: add pretty icon for current preset. Notifications do not appear when called from this panel. --- indra/newview/llfloaterpreference.cpp | 39 ++++------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c80ec1a976..7b9c4c3035 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -325,7 +325,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) registered_dialog = true; } - mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this)); mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this)); @@ -788,6 +787,7 @@ void LLFloaterPreference::setHardwareDefaults() { LLFeatureManager::getInstance()->applyRecommendedSettings(); refreshEnabledGraphics(); + LLTabContainer* tabcontainer = getChild("pref core"); child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); child_list_t::const_iterator end = tabcontainer->getChildList()->end(); @@ -884,24 +884,11 @@ void LLFloaterPreference::onBtnOK() LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); pPathfindingConsole->onRegionBoundaryCross(); } - -} -// static -void LLFloaterPreference::onBtnApply( ) -{ - if (hasFocus()) + if (LLStartUp::getStartupState() == STATE_STARTED) { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } + LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, gSavedSettings.getString("PresetGraphicActive")); } - apply(); - saveSettings(); - - LLPanelLogin::updateLocationSelectorsVisibility(); } // static @@ -2115,7 +2102,6 @@ void LLPanelPreference::onChangePreset(const LLSD& user_data) LLComboBox* combo = getChild(subdirectory + "_preset_combo"); std::string name = combo->getSimple(); - LLPresetsManager::getInstance()->loadPreset(subdirectory, name); LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance) @@ -2194,19 +2180,6 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox() LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option); } -void LLPanelPreferenceGraphics::draw() -{ - LLPanelPreference::draw(); - - LLButton* button_apply = findChild("Apply"); - - if (button_apply && button_apply->getVisible()) - { - bool enable = hasDirtyChilds(); - - button_apply->setEnabled(enable); - } -} bool LLPanelPreferenceGraphics::hasDirtyChilds() { std::list view_stack; @@ -2256,11 +2229,7 @@ void LLPanelPreferenceGraphics::resetDirtyChilds() } } } -void LLPanelPreferenceGraphics::apply() -{ - resetDirtyChilds(); - LLPanelPreference::apply(); -} + void LLPanelPreferenceGraphics::cancel() { resetDirtyChilds(); -- cgit v1.2.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 -------- 1 file changed, 8 deletions(-) (limited to 'indra/newview/llfloaterpreference.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); } -- cgit v1.2.3 From 47282ceb7e8b8083cf816dd26bd4907aba313959 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 9 Dec 2014 16:48:00 -0500 Subject: STORM-2082 Improve file error handling, add help topic labels to new floaters. --- indra/newview/llfloaterpreference.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7b252ebd4f..e0c579f783 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -879,6 +879,9 @@ void LLFloaterPreference::onBtnOK() if (LLStartUp::getStartupState() == STATE_STARTED) { + // 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")); } } -- cgit v1.2.3 From 8d12072979ee46a1eb2d13fdfef8bef62ff3f619 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 12 Dec 2014 11:13:11 -0500 Subject: STORM-2082 Merge Hardware floater into main graphics preferences display Change notifications so they are emitted only when an error occurs Put active preset at top of list Add Maximum ARC slider Merge two small methods into slider update code --- indra/newview/llfloaterpreference.cpp | 168 +++++++++++++++++++++++----------- 1 file changed, 116 insertions(+), 52 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index e0c579f783..c7b4ae8ddc 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -48,7 +48,6 @@ //#include "llfirstuse.h" #include "llfloaterreg.h" #include "llfloaterabout.h" -#include "llfloaterhardwaresettings.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterimsession.h" #include "llkeyboard.h" @@ -112,6 +111,7 @@ #include "llviewercontrol.h" #include "llpresetsmanager.h" #include "llfeaturemanager.h" +#include "llviewertexturelist.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -549,12 +549,6 @@ void LLFloaterPreference::apply() if (panel) panel->apply(); } - // hardware menu apply - LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); - if (hardware_settings) - { - hardware_settings->apply(); - } gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor @@ -632,13 +626,6 @@ void LLFloaterPreference::cancel() // hide spellchecker settings folder LLFloaterReg::hideInstance("prefs_spellchecker"); - // cancel hardware menu - LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); - if (hardware_settings) - { - hardware_settings->cancel(); - } - // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); @@ -921,11 +908,6 @@ void LLFloaterPreference::refreshEnabledGraphics() instance->refresh(); //instance->refreshEnabledState(); } - LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); - if (hardware_settings) - { - hardware_settings->refreshEnabledState(); - } } void LLFloaterPreference::onClickClearCache() @@ -1201,7 +1183,61 @@ void LLFloaterPreference::refreshEnabledState() enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); ctrl_shadow->setEnabled(enabled); - + + // Hardware settings + F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); + S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); + getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); + getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("vbo")->setEnabled(FALSE); + } + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("texture compression")->setEnabled(FALSE); + } + + // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance + LLUICtrl* gamma_ctrl = getChild("gamma"); + gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); + + /* Disabling this block of code because canUseAntiAliasing currently always returns true + // anti-aliasing + LLComboBox* fsaa_ctrl = getChild("fsaa"); + LLTextBox* fsaa_text = getChild("antialiasing label"); + LLTextBox* fsaa_restart = getChild("antialiasing restart"); + + // Enable or disable the control, the "Antialiasing:" label and the restart warning + // based on code support for the feature on the current hardware. + + if (gPipeline.canUseAntiAliasing()) + { + fsaa_ctrl->setEnabled(TRUE); + + LLColor4 color = LLUIColorTable::instance().getColor("LabelTextColor"); + fsaa_text->setColor(color); + + fsaa_restart->setVisible(!gSavedSettings.getBOOL("RenderDeferred")); + } + else + { + fsaa_ctrl->setEnabled(FALSE); + fsaa_ctrl->setValue((LLSD::Integer) 0); + + LLColor4 color = LLUIColorTable::instance().getColor("LabelDisabledColor"); + fsaa_text->setColor(color); + + fsaa_restart->setVisible(FALSE); + } + */ // now turn off any features that are unavailable disableUnavailableSettings(); @@ -1365,23 +1401,26 @@ void LLFloaterPreference::refresh() { LLPanel::refresh(); + getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); + refreshEnabledState(); // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes - updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); - 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)); - updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); - updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); - updateReflectionsText(getChild("Reflections", true), getChild("ReflectionsText", true)); - updateShadowDetailText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true), "ObjectMeshDetail"); + updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true), "FlexibleMeshDetail"); + updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true), "TreeMeshDetail"); + updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true), "AvatarMeshDetail"); + updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true), "AvatarMeshDetail2"); + updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true), "AvatarPhysicsDetail"); + updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true), "TerrainMeshDetail"); + updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true), "RenderPostProcess"); + updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true), "SkyMeshDetail"); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true), "TerrainDetail"); + updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true), "MaximumARC"); + updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true), "Reflections"); + updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true), "ShadowDetail"); } void LLFloaterPreference::onCommitWindowedMode() @@ -1633,24 +1672,7 @@ void LLFloaterPreference::refreshUI() refresh(); } -void LLFloaterPreference::updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* text_box) -{ - if (text_box == NULL || ctrl== NULL) - return; - - U32 value = (U32)ctrl->getValue().asInteger(); - text_box->setText(getString("Reflections" + llformat("%d", value))); -} -void LLFloaterPreference::updateShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box) -{ - if (text_box == NULL || ctrl== NULL) - return; - - U32 value = (U32)ctrl->getValue().asInteger(); - text_box->setText(getString("RenderShadowDetail" + llformat("%d", value))); -} - -void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box, const std::string& name) { if (text_box == NULL || ctrl== NULL) return; @@ -1663,7 +1685,21 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b llassert(range > 0); F32 midPoint = min + range / 3.0f; F32 highPoint = min + (2.0f * range / 3.0f); - + + if ("ShadowDetail" == name) + { + U32 value = (U32)ctrl->getValue().asInteger(); + text_box->setText(getString("RenderShadowDetail" + llformat("%d", value))); + return; + } + + if ("Reflections" == name) + { + U32 value = (U32)ctrl->getValue().asInteger(); + text_box->setText(getString("Reflections" + llformat("%d", value))); + return; + } + // choose the right text if (value < midPoint) { @@ -1677,6 +1713,22 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b { text_box->setText(LLTrans::getString("GraphicsQualityHigh")); } + + if ("MaximumARC" == name) + { + F32 control_value = value; + if (0.0f == control_value) + { + text_box->setText(LLTrans::getString("Off")); + } + else + { + // 13 is the maximum value of this control set in panel_preferences_graphics1.xml + control_value = exp(13.0f - control_value) + 20000.0f; + } + + gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)control_value); + } } void LLFloaterPreference::onChangeMaturity() @@ -2152,6 +2204,18 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { +// Don't do this on Mac as their braindead GL versioning +// sets this when 8x and 16x are indeed available +// +#if !LL_DARWIN + if (gGLManager.mIsIntel || gGLManager.mGLVersion < 3.f) + { //remove FSAA settings above "4x" + LLComboBox* combo = getChild("fsaa"); + combo->remove("8x"); + combo->remove("16x"); + } +#endif + LLComboBox* combo = getChild("graphic_preset_combo"); combo->setLabel(LLTrans::getString("preset_combo_label")); @@ -2171,7 +2235,7 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox() { LLComboBox* combo = getChild("graphic_preset_combo"); - EDefaultOptions option = DEFAULT_POSITION_TOP; + EDefaultOptions option = DEFAULT_SHOW; LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option); } -- cgit v1.2.3 From e713ef765f268af1cba0f7b04f1e331332630e97 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 13 Dec 2014 06:28:12 -0500 Subject: STORM-2082 Write out settings to preset file if settings changed on the login page Code improvements from bitbucket comments --- indra/newview/llfloaterpreference.cpp | 75 ++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 31 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c7b4ae8ddc..6e5b75e80b 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -864,13 +864,10 @@ void LLFloaterPreference::onBtnOK() pPathfindingConsole->onRegionBoundaryCross(); } - if (LLStartUp::getStartupState() == STATE_STARTED) - { - // 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")); - } + // 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 @@ -1208,6 +1205,7 @@ void LLFloaterPreference::refreshEnabledState() gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); /* Disabling this block of code because canUseAntiAliasing currently always returns true // anti-aliasing @@ -1408,19 +1406,19 @@ void LLFloaterPreference::refresh() // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes - updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true), "ObjectMeshDetail"); - updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true), "FlexibleMeshDetail"); - updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true), "TreeMeshDetail"); - updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true), "AvatarMeshDetail"); - updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true), "AvatarMeshDetail2"); - updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true), "AvatarPhysicsDetail"); - updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true), "TerrainMeshDetail"); - updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true), "RenderPostProcess"); - updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true), "SkyMeshDetail"); - updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true), "TerrainDetail"); - updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true), "MaximumARC"); - updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true), "Reflections"); - updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true), "ShadowDetail"); + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); + 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)); + updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); + updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true)); + updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1672,19 +1670,12 @@ void LLFloaterPreference::refreshUI() refresh(); } -void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box, const std::string& name) +void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) return; - // get range and points when text should change - F32 value = (F32)ctrl->getValue().asReal(); - F32 min = ctrl->getMinValue(); - F32 max = ctrl->getMaxValue(); - F32 range = max - min; - llassert(range > 0); - F32 midPoint = min + range / 3.0f; - F32 highPoint = min + (2.0f * range / 3.0f); + std::string name = ctrl->getName(); if ("ShadowDetail" == name) { @@ -1700,6 +1691,15 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b return; } + // get range and points when text should change + F32 value = (F32)ctrl->getValue().asReal(); + F32 min = ctrl->getMinValue(); + F32 max = ctrl->getMaxValue(); + F32 range = max - min; + llassert(range > 0); + F32 midPoint = min + range / 3.0f; + F32 highPoint = min + (2.0f * range / 3.0f); + // choose the right text if (value < midPoint) { @@ -1723,8 +1723,21 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b } else { - // 13 is the maximum value of this control set in panel_preferences_graphics1.xml - control_value = exp(13.0f - control_value) + 20000.0f; + // 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); + + // calculate adjustment factor + F32 scale = (maxv - minv) / (maxp - minp); + + control_value = exp(minv + scale * (control_value - minp)); + + // Invert result + control_value = 500000.0f - control_value; } gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)control_value); -- cgit v1.2.3 From c655ae00a1e9d3540a9280181766bd4f646e1cce Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 13 Dec 2014 20:53:27 -0500 Subject: STORM-2082 When a control is greyed out make sure it's associated text is greyed out. Sky: has two dependencies; grey it out when either one is not available. Remove Basic Shaders from Basic tab --- indra/newview/llfloaterpreference.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6e5b75e80b..814e552027 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1088,12 +1088,14 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); // Reflections BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") && gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps; ctrl_reflections->setEnabled(reflections); + reflections_text->setEnabled(reflections); // Bump & Shiny LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); @@ -1129,6 +1131,7 @@ void LLFloaterPreference::refreshEnabledState() // Global Shader Enable LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var + LLTextBox* terrain_text = getChild("TerrainDetailText"); ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); @@ -1137,19 +1140,26 @@ void LLFloaterPreference::refreshEnabledState() { terrain_detail->setValue(1); terrain_detail->setEnabled(FALSE); + terrain_text->setEnabled(false); } else { - terrain_detail->setEnabled(TRUE); + terrain_detail->setEnabled(TRUE); + terrain_text->setEnabled(true); } // WindLight LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - + 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); + 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"); @@ -1168,6 +1178,7 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); LLUICtrl* ctrl_shadow = getChild("ShadowDetail"); + LLTextBox* shadow_text = getChild("RenderShadowDetailText"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); @@ -1180,6 +1191,7 @@ void LLFloaterPreference::refreshEnabledState() enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); ctrl_shadow->setEnabled(enabled); + shadow_text->setEnabled(enabled); // Hardware settings F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); @@ -1249,6 +1261,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::disableUnavailableSettings() { LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); @@ -1257,8 +1270,11 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); LLUICtrl* ctrl_shadows = getChild("ShadowDetail"); + LLTextBox* shadows_text = getChild("RenderShadowDetailText"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); // if vertex shaders off, disable all shader related products if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) @@ -1268,9 +1284,13 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(FALSE); - + + sky->setEnabled(false); + sky_text->setEnabled(false); + ctrl_reflections->setEnabled(FALSE); ctrl_reflections->setValue(0); + reflections_text->setEnabled(false); ctrl_avatar_vp->setEnabled(FALSE); ctrl_avatar_vp->setValue(FALSE); @@ -1280,6 +1300,7 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1299,9 +1320,13 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(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); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1321,6 +1346,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1346,6 +1372,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); } // disabled reflections @@ -1353,6 +1380,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_reflections->setEnabled(FALSE); ctrl_reflections->setValue(FALSE); + reflections_text->setEnabled(false); } // disabled av @@ -1367,6 +1395,7 @@ void LLFloaterPreference::disableUnavailableSettings() //deferred needs AvatarVP, disable deferred ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); -- cgit v1.2.3 From 8f5ddebf0abfbcf73f25313214b06b98f2c7889c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 14 Dec 2014 19:17:52 -0500 Subject: STORM-2082 Remove ugly list of control names. Instead, obtain the list from the View data Remove a few remants used by the old hardware floater --- indra/newview/llfloaterpreference.cpp | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 814e552027..9df7f82275 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -340,7 +340,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); 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.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); @@ -788,6 +787,42 @@ void LLFloaterPreference::setHardwareDefaults() LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); } +void LLFloaterPreference::getControlNames(std::vector& names) +{ + LLView* view = findChild("display"); + if (view) + { + std::list stack; + stack.push_back(view); + while(!stack.empty()) + { + // Process view on top of the stack + LLView* curview = stack.front(); + stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (std::find(names.begin(), names.end(), control_name) == names.end()) + { + names.push_back(control_name); + } + } + } + + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + stack.push_back(*iter); + } + } + } +} + //virtual void LLFloaterPreference::onClose(bool app_quitting) { @@ -799,11 +834,6 @@ void LLFloaterPreference::onClose(bool app_quitting) } } -void LLFloaterPreference::onOpenHardwareSettings() -{ - LLFloater* floater = LLFloaterReg::showInstance("prefs_hardware_settings"); - addDependentFloater(floater, FALSE); -} // static void LLFloaterPreference::onBtnOK() { -- cgit v1.2.3 From 6de394342d2a3bd15ab8889e04619591a09fd6c6 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 7 Jan 2015 18:38:31 -0500 Subject: STORM-2082 Add back labels for quality and speed slider Change two sliders back to comboboxes. Rename label "Other" to "General" Move Max ARC to top of that list Move Shaders block to above Mesh block --- indra/newview/llfloaterpreference.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9df7f82275..6e340864bc 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1117,7 +1117,7 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { - LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLComboBox* ctrl_reflections = getChild("Reflections"); LLTextBox* reflections_text = getChild("ReflectionsText"); // Reflections @@ -1207,7 +1207,7 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLUICtrl* ctrl_shadow = getChild("ShadowDetail"); + LLComboBox* ctrl_shadow = getChild("ShadowDetail"); LLTextBox* shadow_text = getChild("RenderShadowDetailText"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it @@ -1290,7 +1290,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::disableUnavailableSettings() { - LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLComboBox* ctrl_reflections = getChild("Reflections"); LLTextBox* reflections_text = getChild("ReflectionsText"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); @@ -1299,7 +1299,7 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_avatar_impostors = getChild("AvatarImpostors"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); - LLUICtrl* ctrl_shadows = getChild("ShadowDetail"); + LLComboBox* ctrl_shadows = getChild("ShadowDetail"); LLTextBox* shadows_text = getChild("RenderShadowDetailText"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); @@ -1476,8 +1476,6 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); - updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true)); - updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1736,20 +1734,6 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b std::string name = ctrl->getName(); - if ("ShadowDetail" == name) - { - U32 value = (U32)ctrl->getValue().asInteger(); - text_box->setText(getString("RenderShadowDetail" + llformat("%d", value))); - return; - } - - if ("Reflections" == name) - { - U32 value = (U32)ctrl->getValue().asInteger(); - text_box->setText(getString("Reflections" + llformat("%d", value))); - return; - } - // get range and points when text should change F32 value = (F32)ctrl->getValue().asReal(); F32 min = ctrl->getMinValue(); -- cgit v1.2.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 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'indra/newview/llfloaterpreference.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() -- cgit v1.2.3 From ce324355787bd9c1c864050ca54b4306c30a0e79 Mon Sep 17 00:00:00 2001 From: Jonathan Yap 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 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterpreference.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); -- cgit v1.2.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/llfloaterpreference.cpp | 123 ++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 49 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') 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(); -- cgit v1.2.3 From 56f43a390015f3ba721554ef9a0e436b6bfad5f9 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 20 Jan 2015 13:35:26 -0500 Subject: STORM-2082 Still trying to work out the dirtyChilds issue. Also made some small UI adjustments. --- indra/newview/llfloaterpreference.cpp | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6dd030b280..34c34ffd65 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -107,7 +107,6 @@ #include "lllogininstance.h" // to check if logged in yet #include "llsdserialize.h" -#include "llpanelpresetspulldown.h" #include "llpresetsmanager.h" #include "llviewercontrol.h" #include "llpresetsmanager.h" @@ -1168,14 +1167,12 @@ 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); } else { -llwarns << "DBG terrain ON" << llendl; terrain_detail->setEnabled(TRUE); terrain_text->setEnabled(TRUE); } @@ -2282,7 +2279,9 @@ BOOL LLPanelPreferenceGraphics::postBuild() } #endif + resetDirtyChilds(); setPresetText(); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); return LLPanelPreference::postBuild(); @@ -2290,8 +2289,8 @@ BOOL LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::draw() { - LLPanelPreference::draw(); setPresetText(); + LLPanelPreference::draw(); } void LLPanelPreferenceGraphics::onPresetsListChange() @@ -2307,13 +2306,9 @@ void LLPanelPreferenceGraphics::setPresetText() if (hasDirtyChilds()) { gSavedSettings.setString("PresetGraphicActive", ""); - - LLPanelPresetsPulldown* instance = LLFloaterReg::findTypedInstance("presets_pulldown"); - if (instance) - { -llwarns << "DBG populate" << llendl; - instance->populatePanel(); - } + // 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"); @@ -2326,8 +2321,6 @@ llwarns << "DBG populate" << llendl; { preset_text->setText(LLTrans::getString("none_paren_cap")); } - - preset_text->resetDirty(); } bool LLPanelPreferenceGraphics::hasDirtyChilds() @@ -2345,16 +2338,7 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds() { if (ctrl->isDirty()) { - 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; - } - } + return true; } } // Push children onto the end of the work stack @@ -2363,7 +2347,7 @@ llwarns << "DBG " << control_name << llendl; { view_stack.push_back(*iter); } - } + } return false; } -- cgit v1.2.3 From 58577702a8c185683e089afc3f7fbcbaaf40122c Mon Sep 17 00:00:00 2001 From: Jonathan Yap 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/llfloaterpreference.cpp | 43 ++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') 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() -- cgit v1.2.3 From bdf55e9ea7106df2a61e352e7f87ad196f6b6f69 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 25 Jan 2015 06:24:44 -0500 Subject: STORM-2082 Clear preset in use when resetting to hardware defaults --- indra/newview/llfloaterpreference.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5938566b0a..17c93d792e 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -778,6 +778,8 @@ void LLFloaterPreference::setHardwareDefaults() { LLFeatureManager::getInstance()->applyRecommendedSettings(); refreshEnabledGraphics(); + gSavedSettings.setString("PresetGraphicActive", ""); + LLPresetsManager::getInstance()->triggerChangeSignal(); LLTabContainer* tabcontainer = getChild("pref core"); child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); -- cgit v1.2.3 From 45b59881ebcc19510c7e36398232f057366eb41d Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 3 Feb 2015 08:37:31 -0500 Subject: STORM-2082 Reformat preset floaters. Remove Impostor checkbox. That control is now merged into the right side of the impostors slider. Maximum ARC still depends on impostors being enabled. Once that dependency is removed in llvoavatar then it will be necessary to reflect that change in the UI code. --- indra/newview/llfloaterpreference.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 17c93d792e..cbd9867107 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1229,7 +1229,6 @@ void LLFloaterPreference::refreshEnabledState() 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"); @@ -1304,10 +1303,8 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); 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"); @@ -1460,11 +1457,8 @@ void LLFloaterPreference::disableUnavailableSettings() // disabled impostors if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors")) { - 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); } } @@ -1474,8 +1468,6 @@ void LLFloaterPreference::refresh() getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); - refreshEnabledState(); - // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes @@ -1488,7 +1480,10 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + updateImpostorsText(getChild("MaxNumberAvatarDrawn", true), getChild("ImpostorsText", true)); updateMaximumArcText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); + + refreshEnabledState(); } void LLFloaterPreference::onCommitWindowedMode() @@ -1769,6 +1764,25 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b } } +void LLFloaterPreference::updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + F32 value = (F32)ctrl->getValue().asReal(); + + if (value < IMPOSTORS_OFF) + { + text_box->setText(llformat("%0.0f", value)); + if (!gSavedSettings.getBOOL("RenderUseImpostors")) + { + gSavedSettings.setBOOL("RenderUseImpostors", true); + } + } + else + { + text_box->setText(LLTrans::getString("no_limit")); + gSavedSettings.setBOOL("RenderUseImpostors", false); + } +} + void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box) { F32 min_result = 20000.0f; @@ -1781,7 +1795,7 @@ void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* te // 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")); + text_box->setText(LLTrans::getString("no_limit")); } else { -- cgit v1.2.3