MAINT-6174 FIXED Graphics parameters are wrong after closing the Advanced Graphics floater

meow-7.2.2
AndreyL ProductEngine 2016-03-01 10:01:35 +02:00
parent 346ee6595d
commit b6f6eeb02e
2 changed files with 19 additions and 4 deletions

View File

@ -824,6 +824,13 @@ void LLFloaterPreference::updateShowFavoritesCheckbox(bool val)
void LLFloaterPreference::setHardwareDefaults() void LLFloaterPreference::setHardwareDefaults()
{ {
std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
if (!preset_graphic_active.empty())
{
saveGraphicsPreset(preset_graphic_active);
saveSettings(); // save here to be able to return to the previous preset by Cancel
}
LLFeatureManager::getInstance()->applyRecommendedSettings(); LLFeatureManager::getInstance()->applyRecommendedSettings();
// reset indirects before refresh because we may have changed what they control // reset indirects before refresh because we may have changed what they control
@ -2478,6 +2485,12 @@ void LLPanelPreferenceGraphics::onPresetsListChange()
{ {
resetDirtyChilds(); resetDirtyChilds();
setPresetText(); setPresetText();
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance && !gSavedSettings.getString("PresetGraphicActive").empty())
{
instance->saveSettings(); //make cancel work correctly after changing the preset
}
} }
void LLPanelPreferenceGraphics::setPresetText() void LLPanelPreferenceGraphics::setPresetText()
@ -2486,13 +2499,17 @@ void LLPanelPreferenceGraphics::setPresetText()
std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
if (hasDirtyChilds() && !preset_graphic_active.empty()) if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText())
{ {
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"); LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance) if (instance)
{ {
instance->saveGraphicsPreset(preset_graphic_active); instance->saveGraphicsPreset(preset_graphic_active);
} }
}
if (hasDirtyChilds() && !preset_graphic_active.empty())
{
gSavedSettings.setString("PresetGraphicActive", ""); gSavedSettings.setString("PresetGraphicActive", "");
preset_graphic_active.clear(); preset_graphic_active.clear();
// This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown

View File

@ -125,12 +125,10 @@ protected:
// updates click/double-click action controls depending on values from settings.xml // updates click/double-click action controls depending on values from settings.xml
void updateClickActionControls(); void updateClickActionControls();
public:
// This function squirrels away the current values of the controls so that // This function squirrels away the current values of the controls so that
// cancel() can restore them. // cancel() can restore them.
void saveSettings(); void saveSettings();
public:
void setCacheLocation(const LLStringExplicit& location); void setCacheLocation(const LLStringExplicit& location);