Skip to content

Commit f25c27f

Browse files
Neil Hornepfeerick
Neil Horne
authored andcommitted
fix(cpn): model semver check inc model name in warning msg (#4794)
1 parent ecb1e4c commit f25c27f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

companion/src/firmwares/edgetx/yaml_modeldata.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -1162,14 +1162,6 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
11621162

11631163
qDebug() << "Settings version:" << modelSettingsVersion.toString();
11641164

1165-
if (modelSettingsVersion > SemanticVersion(VERSION)) {
1166-
QString prmpt = QCoreApplication::translate("YamlModelSettings", "Warning: Model settings file version %1 is not supported by this version of Companion!\n\nModel and radio settings may be corrupted if you continue.\n\nI acknowledge and accept the consequences.");
1167-
if (QMessageBox::warning(NULL, CPN_STR_APP_NAME, prmpt.arg(modelSettingsVersion.toString()), (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) != QMessageBox::Yes) {
1168-
// TODO: this triggers an error in the calling code so we need a graceful way to handle
1169-
return false;
1170-
}
1171-
}
1172-
11731165
if (node["header"]) {
11741166
const auto& header = node["header"];
11751167
if (header.IsMap()) {
@@ -1180,6 +1172,15 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
11801172
}
11811173
}
11821174

1175+
// TODO display model filename in preference to model name as easier for user
1176+
if (modelSettingsVersion > SemanticVersion(VERSION)) {
1177+
QString prmpt = QCoreApplication::translate("YamlModelSettings", "Warning: Model '%1' has settings version %2 that is not supported by this version of Companion!\n\nModel and radio settings may be corrupted if you continue.\n\nI acknowledge and accept the consequences.");
1178+
if (QMessageBox::warning(NULL, CPN_STR_APP_NAME, prmpt.arg(rhs.name).arg(modelSettingsVersion.toString()), (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) != QMessageBox::Yes) {
1179+
// TODO: this triggers an error in the calling code so we need a graceful way to handle
1180+
return false;
1181+
}
1182+
}
1183+
11831184
if (node["timers"]) {
11841185
const auto& timers = node["timers"];
11851186
if (!timers.IsMap()) return false;

0 commit comments

Comments
 (0)