diff options
Diffstat (limited to 'indra/newview')
9 files changed, 29 insertions, 16 deletions
diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index d92aaa5659..2f7d0552a3 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -69,6 +69,7 @@ void LLFloaterDeletePrefPreset::onBtnDelete() if (LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) { + // If you delete the active preset (which should never happen) then recreate it. if (name == gSavedSettings.getString("PresetGraphicActive")) { LLPresetsManager::getInstance()->savePreset(mSubdirectory, PRESETS_DEFAULT); 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")); } } diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index a5fc356c36..02281d8b3c 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -80,11 +80,12 @@ void LLFloaterSavePrefPreset::onBtnSave() { std::string name = mPresetCombo->getSimple(); - LLPresetsManager::getInstance()->savePreset(mSubdirectory, name); - - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetSaved", args); + if (LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetSaved", args); + } closeFloater(); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 260f2c9547..971a5ecf52 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -126,7 +126,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam presets = mPresetNames; } -void LLPresetsManager::savePreset(const std::string& subdirectory, const std::string& name) +bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::string& name) { llassert(!name.empty()); @@ -203,12 +203,20 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st // write to file llofstream presetsXML(pathName); + if (!presetsXML.is_open()) + { + LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL; + return false; + } + LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); // signal interested parties mPresetListChangeSignal(); + + return true; } void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) @@ -241,10 +249,10 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st { std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); - gSavedSettings.loadFromFile(full_path, false, true); - - // signal interested parties - mPresetListChangeSignal(); + if(gSavedSettings.loadFromFile(full_path, false, true) > 0) + { + mPresetListChangeSignal(); + } } bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index d7d84b5746..180cca5bc4 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -55,7 +55,7 @@ public: static std::string getPresetsDir(const std::string& subdirectory); void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option); - void savePreset(const std::string& subdirectory, const std::string & name); + bool savePreset(const std::string& subdirectory, const std::string & name); void loadPreset(const std::string& subdirectory, const std::string & name); bool deletePreset(const std::string& subdirectory, const std::string& name); diff --git a/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml index 03c5a412b6..bdb6481b52 100644 --- a/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_delete_pref_preset.xml @@ -2,7 +2,7 @@ <floater legacy_header_height="18" height="130" - help_topic="" + help_topic="floater_delete_pref" layout="topleft" name="Delete Pref Preset" save_rect="true" diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml index 5919d9e3d7..945ed4d28d 100644 --- a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -2,7 +2,7 @@ <floater legacy_header_height="18" height="130" - help_topic="" + help_topic="floater_save_pref" layout="topleft" name="Save Pref Preset" save_rect="true" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 24f3dd803f..d0a5075dc8 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -954,7 +954,7 @@ left="10" name="Defaults" top="310" - width="115"> + width="200"> <button.commit_callback function="Pref.HardwareDefaults" /> </button> diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml index fdcbce05d2..b87dda2315 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml @@ -2,8 +2,8 @@ <panel background_opaque="true" background_visible="true" - bg_opaque_image="Volume_Background" - bg_alpha_image="Volume_Background" + bg_opaque_image="Volume_Background" + bg_alpha_image="Volume_Background" border_visible="false" border="false" chrome="true" |