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
This commit is contained in:
Romolo Manfredini
2015-05-02 12:58:46 +02:00
parent 19914fb26b
commit dc5e36c543
2 changed files with 21 additions and 4 deletions
+11 -2
View File
@@ -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");
+10 -2
View File
@@ -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);
}