1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-26 09:45:16 +03:00

[Simulator] Make sure a default Data File is always suggested in startup dialog; Fix silent exit upon startup if no file/data was provided.

This commit is contained in:
Max Paperno 2017-02-01 03:48:06 -05:00
parent fe76ecfe02
commit 9c6a543434
3 changed files with 13 additions and 4 deletions

View file

@ -202,12 +202,13 @@ bool SimulatorDialog::setStartupData(const QByteArray & dataSource, bool fromFil
}
}
// again there's no way to tell what the error from Storage actually was, so if the file doesn't exist we'll create a new one
else if (!QFile(QString(dataSource)).exists()) {
else if (!dataSource.isEmpty() && !QFile(QString(dataSource)).exists()) {
startupData = dataSource;
startupFromFile = true;
return true;
}
else {
ret = 0;
error = store.error();
}
}
@ -265,6 +266,10 @@ bool SimulatorDialog::setOptions(SimulatorOptions & options, bool withSave)
else if (options.startupDataType == SimulatorOptions::START_WITH_FILE && !options.dataFile.isEmpty()) {
ret = setStartupData(options.dataFile.toLocal8Bit(), true);
}
else {
QString error = tr("Invalid startup data provided. Plese specify a proper file/path.");
QMessageBox::critical(this, tr("Simulator Startup Error"), error);
}
if (ret && withSave)
g.profile[radioProfileId].simulatorOptions(options);