FIX: Studio UI Freeze when saving user preset
github: #3335 Change-Id: Idaf53f673a3e46408826c06bdde2c592395d358b
This commit is contained in:
parent
ebec1e2eb1
commit
0e277ec066
|
@ -1499,7 +1499,7 @@ int PresetCollection::get_user_presets(PresetBundle *preset_bundle, std::vector<
|
|||
lock();
|
||||
for (Preset &preset : m_presets) {
|
||||
if (!preset.is_user()) continue;
|
||||
if (get_preset_base(preset) != &preset && preset.base_id.empty()) continue;
|
||||
if (preset.base_id.empty() && preset.inherits() != "") continue;
|
||||
if (!preset.setting_id.empty() && preset.sync_info.empty()) continue;
|
||||
//if (!preset.is_bbl_vendor_preset(preset_bundle)) continue;
|
||||
if (preset.sync_info == "hold") continue;
|
||||
|
@ -2286,11 +2286,8 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
|
|||
// Clear the link to the parent profile.
|
||||
inherits.clear();
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": save preset %1% , with detach")%new_name;
|
||||
} else {
|
||||
// Inherited from a user preset. Just maintain the "inherited" flag,
|
||||
// meaning it will inherit from either the system preset, or the inherited user preset.
|
||||
auto base = get_preset_base(curr_preset);
|
||||
inherits = base ? base->name : "";
|
||||
} else if (is_base_preset(preset)) {
|
||||
inherits = old_name;
|
||||
}
|
||||
preset.is_default = false;
|
||||
preset.is_system = false;
|
||||
|
@ -2929,7 +2926,7 @@ std::string PresetCollection::path_from_name(const std::string &new_name, bool d
|
|||
|
||||
std::string PresetCollection::path_for_preset(const Preset &preset) const
|
||||
{
|
||||
return path_from_name(preset.name, get_preset_base(preset) == &preset);
|
||||
return path_from_name(preset.name, is_base_preset(preset));
|
||||
}
|
||||
|
||||
const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConfig &config) const
|
||||
|
|
|
@ -678,6 +678,7 @@ public:
|
|||
// Without force, the selection is only updated if the index changes.
|
||||
// With force, the changes are reverted if the new index is the same as the old index.
|
||||
bool select_preset_by_name(const std::string &name, bool force);
|
||||
bool is_base_preset(const Preset &preset) const { return preset.is_system || (preset.is_user() && preset.inherits().empty()); }
|
||||
|
||||
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
||||
std::string path_from_name(const std::string &new_name, bool detach = false) const;
|
||||
|
|
Loading…
Reference in New Issue