Re #2503: Standalone simulator now remembers which radio was simulated in previous session
This commit is contained in:
@@ -512,6 +512,7 @@ QString AppData::mcu() { return _mcu; }
|
||||
QString AppData::programmer() { return _programmer; }
|
||||
QString AppData::sambaLocation() { return _sambaLocation; }
|
||||
QString AppData::sambaPort() { return _sambaPort; }
|
||||
QString AppData::lastSimulator() { return _lastSimulator; }
|
||||
|
||||
QString AppData::backupDir() { return _backupDir; }
|
||||
QString AppData::gePath() { return _gePath; }
|
||||
@@ -560,6 +561,7 @@ void AppData::mcu (const QString x) { store(x, _mcu,
|
||||
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
|
||||
void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
|
||||
void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
|
||||
void AppData::lastSimulator (const QString x) { store(x, _lastSimulator, "last_simulator" );}
|
||||
|
||||
void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
|
||||
void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );}
|
||||
@@ -716,6 +718,7 @@ AppData::AppData()
|
||||
getset( _programmer, "programmer" ,"usbasp" );
|
||||
getset( _sambaLocation, "samba_location" ,"" );
|
||||
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
|
||||
getset( _lastSimulator, "last_simulator" ,"" );
|
||||
|
||||
getset( _backupDir, "backupPath" ,"" );
|
||||
getset( _gePath, "gePath" ,"" );
|
||||
|
||||
@@ -240,6 +240,7 @@ class AppData: protected CompStoreObj
|
||||
QString _programmer;
|
||||
QString _sambaLocation;
|
||||
QString _sambaPort;
|
||||
QString _lastSimulator;
|
||||
|
||||
QString _backupDir;
|
||||
QString _gePath;
|
||||
@@ -290,6 +291,7 @@ class AppData: protected CompStoreObj
|
||||
QString programmer();
|
||||
QString sambaLocation();
|
||||
QString sambaPort();
|
||||
QString lastSimulator();
|
||||
|
||||
QString backupDir();
|
||||
QString gePath();
|
||||
@@ -339,6 +341,7 @@ class AppData: protected CompStoreObj
|
||||
void programmer (const QString);
|
||||
void sambaLocation (const QString);
|
||||
void sambaPort (const QString);
|
||||
void lastSimulator (const QString);
|
||||
|
||||
void backupDir (const QString);
|
||||
void gePath (const QString);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user