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:
parent
fe76ecfe02
commit
9c6a543434
3 changed files with 13 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue