Merge remote-tracking branch 'origin/updating' into cpp_ui_optimization

This commit is contained in:
bubnikv 2018-04-17 10:38:02 +02:00
commit 3b0eb6b786
62 changed files with 4998 additions and 967 deletions

View file

@ -644,7 +644,8 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value)
change_opt_value(*m_config, opt_key, value);
// Mark the print & filament enabled if they are compatible with the currently selected preset.
if (opt_key.compare("compatible_printers") == 0) {
m_preset_bundle->update_compatible_with_printer(0);
// Don't select another profile if this profile happens to become incompatible.
m_preset_bundle->update_compatible_with_printer(false);
}
m_presets->update_dirty_ui(m_presets_choice);
on_presets_changed();
@ -2203,9 +2204,9 @@ wxSizer* Tab::compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox
presets.Add(preset.name);
}
auto dlg = new wxMultiChoiceDialog(parent,
_(L("Select the printers this profile is compatible with.")),
_(L("Compatible printers")), presets);
wxMultiChoiceDialog dlg(parent,
_(L("Select the printers this profile is compatible with.")),
_(L("Compatible printers")), presets);
// # Collect and set indices of printers marked as compatible.
wxArrayInt selections;
auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(m_config->option("compatible_printers"));
@ -2217,12 +2218,12 @@ wxSizer* Tab::compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox
selections.Add(idx);
break;
}
dlg->SetSelections(selections);
dlg.SetSelections(selections);
std::vector<std::string> value;
// Show the dialog.
if (dlg->ShowModal() == wxID_OK) {
if (dlg.ShowModal() == wxID_OK) {
selections.Clear();
selections = dlg->GetSelections();
selections = dlg.GetSelections();
for (auto idx : selections)
value.push_back(presets[idx].ToStdString());
if (value.empty()) {