From 50e44af46ccc285b90df21da398807665e0d694b Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 4 Dec 2018 19:10:31 +0100 Subject: [PATCH] Fixed compilation on OSX, improved utf8 compatibility of Tab::may_discard_current_dirty_preset(), renamed "SLA Print Profile" / "SLA Material Profile" to just "Print Profile" resp. Material Profile. --- src/slic3r/GUI/Tab.cpp | 25 +++++++++++-------------- src/slic3r/GUI/Tab.hpp | 4 ++-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 5f6891eea..fccf9e03d 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2476,36 +2476,33 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr { if (presets == nullptr) presets = m_presets; // Display a dialog showing the dirty options in a human readable form. - auto old_preset = presets->get_edited_preset(); - auto type_name = presets->name(); - auto tab = " "; - auto name = old_preset.is_default ? + const Preset& old_preset = presets->get_edited_preset(); + std::string type_name = presets->name(); + wxString tab = " "; + wxString name = old_preset.is_default ? _(L("Default ")) + type_name + _(L(" preset")) : (type_name + _(L(" preset\n")) + tab + old_preset.name); // Collect descriptions of the dirty options. - std::vector option_names; - for(auto opt_key: presets->current_dirty_options()) { - auto opt = m_config->def()->options.at(opt_key); + wxString changes; + for (const std::string &opt_key : presets->current_dirty_options()) { + const ConfigOptionDef &opt = m_config->def()->options.at(opt_key); std::string name = ""; - if (!opt.category.empty()) + if (! opt.category.empty()) name += opt.category + " > "; name += !opt.full_label.empty() ? opt.full_label : opt.label; - option_names.push_back(name); + changes += tab + from_u8(name) + "\n"; } // Show a confirmation dialog with the list of dirty options. - std::string changes = ""; - for (const std::string &changed_name : option_names) - changes += tab + changed_name + "\n"; - std::string message = name + "\n\n"; + wxString message = name + "\n\n"; if (new_printer_name.empty()) message += _(L("has the following unsaved changes:")); else { message += (m_type == Slic3r::Preset::TYPE_PRINTER) ? _(L("is not compatible with printer")) : _(L("is not compatible with print profile")); - message += std::string("\n") + tab + new_printer_name + "\n\n"; + message += wxString("\n") + tab + from_utf8(new_printer_name) + "\n\n"; message += _(L("and it has the following unsaved changes:")); } auto confirm = new wxMessageDialog(parent(), diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index fb9bac7ac..337fbf006 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -360,7 +360,7 @@ class TabSLAMaterial : public Tab { public: TabSLAMaterial(wxNotebook* parent) : - Tab(parent, _(L("SLA Material Settings")), "sla_material") {} + Tab(parent, _(L("Material Settings")), "sla_material") {} ~TabSLAMaterial() {} void build() override; @@ -374,7 +374,7 @@ class TabSLAPrint : public Tab { public: TabSLAPrint(wxNotebook* parent) : - Tab(parent, _(L("SLA Print Settings")), "sla_print") {} + Tab(parent, _(L("Print Settings")), "sla_print") {} ~TabSLAPrint() {} void build() override; void reload_config() override;