MultiChooseDialog & CheckList class & improvements for Profile Dependencies (#9971)

* init

* fix

* fix

* update

* update

* update

* Update Tab.cpp

* Update CheckList.cpp
This commit is contained in:
yw4z
2026-05-18 14:46:47 +03:00
committed by GitHub
parent b9ff15054f
commit b4aa070c40
7 changed files with 399 additions and 4 deletions

View File

@@ -40,7 +40,7 @@
#include "UnsavedChangesDialog.hpp"
#include "SavePresetDialog.hpp"
#include "EditGCodeDialog.hpp"
#include "MultiChoiceDialog.hpp"
#include "MsgDialog.hpp"
#include "Notebook.hpp"
@@ -7002,7 +7002,15 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
presets.Add(from_u8(preset.name));
}
wxMultiChoiceDialog dlg(parent, deps.dialog_title, deps.dialog_label, presets);
if(deps.type == Preset::TYPE_PRINTER){
deps.dialog_title = "Compatible printers";
deps.dialog_label = "Select printers";
}else{
deps.dialog_title = "Compatible process profiles";
deps.dialog_label = "Select profiles";
}
MultiChoiceDialog dlg(parent, deps.dialog_label, deps.dialog_title, presets);
wxGetApp().UpdateDlgDarkUI(&dlg);
// Collect and set indices of depending_presets marked as compatible.
wxArrayInt selections;
@@ -7015,13 +7023,16 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
break;
}
dlg.SetSelections(selections);
dlg.SetSize(FromDIP(wxSize(360, 480)));
std::vector<std::string> value;
// Show the dialog.
if (dlg.ShowModal() == wxID_OK) {
selections.Clear();
selections = dlg.GetSelections();
for (auto idx : selections)
value.push_back(presets[idx].ToUTF8().data());
// leave list empty if all items checked. this will check "All" checkbox automatically. also fixes unnecessary config change
if(selections.GetCount() != presets.GetCount())
for (auto idx : selections)
value.push_back(presets[idx].ToUTF8().data());
if (value.empty()) {
deps.checkbox->SetValue(1);
deps.btn->Disable();