Re #2503: Standalone simulator now remembers which radio was simulated in previous session

This commit is contained in:
Damjan Adamic
2015-07-19 14:54:33 +02:00
parent 576ce4983d
commit 84fe232b0c
3 changed files with 15 additions and 1 deletions
+9 -1
View File
@@ -54,6 +54,7 @@
#endif
#include "simulatordialog.h"
#include "eeprominterface.h"
#include "appdata.h"
#if defined WIN32 || !defined __GNUC__
#include <windows.h>
@@ -130,15 +131,22 @@ int main(int argc, char *argv[])
eedir.cd("OpenTX");
QStringList firmwareIds;
int currentIdx = 0;
foreach(SimulatorFactory *factory, registered_simulators) {
firmwareIds << factory->name();
if (factory->name() == g.lastSimulator()) {
currentIdx = firmwareIds.size() - 1;
}
}
bool ok;
QString firmwareId = QInputDialog::getItem(0, QObject::tr("Radio type"),
QObject::tr("Which radio type do you want to simulate?"),
firmwareIds, 0, false, &ok);
firmwareIds, currentIdx, false, &ok);
if (ok && !firmwareId.isEmpty()) {
if (firmwareId != g.lastSimulator()) {
g.lastSimulator(firmwareId);
}
QString radioId;
int pos = firmwareId.indexOf("-");
if (pos > 0) {