Fix of #5319 - presets inherited from renamed presets using the old

preset name in the "inherits" field were losing the "inherits" flag.
This commit is contained in:
Vojtech Bubnik 2020-12-08 17:45:50 +01:00
parent 661ad1735b
commit 6e3fae3865
2 changed files with 7 additions and 1 deletions

View file

@ -1316,6 +1316,8 @@ std::string PresetCollection::section_name() const
}
}
// Used for validating the "inherits" flag when importing user's config bundles.
// Returns names of all system presets including the former names of these presets.
std::vector<std::string> PresetCollection::system_preset_names() const
{
size_t num = 0;
@ -1325,8 +1327,10 @@ std::vector<std::string> PresetCollection::system_preset_names() const
std::vector<std::string> out;
out.reserve(num);
for (const Preset &preset : m_presets)
if (preset.is_system)
if (preset.is_system) {
out.emplace_back(preset.name);
out.insert(out.end(), preset.renamed_from.begin(), preset.renamed_from.end());
}
std::sort(out.begin(), out.end());
return out;
}

View file

@ -441,6 +441,8 @@ public:
{ return dirty_options(&this->get_edited_preset(), this->get_selected_preset_parent(), deep_compare); }
// Return a sorted list of system preset names.
// Used for validating the "inherits" flag when importing user's config bundles.
// Returns names of all system presets including the former names of these presets.
std::vector<std::string> system_preset_names() const;
// Update a dirty flag of the current preset