From 7ec8b39661310c79f30f7b009619cad29a5e5a67 Mon Sep 17 00:00:00 2001 From: Neil Horne <15316949+elecpower@users.noreply.github.com> Date: Sun, 7 Dec 2025 08:27:17 +1100 Subject: [PATCH] chore(cpn): do not warn when reading v3.0 models and settings on v2.12 (#6843) --- .../firmwares/edgetx/yaml_generalsettings.cpp | 36 +++++++++++-------- .../src/firmwares/edgetx/yaml_modeldata.cpp | 36 +++++++++++-------- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp index 343d1670e..6f69d8356 100644 --- a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp +++ b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp @@ -422,20 +422,28 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) qDebug() << "Settings version:" << radioSettingsVersion.toString(); 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."); - prmpt = prmpt.arg(radioSettingsVersion.toString()); - QMessageBox msgBox; - msgBox.setWindowTitle(QCoreApplication::translate("YamlGeneralSettings", "Read Radio Settings")); - msgBox.setText(prmpt); - msgBox.setIcon(QMessageBox::Warning); - 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; + // TODO remove this temporary 2.12 fix check for 3.0 release + if (radioSettingsVersion == SemanticVersion("3.0.0") && + SemanticVersion(VERSION) >= SemanticVersion("2.12.0") && + SemanticVersion(VERSION) < SemanticVersion("3.0.0")) { + qDebug() << "Version exception override: radio settings" << radioSettingsVersion.toString() + << "Companion" << SemanticVersion(VERSION).toString(); + } else { + 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."); + prmpt = prmpt.arg(radioSettingsVersion.toString()).arg(SemanticVersion(VERSION).toString()); + QMessageBox msgBox; + msgBox.setWindowTitle(QCoreApplication::translate("YamlGeneralSettings", "Read Radio Settings")); + msgBox.setText(prmpt); + msgBox.setIcon(QMessageBox::Warning); + 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 diff --git a/companion/src/firmwares/edgetx/yaml_modeldata.cpp b/companion/src/firmwares/edgetx/yaml_modeldata.cpp index 7e1146b28..07129cb1e 100644 --- a/companion/src/firmwares/edgetx/yaml_modeldata.cpp +++ b/companion/src/firmwares/edgetx/yaml_modeldata.cpp @@ -1340,20 +1340,28 @@ bool convert::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: '%1' has settings version %2 that is not supported by this version of Companion!\n\nModel settings may be corrupted if you continue."); - prmpt = prmpt.arg(rhs.name).arg(modelSettingsVersion.toString()); - QMessageBox msgBox; - msgBox.setWindowTitle(QCoreApplication::translate("YamlModelSettings", "Read Model Settings")); - msgBox.setText(prmpt); - msgBox.setIcon(QMessageBox::Warning); - 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; + // TODO remove this check as part of 3.0 release + if (modelSettingsVersion == SemanticVersion("3.0.0") && + SemanticVersion(VERSION) >= SemanticVersion("2.12.0") && + SemanticVersion(VERSION) < SemanticVersion("3.0.0")) { + qDebug() << "Version exception override: radio settings" << modelSettingsVersion.toString() + << "Companion" << SemanticVersion(VERSION).toString(); + } else { + 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."); + prmpt = prmpt.arg(rhs.name).arg(modelSettingsVersion.toString()).arg(SemanticVersion(VERSION).toString()); + QMessageBox msgBox; + msgBox.setWindowTitle(QCoreApplication::translate("YamlModelSettings", "Read Model Settings")); + msgBox.setText(prmpt); + msgBox.setIcon(QMessageBox::Warning); + 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"]) {