diff --git a/companion/src/appdata.h b/companion/src/appdata.h index b0a19cf74..f067ef52c 100644 --- a/companion/src/appdata.h +++ b/companion/src/appdata.h @@ -15,7 +15,7 @@ #define MAX_PROFILES 15 #define MAX_JOYSTICKS 8 -class DataObj +class CompanionDataObj { public: void clear (const QString tag1="", const QString tag2="", const QString tag3="") @@ -199,7 +199,7 @@ public: } }; -class FwRevision:DataObj +class FwRevision:CompanionDataObj { public: int get( const QString fwName ) @@ -221,7 +221,7 @@ public: } }; -class JStickData:DataObj +class JStickData:CompanionDataObj { private: int index; @@ -306,7 +306,7 @@ public: } }; -class Profile:DataObj +class Profile:CompanionDataObj { private: // Class Internal Variable @@ -483,7 +483,7 @@ public: } }; -class AppData:DataObj +class AppData:CompanionDataObj { // All the global variables public: @@ -501,6 +501,7 @@ private: QString _avrArguments; QString _avrPort; QString _avrdudeLocation; + QString _compileServer; QString _cpuId; QString _dfuArguments; QString _dfuLocation; @@ -512,14 +513,14 @@ private: QString _sambaPort; QString _backupDir; - QString _compileServer; QString _gePath; - QString _lastDir; + QString _eepromDir; QString _flashDir; QString _imagesDir; QString _logDir; QString _libDir; QString _snapshotDir; + QString _updatesDir; bool _enableBackup; bool _backupOnFlash; @@ -557,6 +558,7 @@ public: QString avrArguments() { return _avrArguments; } QString avrPort() { return _avrPort; } QString avrdudeLocation() { return _avrdudeLocation; } + QString compileServer() { return _compileServer; } QString cpuId() { return _cpuId; } QString dfuArguments() { return _dfuArguments; } QString dfuLocation() { return _dfuLocation; } @@ -568,14 +570,14 @@ public: QString sambaPort() { return _sambaPort; } QString backupDir() { return _backupDir; } - QString compileServer() { return _compileServer; } QString gePath() { return _gePath; } - QString lastDir() { return _lastDir; } + QString eepromDir() { return _eepromDir; } QString flashDir() { return _flashDir; } QString imagesDir() { return _imagesDir; } QString logDir() { return _logDir; } QString libDir() { return _libDir; } QString snapshotDir() { return _snapshotDir; } + QString updatesDir() { return _updatesDir; } bool enableBackup() { return _enableBackup; } bool backupOnFlash() { return _backupOnFlash; } @@ -611,6 +613,7 @@ public: void avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );} void avrPort (const QString x) { store(x, _avrPort, "avr_port" );} void avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );} + void compileServer (const QString x) { store(x, _compileServer, "compilation-server" );} void cpuId (const QString x) { store(x, _cpuId, "cpu_id" );} void dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );} void dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );} @@ -622,14 +625,14 @@ public: void sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );} void backupDir (const QString x) { store(x, _backupDir, "backupPath" );} - void compileServer (const QString x) { store(x, _compileServer, "compilation-server" );} void gePath (const QString x) { store(x, _gePath, "gePath" );} - void lastDir (const QString x) { store(x, _lastDir, "lastDir" );} + void eepromDir (const QString x) { store(x, _eepromDir, "lastDir" );} void flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );} void imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );} void logDir (const QString x) { store(x, _logDir, "lastLogDir" );} void libDir (const QString x) { store(x, _libDir, "libraryPath" );} void snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );} + void updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );} void enableBackup (const bool x) { store(x, _enableBackup, "backupEnable" );} void backupOnFlash (const bool x) { store(x, _backupOnFlash, "backupOnFlash" );} @@ -715,6 +718,7 @@ public: getset( _avrArguments, "avr_arguments" ,"" ); getset( _avrPort, "avr_port" ,"" ); getset( _avrdudeLocation, "avrdudeLocation" ,"" ); + getset( _compileServer, "compilation-server" ,"" ); getset( _cpuId, "cpu_id" ,"" ); getset( _dfuArguments, "dfu_arguments" ,"-a 0" ); getset( _dfuLocation, "dfu_location" ,"" ); @@ -726,14 +730,14 @@ public: getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" ); getset( _backupDir, "backupPath" ,"" ); - getset( _compileServer, "compilation-server" ,"" ); getset( _gePath, "gePath" ,"" ); - getset( _lastDir, "lastDir" ,"" ); + getset( _eepromDir, "lastDir" ,"" ); getset( _flashDir, "lastFlashDir" ,"" ); getset( _imagesDir, "lastImagesDir" ,"" ); getset( _logDir, "lastLogDir" ,"" ); getset( _libDir, "libraryPath" ,"" ); getset( _snapshotDir, "snapshotpath" ,"" ); + getset( _updatesDir, "lastUpdatesDir" ,"" ); getset( _enableBackup, "backupEnable" ,false ); getset( _backupOnFlash, "backupOnFlash" ,true ); diff --git a/companion/src/burndialog.cpp b/companion/src/burndialog.cpp index db48c29fb..e7f48e0b3 100644 --- a/companion/src/burndialog.cpp +++ b/companion/src/burndialog.cpp @@ -144,7 +144,7 @@ void burnDialog::on_FlashLoadButton_clicked() checkFw(fileName); } else { - QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.lastDir(), tr(EXTERNAL_EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER)); if (checkeEprom(fileName)) { if (burnraw==false) { ui->BurnFlashButton->setEnabled(true); diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 5a924696b..71196884a 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -263,12 +263,12 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply) if (ret == QMessageBox::Yes) { #if defined __APPLE__ - QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastUpdatesDir() + QString(C9X_INSTALLER).arg(version)); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version)); #else - QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastUpdatesDir() + QString(C9X_INSTALLER).arg(version), tr("Executable (*.exe)")); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version), tr("Executable (*.exe)")); #endif if (!fileName.isEmpty()) { - g.lastUpdatesDir(QFileInfo(fileName).dir().absolutePath()); + g.updatesDir(QFileInfo(fileName).dir().absolutePath()); downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName); installer_fileName = fileName; connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded())); @@ -642,9 +642,9 @@ void MainWindow::openDocURL() void MainWindow::openFile() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.lastDir(), tr(EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.eepromDir(), tr(EEPROM_FILES_FILTER)); if (!fileName.isEmpty()) { - g.lastDir(QFileInfo(fileName).dir().absolutePath()); + g.eepromDir(QFileInfo(fileName).dir().absolutePath()); QMdiSubWindow *existing = findMdiChild(fileName); if (existing) { @@ -1055,7 +1055,7 @@ void MainWindow::writeFileToEeprom() burnDialog *cd = new burnDialog(this, 1, &fileName, &backup); cd->exec(); if (!fileName.isEmpty()) { - g.lastDir(QFileInfo(fileName).dir().absolutePath()); + g.eepromDir(QFileInfo(fileName).dir().absolutePath()); int ret = QMessageBox::question(this, "Companion", tr("Write Models and settings from %1 to the Tx?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No); if (ret != QMessageBox::Yes) return; if (!isValidEEPROM(fileName)) @@ -1401,7 +1401,7 @@ void MainWindow::writeFlash(QString fileToFlash) void MainWindow::readEepromToFile() { - QString fileName = QFileDialog::getSaveFileName(this, tr("Save transmitter Models and Settings to File"), g.lastDir(), tr(EXTERNAL_EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save transmitter Models and Settings to File"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER)); if (!fileName.isEmpty()) { EEPROMInterface *eepromInterface = GetEepromInterface(); if (IS_TARANIS(eepromInterface->getBoard())) { @@ -1420,7 +1420,7 @@ void MainWindow::readEepromToFile() } } else { - g.lastDir(QFileInfo(fileName).dir().absolutePath()); + g.eepromDir(QFileInfo(fileName).dir().absolutePath()); QStringList str = GetReceiveEEpromCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); ad->setWindowIcon(CompanionIcon("read_eeprom.png")); @@ -2088,7 +2088,7 @@ void MainWindow::dropEvent(QDropEvent *event) QString fileName = urls.first().toLocalFile(); if (fileName.isEmpty()) return; - g.lastDir(QFileInfo(fileName).dir().absolutePath()); + g.eepromDir(QFileInfo(fileName).dir().absolutePath()); QMdiSubWindow *existing = findMdiChild(fileName); if (existing) { diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index cee87c3fc..759e068b6 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -351,17 +351,17 @@ bool MdiChild::saveAs(bool isNew) curFile.replace(".eepe", ".bin"); QFileInfo fi(curFile); #ifdef __APPLE__ - fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastDir() + "/" +fi.fileName()); + fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName()); #else - fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastDir() + "/" +fi.fileName(), tr(BIN_FILES_FILTER)); + fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(BIN_FILES_FILTER)); #endif } else { QFileInfo fi(curFile); #ifdef __APPLE__ - fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastDir() + "/" +fi.fileName()); + fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName()); #else - fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastDir() + "/" +fi.fileName(), tr(EEPROM_FILES_FILTER)); + fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(EEPROM_FILES_FILTER)); #endif } if (fileName.isEmpty()) @@ -372,7 +372,7 @@ bool MdiChild::saveAs(bool isNew) if (fileName.contains("norev4a")) { g.rev4aSupport( false ); } - g.lastDir( QFileInfo(fileName).dir().absolutePath() ); + g.eepromDir( QFileInfo(fileName).dir().absolutePath() ); if (isNew) return saveFile(fileName); else @@ -681,7 +681,7 @@ void MdiChild::setEEpromAvail(int eavail) bool MdiChild::loadBackup() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.lastDir(),tr(EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.eepromDir(),tr(EEPROM_FILES_FILTER)); if (fileName.isEmpty()) return false; QFile file(fileName);