NEW: add custom printer config wizard

Change-Id: I48f34039635803c3f1cee4cc2c853a0ffa5b451a
Signed-off-by: Stone Li <stone.li@bambulab.com>
(cherry picked from commit 387ba2a5aac05d3b3af0923f88415188ae8cb44e)
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
liz.li 2022-09-20 20:35:51 +08:00 committed by Lane.Wei
parent 5c82ec410e
commit 0b84ca62bf
19 changed files with 711 additions and 303 deletions

View file

@ -757,6 +757,9 @@ int ConfigBase::load_from_json(const std::string &file, ConfigSubstitutionContex
if (boost::iequals(it.key(),BBL_JSON_KEY_VERSION)) {
key_values.emplace(BBL_JSON_KEY_VERSION, it.value());
}
if (boost::iequals(it.key(), BBL_JSON_KEY_IS_CUSTOM)) {
key_values.emplace(BBL_JSON_KEY_IS_CUSTOM, it.value());
}
else if (boost::iequals(it.key(), BBL_JSON_KEY_NAME)) {
key_values.emplace(BBL_JSON_KEY_NAME, it.value());
}
@ -1209,14 +1212,15 @@ ConfigSubstitutions ConfigBase::load_from_gcode_file(const std::string &file, Fo
}
//BBS: add json support
void ConfigBase::save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version) const
void ConfigBase::save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version, const std::string is_custom) const
{
json j;
//record the headers
j[BBL_JSON_KEY_VERSION] = version;
j[BBL_JSON_KEY_NAME] = name;
j[BBL_JSON_KEY_FROM] = from;
if (!is_custom.empty())
j[BBL_JSON_KEY_IS_CUSTOM] = is_custom;
//record all the key-values
for (const std::string &opt_key : this->keys())