chore(cpn): do not warn when reading v3.0 models and settings on v2.12 (#6843)

This commit is contained in:
Neil Horne
2025-12-07 07:27:17 +10:00
committed by GitHub
parent 7147cb0a57
commit 7ec8b39661
2 changed files with 44 additions and 28 deletions
@@ -422,20 +422,28 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
qDebug() << "Settings version:" << radioSettingsVersion.toString(); qDebug() << "Settings version:" << radioSettingsVersion.toString();
if (radioSettingsVersion > SemanticVersion(VERSION)) { if (radioSettingsVersion > SemanticVersion(VERSION)) {
QString prmpt = QCoreApplication::translate("YamlGeneralSettings", "Warning: File version %1 is not supported by this version of Companion!\n\nModel and radio settings may be corrupted if you continue."); // TODO remove this temporary 2.12 fix check for 3.0 release
prmpt = prmpt.arg(radioSettingsVersion.toString()); if (radioSettingsVersion == SemanticVersion("3.0.0") &&
QMessageBox msgBox; SemanticVersion(VERSION) >= SemanticVersion("2.12.0") &&
msgBox.setWindowTitle(QCoreApplication::translate("YamlGeneralSettings", "Read Radio Settings")); SemanticVersion(VERSION) < SemanticVersion("3.0.0")) {
msgBox.setText(prmpt); qDebug() << "Version exception override: radio settings" << radioSettingsVersion.toString()
msgBox.setIcon(QMessageBox::Warning); << "Companion" << SemanticVersion(VERSION).toString();
QPushButton *pbAccept = new QPushButton(CPN_STR_TTL_ACCEPT); } else {
QPushButton *pbDecline = new QPushButton(CPN_STR_TTL_DECLINE); QString prmpt = QCoreApplication::translate("YamlGeneralSettings", "Warning: File version %1 is not supported by Companion %2!\n\nModel and radio settings may be corrupted if you continue.");
msgBox.addButton(pbAccept, QMessageBox::AcceptRole); prmpt = prmpt.arg(radioSettingsVersion.toString()).arg(SemanticVersion(VERSION).toString());
msgBox.addButton(pbDecline, QMessageBox::RejectRole); QMessageBox msgBox;
msgBox.setDefaultButton(pbDecline); msgBox.setWindowTitle(QCoreApplication::translate("YamlGeneralSettings", "Read Radio Settings"));
msgBox.exec(); msgBox.setText(prmpt);
if (msgBox.clickedButton() == pbDecline) msgBox.setIcon(QMessageBox::Warning);
return false; QPushButton *pbAccept = new QPushButton(CPN_STR_TTL_ACCEPT);
QPushButton *pbDecline = new QPushButton(CPN_STR_TTL_DECLINE);
msgBox.addButton(pbAccept, QMessageBox::AcceptRole);
msgBox.addButton(pbDecline, QMessageBox::RejectRole);
msgBox.setDefaultButton(pbDecline);
msgBox.exec();
if (msgBox.clickedButton() == pbDecline)
return false;
}
} }
rhs.version = CPN_CURRENT_SETTINGS_VERSION; // depreciated in EdgeTX however data conversions use rhs.version = CPN_CURRENT_SETTINGS_VERSION; // depreciated in EdgeTX however data conversions use
@@ -1340,20 +1340,28 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
// TODO display model filename in preference to model name as easier for user // TODO display model filename in preference to model name as easier for user
if (modelSettingsVersion > SemanticVersion(VERSION)) { if (modelSettingsVersion > SemanticVersion(VERSION)) {
QString prmpt = QCoreApplication::translate("YamlModelSettings", "Warning: '%1' has settings version %2 that is not supported by this version of Companion!\n\nModel settings may be corrupted if you continue."); // TODO remove this check as part of 3.0 release
prmpt = prmpt.arg(rhs.name).arg(modelSettingsVersion.toString()); if (modelSettingsVersion == SemanticVersion("3.0.0") &&
QMessageBox msgBox; SemanticVersion(VERSION) >= SemanticVersion("2.12.0") &&
msgBox.setWindowTitle(QCoreApplication::translate("YamlModelSettings", "Read Model Settings")); SemanticVersion(VERSION) < SemanticVersion("3.0.0")) {
msgBox.setText(prmpt); qDebug() << "Version exception override: radio settings" << modelSettingsVersion.toString()
msgBox.setIcon(QMessageBox::Warning); << "Companion" << SemanticVersion(VERSION).toString();
QPushButton *pbAccept = new QPushButton(CPN_STR_TTL_ACCEPT); } else {
QPushButton *pbDecline = new QPushButton(CPN_STR_TTL_DECLINE); QString prmpt = QCoreApplication::translate("YamlModelSettings", "Warning: '%1' has settings version %2 that is not supported by Companion %3!\n\nModel settings may be corrupted if you continue.");
msgBox.addButton(pbAccept, QMessageBox::AcceptRole); prmpt = prmpt.arg(rhs.name).arg(modelSettingsVersion.toString()).arg(SemanticVersion(VERSION).toString());
msgBox.addButton(pbDecline, QMessageBox::RejectRole); QMessageBox msgBox;
msgBox.setDefaultButton(pbDecline); msgBox.setWindowTitle(QCoreApplication::translate("YamlModelSettings", "Read Model Settings"));
msgBox.exec(); msgBox.setText(prmpt);
if (msgBox.clickedButton() == pbDecline) msgBox.setIcon(QMessageBox::Warning);
return false; QPushButton *pbAccept = new QPushButton(CPN_STR_TTL_ACCEPT);
QPushButton *pbDecline = new QPushButton(CPN_STR_TTL_DECLINE);
msgBox.addButton(pbAccept, QMessageBox::AcceptRole);
msgBox.addButton(pbDecline, QMessageBox::RejectRole);
msgBox.setDefaultButton(pbDecline);
msgBox.exec();
if (msgBox.clickedButton() == pbDecline)
return false;
}
} }
if (node["timers"]) { if (node["timers"]) {