ENH: config: add version different check logic

jira: STUDIO-7361
Change-Id: I0541d2cdd3bcef059f50ad3accf92bf4bdeaa670
This commit is contained in:
lane.wei 2024-07-18 18:12:34 +08:00 committed by Lane.Wei
parent 552b73dec4
commit fa2caa8bc8
5 changed files with 8 additions and 8 deletions

View File

@ -1680,7 +1680,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
if (m_bambuslicer_generator_version) { if (m_bambuslicer_generator_version) {
Semver app_version = *(Semver::parse(SLIC3R_VERSION)); Semver app_version = *(Semver::parse(SLIC3R_VERSION));
Semver file_version = *m_bambuslicer_generator_version; Semver file_version = *m_bambuslicer_generator_version;
if (file_version.maj() != app_version.maj()) if (file_version.maj() > app_version.maj())
dont_load_config = true; dont_load_config = true;
} }
else { else {

View File

@ -1149,7 +1149,7 @@ void PresetCollection::load_presets(
boost::optional<Semver> version = Semver::parse(version_str); boost::optional<Semver> version = Semver::parse(version_str);
if (!version) continue; if (!version) continue;
Semver app_version = *(Semver::parse(SLIC3R_VERSION)); Semver app_version = *(Semver::parse(SLIC3R_VERSION));
if ( version->maj() != app_version.maj()) { if ( version->maj() > app_version.maj()) {
BOOST_LOG_TRIVIAL(warning) << "Preset incompatibla, not loading: " << name; BOOST_LOG_TRIVIAL(warning) << "Preset incompatibla, not loading: " << name;
continue; continue;
} }
@ -1605,7 +1605,7 @@ bool PresetCollection::load_user_preset(std::string name, std::map<std::string,
return false; return false;
} }
Semver app_version = *(Semver::parse(SLIC3R_VERSION)); Semver app_version = *(Semver::parse(SLIC3R_VERSION));
if ( cloud_version->maj() != app_version.maj()) { if ( cloud_version->maj() > app_version.maj()) {
BOOST_LOG_TRIVIAL(warning)<< __FUNCTION__ << boost::format("version %1% mismatch with app version %2%, not loading for user preset %3%")%version_str %SLIC3R_VERSION %name; BOOST_LOG_TRIVIAL(warning)<< __FUNCTION__ << boost::format("version %1% mismatch with app version %2%, not loading for user preset %3%")%version_str %SLIC3R_VERSION %name;
return false; return false;
} }

View File

@ -747,7 +747,7 @@ bool PresetBundle::import_json_presets(PresetsConfigSubstitutions & s
boost::optional<Semver> version = Semver::parse(version_str); boost::optional<Semver> version = Semver::parse(version_str);
if (!version) return false; if (!version) return false;
Semver app_version = *(Semver::parse(SLIC3R_VERSION)); Semver app_version = *(Semver::parse(SLIC3R_VERSION));
if (version->maj() != app_version.maj()) { if (version->maj() > app_version.maj()) {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << " Preset incompatibla, not loading: " << name; BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << " Preset incompatibla, not loading: " << name;
return false; return false;
} }

View File

@ -3642,7 +3642,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
if(load_type != LoadType::LoadGeometry) if(load_type != LoadType::LoadGeometry)
show_info(q, _L("The 3mf is not from Bambu Lab, load geometry data only."), _L("Load 3mf")); show_info(q, _L("The 3mf is not from Bambu Lab, load geometry data only."), _L("Load 3mf"));
} }
else if (load_config && (file_version.maj() != app_version.maj())) { else if (load_config && (file_version.maj() > app_version.maj())) {
// version mismatch, only load geometries // version mismatch, only load geometries
load_config = false; load_config = false;
if (!load_model) { if (!load_model) {
@ -3658,7 +3658,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
q->select_plate(0); q->select_plate(0);
if (load_type != LoadType::LoadGeometry) { if (load_type != LoadType::LoadGeometry) {
if (en_3mf_file_type == En3mfType::From_BBS) if (en_3mf_file_type == En3mfType::From_BBS)
show_info(q, _L("The 3mf is generated by old Bambu Studio, load geometry data only."), _L("Load 3mf")); show_info(q, _L("Due to the lower version of Bambu Studio, this 3mf file cannot be fully loaded. Please update Bambu Studio to the latest version"), _L("Load 3mf"));
else else
show_info(q, _L("The 3mf is not from Bambu Lab, load geometry data only."), _L("Load 3mf")); show_info(q, _L("The 3mf is not from Bambu Lab, load geometry data only."), _L("Load 3mf"));
} }

View File

@ -1202,7 +1202,7 @@ void PresetUpdater::priv::check_installed_vendor_profiles() const
bool version_match = ((resource_ver.maj() == vendor_ver.maj()) && (resource_ver.min() == vendor_ver.min())); bool version_match = ((resource_ver.maj() == vendor_ver.maj()) && (resource_ver.min() == vendor_ver.min()));
if (!version_match || (vendor_ver < resource_ver)) { if (!version_match || (vendor_ver < resource_ver)) {
BOOST_LOG_TRIVIAL(info) << "[BBL Updater]:found vendor "<<vendor_name<<" newer version "<<resource_ver.to_string() <<" from resource, old version "<<vendor_ver.to_string(); BOOST_LOG_TRIVIAL(info) << "[BBL Updater]:found vendor "<<vendor_name<<" different version "<<resource_ver.to_string() <<" from resource, old version "<<vendor_ver.to_string()<<", will copy from resource";
bundles.push_back(vendor_name); bundles.push_back(vendor_name);
} }
} }
@ -1257,7 +1257,7 @@ Updates PresetUpdater::priv::get_printer_config_updates(bool update) const
bool version_match = ((resc_ver.maj() == curr_ver.maj()) && (resc_ver.min() == curr_ver.min())); bool version_match = ((resc_ver.maj() == curr_ver.maj()) && (resc_ver.min() == curr_ver.min()));
if (!version_match || (curr_ver < resc_ver)) { if (!version_match || (curr_ver < resc_ver)) {
BOOST_LOG_TRIVIAL(info) << "[BBL Updater]:found newer version " << resc_version << " from resource, old version " << curr_version; BOOST_LOG_TRIVIAL(info) << "[BBL Updater]:found different version " << resc_version << " from resource, old version " << curr_version<<", will copy from resource";
} else { } else {
return {}; return {};
} }