FIX: [5159 5165 5171 5172] create printer and filament issue

Jira: 5159 5165 5171 5172
5159 create printer dialog no refresh
5165 create printer 2 step dialog no refersh
5171 change font
5172 edit filament dialog darkUI issue
input special character is prohibited
'/' in preset name translate to '-'
update printer combobox

Change-Id: I5fa27836dab7f604f1a065c65efa099c7a2f0f96
Signed-off-by: maosheng.wei <maosheng.wei@bambulab.com>
This commit is contained in:
maosheng.wei
2023-11-08 18:20:01 +08:00
committed by Lane.Wei
parent e9661f3fdd
commit cb11021a56
2 changed files with 86 additions and 21 deletions

View File

@@ -2154,7 +2154,9 @@ bool PresetCollection::clone_presets(std::vector<Preset const *> const &presets,
bool PresetCollection::clone_presets_for_printer(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &printer, bool force_rewritten)
{
return clone_presets(presets, failures, [printer](Preset &preset, Preset::Type &type) {
preset.name = preset.name.substr(0, preset.name.find(" @")) + " @" + printer;
std::string prefix = preset.name.substr(0, preset.name.find(" @"));
std::replace(prefix.begin(), prefix.end(), '/', '-');
preset.name = prefix + " @" + printer;
//preset.alias = "";
auto *compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset.config.option("compatible_printers"));
compatible_printers->values = std::vector<std::string>{ printer };
@@ -2169,6 +2171,7 @@ bool PresetCollection::create_presets_from_template_for_printer(std::vector<Pres
{
return clone_presets(templates, failures, [printer, create_filament_id](Preset &preset, Preset::Type &type) {
std::string prefix = preset.name.substr(0, preset.name.find(" @"));
std::replace(prefix.begin(), prefix.end(), '/', '-');
preset.name = prefix + " @" + printer;
auto *compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset.config.option("compatible_printers"));
compatible_printers->values = std::vector<std::string>{printer};