fix(cpn): model semver check inc model name in warning msg (#4794)
This commit is contained in:
@@ -1162,14 +1162,6 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
||||
|
||||
qDebug() << "Settings version:" << modelSettingsVersion.toString();
|
||||
|
||||
if (modelSettingsVersion > SemanticVersion(VERSION)) {
|
||||
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.");
|
||||
if (QMessageBox::warning(NULL, CPN_STR_APP_NAME, prmpt.arg(modelSettingsVersion.toString()), (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) != QMessageBox::Yes) {
|
||||
// TODO: this triggers an error in the calling code so we need a graceful way to handle
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (node["header"]) {
|
||||
const auto& header = node["header"];
|
||||
if (header.IsMap()) {
|
||||
@@ -1180,6 +1172,15 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO display model filename in preference to model name as easier for user
|
||||
if (modelSettingsVersion > SemanticVersion(VERSION)) {
|
||||
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.");
|
||||
if (QMessageBox::warning(NULL, CPN_STR_APP_NAME, prmpt.arg(rhs.name).arg(modelSettingsVersion.toString()), (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) != QMessageBox::Yes) {
|
||||
// TODO: this triggers an error in the calling code so we need a graceful way to handle
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (node["timers"]) {
|
||||
const auto& timers = node["timers"];
|
||||
if (!timers.IsMap()) return false;
|
||||
|
||||
Reference in New Issue
Block a user