From deb08e8f6873b508de43f5c44bcb7b976778b325 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Fri, 1 May 2015 15:56:31 +0200 Subject: [PATCH 1/6] Implement profile specific settings for backup folder. Profile backup path if set overrides general one, in any case the backup will be performed if either profile specific setting or general settings ones are enabled. Disabling backup in profile will not disable backups if generic settings are enabled --- companion/src/appdata.cpp | 10 + companion/src/appdata.h | 6 + companion/src/apppreferencesdialog.cpp | 56 ++- companion/src/apppreferencesdialog.h | 7 +- companion/src/apppreferencesdialog.ui | 663 ++++++++++++++----------- 5 files changed, 452 insertions(+), 290 deletions(-) diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index b4332cfa3..32666bbd6 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -295,8 +295,10 @@ QString Profile::fwName() const { return _fwName; } QString Profile::fwType() const { return _fwType; } QString Profile::name() const { return _name; } QString Profile::sdPath() const { return _sdPath; } +QString Profile::pBackupDir() const { return _pBackupDir; } QString Profile::splashFile() const { return _splashFile; } bool Profile::burnFirmware() const { return _burnFirmware; } +bool Profile::penableBackup() const { return _penableBackup; } bool Profile::renameFwFiles() const { return _renameFwFiles; } int Profile::channelOrder() const { return _channelOrder; } int Profile::defaultMode() const { return _defaultMode; } @@ -322,9 +324,11 @@ void Profile::name (const QString x) { store(x, _name, "Name" void Profile::fwName (const QString x) { store(x, _fwName, "fwName" ,"Profiles", QString("profile%1").arg(index));} void Profile::fwType (const QString x) { store(x, _fwType, "fwType" ,"Profiles", QString("profile%1").arg(index));} void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} +void Profile::pBackupDir (const QString x) { store(x, _pBackupDir, "pBackupDir" ,"Profiles", QString("profile%1").arg(index));} void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));} void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));} void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));} +void Profile::penableBackup (const bool x) { store(x, _penableBackup, "penableBackup" ,"Profiles", QString("profile%1").arg(index));} void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));} void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));} @@ -357,9 +361,11 @@ Profile& Profile::operator=(const Profile& rhs) fwName ( rhs.fwName() ); fwType ( rhs.fwType() ); sdPath ( rhs.sdPath() ); + pBackupDir ( rhs.pBackupDir() ); splashFile ( rhs.splashFile() ); burnFirmware ( rhs.burnFirmware() ); renameFwFiles( rhs.renameFwFiles() ); + penableBackup( rhs.penableBackup() ); channelOrder ( rhs.channelOrder() ); defaultMode ( rhs.defaultMode() ); beeper ( rhs.beeper() ); @@ -432,9 +438,11 @@ void Profile::init(int newIndex) _fwType = ""; _name = ""; _sdPath = ""; + _pBackupDir = ""; _splashFile = ""; _burnFirmware = false; _renameFwFiles = false; + _penableBackup = false; _channelOrder = 0; _defaultMode = 1; @@ -454,8 +462,10 @@ void Profile::flush() getset( _fwType, "fwType" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _pBackupDir, "pBackupDir" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _penableBackup, "penableBackup" ,false ,"Profiles", QString("profile%1").arg(index)); getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); diff --git a/companion/src/appdata.h b/companion/src/appdata.h index 4d6b451f3..0671b60c3 100644 --- a/companion/src/appdata.h +++ b/companion/src/appdata.h @@ -107,8 +107,10 @@ class Profile: protected CompStoreObj QString _fwType; QString _name; QString _sdPath; + QString _pBackupDir; QString _splashFile; bool _burnFirmware; + bool _penableBackup; bool _renameFwFiles; int _channelOrder; int _defaultMode; @@ -136,9 +138,11 @@ class Profile: protected CompStoreObj QString fwType() const; QString name() const; QString sdPath() const; + QString pBackupDir() const; QString splashFile() const; bool burnFirmware() const; bool renameFwFiles() const; + bool penableBackup() const; int channelOrder() const; int defaultMode() const; @@ -163,9 +167,11 @@ class Profile: protected CompStoreObj void fwName (const QString); void fwType (const QString); void sdPath (const QString); + void pBackupDir (const QString); void splashFile (const QString); void burnFirmware (const bool); void renameFwFiles (const bool); + void penableBackup (const bool); void channelOrder (const int); void defaultMode (const int); diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 0232c787c..efac55a3f 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -18,6 +18,10 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget *parent) : ui->setupUi(this); updateLock=false; setWindowIcon(CompanionIcon("apppreferences.png")); + ui->backupPathClear->setIcon(CompanionIcon("clear.png")); + ui->pBackupPathClear->setIcon(CompanionIcon("clear.png")); + ui->libraryPathClear->setIcon(CompanionIcon("clear.png")); + ui->sdPathClear->setIcon(CompanionIcon("clear.png")); initSettings(); connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged())); @@ -66,6 +70,8 @@ void AppPreferencesDialog::writeValues() g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked()); g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked()); g.profile[g.id()].sdPath(ui->sdPath->text()); + g.profile[g.id()].pBackupDir(ui->profilebackupPath->text()); + g.profile[g.id()].penableBackup(ui->pbackupEnable->isChecked()); g.profile[g.id()].splashFile(ui->SplashFileName->text()); // The profile name may NEVER be empty @@ -164,6 +170,19 @@ void AppPreferencesDialog::initSettings() ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode()); ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles()); ui->sdPath->setText(g.profile[g.id()].sdPath()); + ui->profilebackupPath->setText(g.profile[g.id()].pBackupDir()); + if (!g.profile[g.id()].pBackupDir().isEmpty()) { + if (QDir(g.profile[g.id()].pBackupDir()).exists()) { + ui->profilebackupPath->setText(g.backupDir()); + ui->pbackupEnable->setEnabled(true); + ui->pbackupEnable->setChecked(g.profile[g.id()].penableBackup()); + } else { + ui->pbackupEnable->setDisabled(true); + } + } else { + ui->pbackupEnable->setDisabled(true); + } + ui->profileNameLE->setText(g.profile[g.id()].name()); ui->SplashFileName->setText(g.profile[g.id()].splashFile()); @@ -224,8 +243,43 @@ void AppPreferencesDialog::on_backupPathButton_clicked() if (!fileName.isEmpty()) { g.backupDir(fileName); ui->backupPath->setText(fileName); + ui->backupEnable->setEnabled(true); } - ui->backupEnable->setEnabled(true); +} + +void AppPreferencesDialog::on_ProfilebackupPathButton_clicked() +{ + QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir()); + if (!fileName.isEmpty()) { + ui->profilebackupPath->setText(fileName); + ui->pbackupEnable->setEnabled(true); + } +} + +void AppPreferencesDialog::on_sdPathClear_clicked() +{ + g.profile[g.id()].sdPath(""); + ui->sdPath->clear(); +} + +void AppPreferencesDialog::on_pBackupPathClear_clicked() +{ + g.profile[g.id()].pBackupDir(""); + ui->profilebackupPath->clear(); + ui->pbackupEnable->setDisabled(true); +} + +void AppPreferencesDialog::on_backupPathClear_clicked() +{ + g.backupDir(""); + ui->backupPath->clear(); + ui->backupEnable->setDisabled(true); +} + +void AppPreferencesDialog::on_libraryPathClear_clicked() +{ + g.libDir(""); + ui->libraryPath->clear(); } void AppPreferencesDialog::on_ge_pathButton_clicked() diff --git a/companion/src/apppreferencesdialog.h b/companion/src/apppreferencesdialog.h index 2e5a3641f..f2e8bd172 100644 --- a/companion/src/apppreferencesdialog.h +++ b/companion/src/apppreferencesdialog.h @@ -47,8 +47,13 @@ class AppPreferencesDialog : public QDialog void on_snapshotPathButton_clicked(); void on_snapshotClipboardCKB_clicked(); void on_backupPathButton_clicked(); + void on_ProfilebackupPathButton_clicked(); void on_ge_pathButton_clicked(); - + void on_sdPathClear_clicked(); + void on_pBackupPathClear_clicked(); + void on_backupPathClear_clicked(); + void on_libraryPathClear_clicked(); + void on_sdPathButton_clicked(); void on_removeProfileButton_clicked(); void on_SplashSelect_clicked(); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index bbbfc8174..e5e531b76 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -6,7 +6,7 @@ 0 0 - 685 + 686 550 @@ -26,13 +26,7 @@ Edit Settings - - 2 - - - 6 - - + Qt::Horizontal @@ -42,7 +36,7 @@ - + 0 @@ -51,110 +45,8 @@ Radio Profile - - - - - Open Folder - - - - - - - - 0 - 0 - - - - Default Channel Order - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Build Options - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Menu Language - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Default Stick Mode - - - - - - - Select Image - - - - - - - true - - - General Settings Label - - - - - - - Qt::Horizontal - - - - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Splash Screen - - - - + + @@ -167,51 +59,17 @@ - - - - Clear Image + + + + + + + Qt::Horizontal - - - - - 0 - 0 - - - - - 128 - 64 - - - - - 212 - 64 - - - - QFrame::Panel - - - QFrame::Plain - - - 1 - - - - - - true - - - - + @@ -234,57 +92,24 @@ - - - - Qt::Horizontal + + + + true - - - - Qt::Horizontal - - - - - - - - 75 - true - - + + - Other Settings - - - - - - - General Settings - - - - - - - - 0 - 0 - - - - SD Structure path + Menu Language Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + QLayout::SetDefaultConstraint @@ -338,14 +163,46 @@ May be different from firmware language - - - - true + + + + Build Options + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Splash Screen + + + + true @@ -355,7 +212,80 @@ May be different from firmware language - + + + + + 0 + 0 + + + + + 128 + 64 + + + + + 212 + 64 + + + + QFrame::Panel + + + QFrame::Plain + + + 1 + + + + + + true + + + + + + + Qt::Horizontal + + + + + + + + 75 + true + + + + Other Settings + + + + + + + + 0 + 0 + + + + SD Structure path + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + true @@ -365,7 +295,130 @@ May be different from firmware language - + + + + + 0 + 0 + + + + + 16 + 16 + + + + + + + + :/themes/classic/16/clear.png:/themes/classic/16/clear.png + + + + + + + Open Folder + + + + + + + The profile specific folder, if set, will override general Backup folder + + + Backup folder + + + + + + + If set it will override the application general setting + + + true + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + + + + :/themes/classic/16/clear.png:/themes/classic/16/clear.png + + + + + + + The profile specific folder, if set, will override general Backup folder + + + Open Folder + + + + + + + if set, will override general backup enable + + + Enable automatic backup before writing firmware + + + + + + + General Settings + + + + + + + true + + + General Settings Label + + + + + + + + 0 + 0 + + + + Default Stick Mode + + + + @@ -419,7 +472,23 @@ Mode 4: - + + + + + 0 + 0 + + + + Default Channel Order + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + @@ -567,31 +636,21 @@ Mode 4: - - - - - - - Remove Profile - - - - + Append version number to FW file name - + Offer to write FW to Tx after download - + Qt::Vertical @@ -604,6 +663,27 @@ Mode 4: + + + + Clear Image + + + + + + + Select Image + + + + + + + Remove Profile + + + @@ -611,17 +691,7 @@ Mode 4: Application Settings - - - - Show splash screen when Companion starts - - - true - - - - + Automatic check for Companion updates @@ -631,28 +701,38 @@ Mode 4: - + + + + Show splash screen when Companion starts + + + true + + + + Enable automatic backup before writing firmware - + Qt::Horizontal - + Qt::Horizontal - + Automatic check for OpenTX firmware updates @@ -672,19 +752,6 @@ Mode 4: - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -698,7 +765,7 @@ Mode 4: - + Open Folder @@ -731,21 +798,21 @@ Mode 4: - + Find Executable - + Qt::Horizontal - + Open Folder @@ -772,26 +839,6 @@ Mode 4: - - - - - 0 - 0 - - - - - Only show user splash images - - - - - Show user and companion splash images - - - - @@ -834,20 +881,55 @@ Mode 4: - - + + Qt::Horizontal - + + + + + + Use model wizard when creating a new model + + + + + + - 40 - 20 + 16 + 16 - + + + + + + :/themes/classic/16/clear.png:/themes/classic/16/clear.png + + - + + + + + 16 + 16 + + + + + + + + :/themes/classic/16/clear.png:/themes/classic/16/clear.png + + + + @@ -860,18 +942,24 @@ Mode 4: - - - - Qt::Horizontal - - - - - - - Use model wizard when creating a new model + + + + + 0 + 0 + + + + Only show user splash images + + + + + Show user and companion splash images + + @@ -1050,7 +1138,6 @@ Mode 4: tabWidget - profileNameLE removeProfileButton downloadVerCB langCombo From 116b147c51d796227cf5d956b223d75274d05d0f Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Fri, 1 May 2015 18:13:23 +0200 Subject: [PATCH 2/6] Implement profile specific settings for backup folder. Profile backup path if set overrides general one, in any case the backup will be performed if either profile specific setting or general settings ones are enabled. Disabling backup in profile will not disable backups if generic settings are enabled --- companion/src/flasheepromdialog.cpp | 13 +++++++++++-- companion/src/flashfirmwaredialog.cpp | 12 ++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/companion/src/flasheepromdialog.cpp b/companion/src/flasheepromdialog.cpp index 14dfdb8bd..a31206d35 100755 --- a/companion/src/flasheepromdialog.cpp +++ b/companion/src/flasheepromdialog.cpp @@ -22,7 +22,11 @@ radioData(new RadioData()) ui->eepromFilename->hide(); ui->eepromLoad->hide(); } - QString backupPath = g.backupDir(); + QString backupPath = g.profile[g.id()].pBackupDir(); + if (backupPath.isEmpty()) { + backupPath=g.backupDir(); + ui->backupBeforeWrite->setChecked(g.enableBackup() || g.profile[g.id()].penableBackup()); + } if (backupPath.isEmpty() || !QDir(backupPath).exists()) { ui->backupBeforeWrite->setEnabled(false); } @@ -292,8 +296,13 @@ void FlashEEpromDialog::on_burnButton_clicked() // backup previous EEPROM if requested QString backupFilename; + QString backupPath; if (ui->backupBeforeWrite->isChecked()) { - backupFilename = g.backupDir() + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin"; + backupPath = g.profile[g.id()].pBackupDir(); + if (backupPath.isEmpty()) { + backupPath=g.backupDir(); + } + backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin"; } else if (ui->checkFirmwareCompatibility->isChecked()) { backupFilename = generateProcessUniqueTempFileName("eeprom.bin"); diff --git a/companion/src/flashfirmwaredialog.cpp b/companion/src/flashfirmwaredialog.cpp index fd6effe1c..1e8dd4e8d 100755 --- a/companion/src/flashfirmwaredialog.cpp +++ b/companion/src/flashfirmwaredialog.cpp @@ -46,7 +46,10 @@ fwName(g.profile[g.id()].fwName()) ui->backupEEprom->setCheckState(g.backupOnFlash() ? Qt::Checked : Qt::Unchecked); } - QString backupPath = g.backupDir(); + QString backupPath = g.profile[g.id()].pBackupDir(); + if (backupPath.isEmpty()) { + backupPath=g.backupDir(); + } if (backupPath.isEmpty() || !QDir(backupPath).exists()) { ui->backupEEprom->setEnabled(false); } @@ -278,8 +281,13 @@ void FlashFirmwareDialog::startFlash(const QString &filename) // backup if requested bool result = true; QString backupFilename; + QString backupPath; if (backup) { - backupFilename = g.backupDir() + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin"; + backupPath = g.profile[g.id()].pBackupDir(); + if (backupPath.isEmpty()) { + backupPath=g.backupDir(); + } + backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin"; result = readEeprom(backupFilename, progressDialog.progress()); sleep(2); } From d9fb195443b5a191a0c2ec6a9a92eee01a5f529a Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sat, 2 May 2015 01:00:24 +0200 Subject: [PATCH 3/6] Fix scan of floppy drive under win This should fix scan of floppy drives and also detection of non removable drives --- companion/src/radiointerface.cpp | 41 +++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/companion/src/radiointerface.cpp b/companion/src/radiointerface.cpp index de78c4152..b662a544d 100755 --- a/companion/src/radiointerface.cpp +++ b/companion/src/radiointerface.cpp @@ -361,12 +361,29 @@ bool writeEeprom(const QString &filename, ProgressWidget *progress) return false; } +#if defined WIN32 || !defined __GNUC__ +bool isRemovableMedia( QString vol ) +{ + char szDosDeviceName[MAX_PATH]; + UINT DriveType = GetDriveType( vol.replace("/","\\").toLatin1() ); + if ( DriveType != DRIVE_REMOVABLE ) + return false; + QueryDosDevice( vol.replace("/","").toLatin1(), szDosDeviceName, MAX_PATH ); + if ( strstr( szDosDeviceName,"\\Floppy") != NULL ) { // its a floppy + return false; + } + return true; +} +#endif + QString findMassstoragePath(const QString &filename) { QString temppath; QStringList drives; QString eepromfile; QString fsname; + static QStringList blacklist; + #if defined WIN32 || !defined __GNUC__ foreach(QFileInfo drive, QDir::drives()) { WCHAR szVolumeName[256] ; @@ -374,16 +391,22 @@ QString findMassstoragePath(const QString &filename) DWORD dwSerialNumber = 0; DWORD dwMaxFileNameLength=256; DWORD dwFileSystemFlags=0; - bool ret = GetVolumeInformationW( (WCHAR *) drive.absolutePath().utf16(),szVolumeName,256,&dwSerialNumber,&dwMaxFileNameLength,&dwFileSystemFlags,szFileSystemName,256); - if (ret) { - QString vName = QString::fromUtf16 ( (const ushort *) szVolumeName) ; - temppath = drive.absolutePath(); - eepromfile = temppath; - eepromfile.append("/" + filename); - if (QFile::exists(eepromfile)) { - return eepromfile; + if (!blacklist.contains(drive.absolutePath())) { + if (!isRemovableMedia( drive.absolutePath() )) { + blacklist.append(drive.absolutePath()); + } else { + bool ret = GetVolumeInformationW( (WCHAR *) drive.absolutePath().utf16(),szVolumeName,256,&dwSerialNumber,&dwMaxFileNameLength,&dwFileSystemFlags,szFileSystemName,256); + if (ret) { + QString vName = QString::fromUtf16 ( (const ushort *) szVolumeName) ; + temppath = drive.absolutePath(); + eepromfile = temppath; + eepromfile.append("/" + filename); + if (QFile::exists(eepromfile)) { + return eepromfile; + } + } } - } + } } #else struct mount_entry *entry; From c98cbbcd12afd94ce37f327d944791688d784cc2 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sat, 2 May 2015 11:47:11 +0200 Subject: [PATCH 4/6] Fix identing in the code --- companion/src/radiointerface.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/companion/src/radiointerface.cpp b/companion/src/radiointerface.cpp index b662a544d..1e34975cf 100755 --- a/companion/src/radiointerface.cpp +++ b/companion/src/radiointerface.cpp @@ -364,15 +364,15 @@ bool writeEeprom(const QString &filename, ProgressWidget *progress) #if defined WIN32 || !defined __GNUC__ bool isRemovableMedia( QString vol ) { - char szDosDeviceName[MAX_PATH]; - UINT DriveType = GetDriveType( vol.replace("/","\\").toLatin1() ); - if ( DriveType != DRIVE_REMOVABLE ) - return false; - QueryDosDevice( vol.replace("/","").toLatin1(), szDosDeviceName, MAX_PATH ); - if ( strstr( szDosDeviceName,"\\Floppy") != NULL ) { // its a floppy - return false; - } - return true; + char szDosDeviceName[MAX_PATH]; + UINT DriveType = GetDriveType( vol.replace("/","\\").toLatin1() ); + if ( DriveType != DRIVE_REMOVABLE ) + return false; + QueryDosDevice( vol.replace("/","").toLatin1(), szDosDeviceName, MAX_PATH ); + if ( strstr( szDosDeviceName,"\\Floppy") != NULL ) { // its a floppy + return false; + } + return true; } #endif @@ -398,15 +398,15 @@ QString findMassstoragePath(const QString &filename) bool ret = GetVolumeInformationW( (WCHAR *) drive.absolutePath().utf16(),szVolumeName,256,&dwSerialNumber,&dwMaxFileNameLength,&dwFileSystemFlags,szFileSystemName,256); if (ret) { QString vName = QString::fromUtf16 ( (const ushort *) szVolumeName) ; - temppath = drive.absolutePath(); + temppath = drive.absolutePath(); eepromfile = temppath; eepromfile.append("/" + filename); if (QFile::exists(eepromfile)) { return eepromfile; } - } + } } - } + } } #else struct mount_entry *entry; From d99752b4585f5b6c7c5b792311534adb6bf74ee2 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sat, 2 May 2015 12:18:07 +0200 Subject: [PATCH 5/6] Allow direct editing of paths --- companion/src/apppreferencesdialog.cpp | 30 ---- companion/src/apppreferencesdialog.h | 4 - companion/src/apppreferencesdialog.ui | 222 ++++++++----------------- 3 files changed, 71 insertions(+), 185 deletions(-) diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index efac55a3f..610605c11 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -18,10 +18,6 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget *parent) : ui->setupUi(this); updateLock=false; setWindowIcon(CompanionIcon("apppreferences.png")); - ui->backupPathClear->setIcon(CompanionIcon("clear.png")); - ui->pBackupPathClear->setIcon(CompanionIcon("clear.png")); - ui->libraryPathClear->setIcon(CompanionIcon("clear.png")); - ui->sdPathClear->setIcon(CompanionIcon("clear.png")); initSettings(); connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged())); @@ -256,32 +252,6 @@ void AppPreferencesDialog::on_ProfilebackupPathButton_clicked() } } -void AppPreferencesDialog::on_sdPathClear_clicked() -{ - g.profile[g.id()].sdPath(""); - ui->sdPath->clear(); -} - -void AppPreferencesDialog::on_pBackupPathClear_clicked() -{ - g.profile[g.id()].pBackupDir(""); - ui->profilebackupPath->clear(); - ui->pbackupEnable->setDisabled(true); -} - -void AppPreferencesDialog::on_backupPathClear_clicked() -{ - g.backupDir(""); - ui->backupPath->clear(); - ui->backupEnable->setDisabled(true); -} - -void AppPreferencesDialog::on_libraryPathClear_clicked() -{ - g.libDir(""); - ui->libraryPath->clear(); -} - void AppPreferencesDialog::on_ge_pathButton_clicked() { QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text()); diff --git a/companion/src/apppreferencesdialog.h b/companion/src/apppreferencesdialog.h index f2e8bd172..bace7c642 100644 --- a/companion/src/apppreferencesdialog.h +++ b/companion/src/apppreferencesdialog.h @@ -49,10 +49,6 @@ class AppPreferencesDialog : public QDialog void on_backupPathButton_clicked(); void on_ProfilebackupPathButton_clicked(); void on_ge_pathButton_clicked(); - void on_sdPathClear_clicked(); - void on_pBackupPathClear_clicked(); - void on_backupPathClear_clicked(); - void on_libraryPathClear_clicked(); void on_sdPathButton_clicked(); void on_removeProfileButton_clicked(); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index e5e531b76..bb814f702 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -291,37 +291,7 @@ May be different from firmware language true - true - - - - - - - - 0 - 0 - - - - - 16 - 16 - - - - - - - - :/themes/classic/16/clear.png:/themes/classic/16/clear.png - - - - - - - Open Folder + false @@ -341,40 +311,7 @@ May be different from firmware language If set it will override the application general setting - true - - - - - - - - 16 - 16 - - - - - 16 - 16 - - - - - - - - :/themes/classic/16/clear.png:/themes/classic/16/clear.png - - - - - - - The profile specific folder, if set, will override general Backup folder - - - Open Folder + false @@ -684,6 +621,23 @@ Mode 4: + + + + Open Folder + + + + + + + The profile specific folder, if set, will override general Backup folder + + + Open Folder + + + @@ -742,16 +696,6 @@ Mode 4: - - - - true - - - true - - - @@ -765,13 +709,6 @@ Mode 4: - - - - Open Folder - - - @@ -798,13 +735,6 @@ Mode 4: - - - - Find Executable - - - @@ -812,26 +742,6 @@ Mode 4: - - - - Open Folder - - - - - - - - 350 - 0 - - - - true - - - @@ -895,50 +805,13 @@ Mode 4: - - - - - 16 - 16 - - - - - - - - :/themes/classic/16/clear.png:/themes/classic/16/clear.png - - - - - - - - 16 - 16 - - - - - - - - :/themes/classic/16/clear.png:/themes/classic/16/clear.png - - - - - - - - 350 - 0 - + + + + true - true + false @@ -962,6 +835,53 @@ Mode 4: + + + + + 350 + 0 + + + + false + + + + + + + Open Folder + + + + + + + + 350 + 0 + + + + true + + + + + + + Find Executable + + + + + + + Open Folder + + + From f8059b52952fa483fb45a7084a4717366e4f0863 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sat, 2 May 2015 12:57:57 +0200 Subject: [PATCH 6/6] As two field were added and binary structure changed we change also the internal version. The new version will be 210 for opentx2.1 --- companion/src/appdata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index 32666bbd6..3a4de77f1 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -692,8 +692,8 @@ AppData::AppData() settings.remove("compilation-server"); // Load and store all variables. Use default values if setting values are missing - QString _tempString; // Do not touch. Do not change the settings version before a new verson update! - getset( _tempString, "settings_version" ,"20" ); // This is a version marker. Will be used to upgrade the settings later on. + QString _tempString; // Do not touch. Do not change the settings version before a new verson update! + getset( _tempString, "settings_version" ,"210" ); // This is a version marker. Will be used to upgrade the settings later on. getset( _recentFiles, "recentFileList" ,"" ); getset( _mainWinGeo, "mainWindowGeometry" ,"" );