chore(cpn): upgrade to Ubuntu 22.04 and Qt 6.9.0 (#5986)

Co-authored-by: elecpower <elecpower@users.noreply.github.com>
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
Neil Horne
2025-07-23 14:04:19 +02:00
committed by GitHub
co-authored by elecpower raphaelcoeffic
parent 7264b28e62
commit 9e86a3ea84
117 changed files with 4221 additions and 5155 deletions
+4 -59
View File
@@ -371,13 +371,14 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
simuData->setCurrentModel(modelIdx);
}
#ifdef __APPLE__
SimulatorMainWindow * dialog = new SimulatorMainWindow(parent, simulatorId, flags);
dialog->setWindowModality(Qt::ApplicationModal);
dialog->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(dialog, &SimulatorMainWindow::destroyed, [simuData] (void) {
#ifdef __APPLE__
simulatorRunning = false;
#endif
// TODO simuData and Horus tmp directory is deleted on simulator close OR we could use it to get back data from the simulation
delete simuData;
});
@@ -389,70 +390,14 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
QMessageBox::critical(NULL, QCoreApplication::translate("Companion", "Simulator Error"), resultMsg);
dialog->deleteLater();
} else if (dialog->setRadioData(simuData)) {
#ifdef __APPLE__
simulatorRunning = true;
#endif
dialog->show();
} else {
QMessageBox::critical(NULL, QCoreApplication::translate("Companion", "Data Load Error"), QCoreApplication::translate("Companion", "Error occurred while starting simulator."));
dialog->deleteLater();
}
#else
// the directory will be automatically deleted when QTemporaryDir goes out of scope
QTemporaryDir tmpDir(QDir::tempPath() + "/etx-XXXXXX");
if (tmpDir.isValid()) {
qDebug() << "Created temporary settings directory" << tmpDir.path();
}
else {
QString resultMsg = QCoreApplication::translate("Companion", "Error creating temporary directory for models and settings.");
QMessageBox::critical(NULL, QCoreApplication::translate("Companion", "Simulator Error"), resultMsg);
return;
}
simuData->fixModelFilenames();
Storage storage(tmpDir.path());
if (!storage.write(*simuData)) {
QString resultMsg = QCoreApplication::translate("Companion", "Error writing models and settings to temporary directory.");
QMessageBox::critical(NULL, QCoreApplication::translate("Companion", "Simulator Error"), resultMsg);
return;
}
const QString path = QCoreApplication::applicationDirPath();
#if defined Q_OS_WIN
const QString program = "simulator.exe";
#elif defined Q_OS_APPLE
const QString program = "simulator.dmg";
#else
const QString program = QString("simulator%1%2").arg(VERSION_MAJOR).arg(VERSION_MINOR);
#endif
QStringList arguments;
arguments << "--profile" << g.currentProfile().name()
<< "--start-with" << "folder"
<< "--flags" << QString::number(flags)
<< tmpDir.path();
QProcess *simu = new QProcess(parent);
qDebug() << "Launching simulator with command:" << QDir::toNativeSeparators(path % "/" % program) << arguments;
// wait for the simulator to finish
int result = simu->execute(path % "/" % program, arguments);
QString resultMsg;
if (result == -2)
resultMsg = QCoreApplication::translate("Companion", "Unable to start.");
else if (result == -1)
resultMsg = QCoreApplication::translate("Companion", "Crashed.");
else if (result > 0)
resultMsg = QCoreApplication::translate("Companion", "Exited with result code:") % QString(result);
if (result != 0)
QMessageBox::critical(NULL, QCoreApplication::translate("Companion", "Simulator Error"), resultMsg);
if (simuData)
delete simuData;
#endif
}
QPixmap makePixMap(const QImage & image)