Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2019-10-02 23:50:55 +0300
committerYuSanka <yusanka@gmail.com>2019-10-02 23:50:55 +0300
commitb3603a09fcc04dd9dda26824574c0fa0399c594c (patch)
treefc5c01cb0d06abff4e89404b8b60d4502595daf2 /src/slic3r/GUI/Preset.cpp
parent546ad99306b408846572dfbfecf32f9c89ca8ae8 (diff)
Fixed a bug: Wrong save of a preset if the preset is already exist.
Step to repro: 1. Select system "Some_preset" preset 2. Make some changes 3. Save preset with "Some_preset - Copy" name. => "Some_preset - Copy" is selected, there is/are marked option(s) only different from system preset. repeate 1-3 steps => "Some_preset - Copy" is selected, there is/are marked option(s) different from DEFAULT preset.
Diffstat (limited to 'src/slic3r/GUI/Preset.cpp')
-rw-r--r--src/slic3r/GUI/Preset.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp
index d2503d349..41aaa80f1 100644
--- a/src/slic3r/GUI/Preset.cpp
+++ b/src/slic3r/GUI/Preset.cpp
@@ -819,6 +819,21 @@ bool PresetCollection::delete_current_preset()
return true;
}
+bool PresetCollection::delete_preset(const std::string& name)
+{
+ auto it = this->find_preset_internal(name);
+
+ const Preset& preset = *it;
+ if (preset.is_default)
+ return false;
+ if (!preset.is_external && !preset.is_system) {
+ // Erase the preset file.
+ boost::nowide::remove(preset.file.c_str());
+ }
+ m_presets.erase(it);
+ return true;
+}
+
void PresetCollection::load_bitmap_default(wxWindow *window, const std::string &file_name)
{
// XXX: See note in PresetBundle::load_compatible_bitmaps()