[Simulator] Add ability to update .otx files. (#4422)
* [SimulatorInterface] Add ability to read eeprom data back from simulator instance. * [Simulator] If started with .otx file, Simulator will now update (or create) the file upon exit using current radio/model data; Consolidate internal startup and shutdown code for handling various data sources.
This commit is contained in:
committed by
Bertrand Songis
parent
2589e35ad5
commit
3a026a80f2
@@ -824,22 +824,23 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
||||
}
|
||||
|
||||
SimulatorMainWindow * dialog = new SimulatorMainWindow(parent, simulator, flags);
|
||||
if (IS_HORUS(getCurrentBoard()) && !dialog->useTempDataPath(true)) {
|
||||
QMessageBox::critical(NULL, QObject::tr("Data Load Error"), QObject::tr("Error: Could not create temporary directory in '%1'").arg(QDir::tempPath()));
|
||||
if (!dialog->setRadioData(simuData)) {
|
||||
QMessageBox::critical(NULL, QObject::tr("Data Load Error"), QObject::tr("Error occurred while starting simulator."));
|
||||
delete dialog;
|
||||
delete simuData;
|
||||
return;
|
||||
}
|
||||
dialog->setRadioData(simuData);
|
||||
|
||||
dialog->setWindowModality(Qt::ApplicationModal);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->start();
|
||||
dialog->show();
|
||||
|
||||
QObject::connect(dialog, &SimulatorMainWindow::destroyed, [simuData] (void) {
|
||||
// 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;
|
||||
});
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(NULL,
|
||||
|
||||
Reference in New Issue
Block a user