Read/write backup fixes: (#4327)

* Read/write backup fixes:
 * radio not found was show behind all windows (missing parent)
 * bad behavior on write when radio not found

* Disable model backup read/write for Horus (needs implementation)
This commit is contained in:
Damjan Adamic
2017-01-29 09:59:58 +01:00
committed by Bertrand Songis
parent 8e73d25f1c
commit d5e3fabf03
4 changed files with 23 additions and 7 deletions
+10 -5
View File
@@ -48,7 +48,6 @@ radioData(new RadioData())
if (backupPath.isEmpty() || !QDir(backupPath).exists()) { if (backupPath.isEmpty() || !QDir(backupPath).exists()) {
ui->backupBeforeWrite->setEnabled(false); ui->backupBeforeWrite->setEnabled(false);
} }
updateUI();
} }
FlashEEpromDialog::~FlashEEpromDialog() FlashEEpromDialog::~FlashEEpromDialog()
@@ -56,11 +55,16 @@ FlashEEpromDialog::~FlashEEpromDialog()
delete ui; delete ui;
} }
void FlashEEpromDialog::showEvent(QShowEvent *)
{
updateUI();
}
void FlashEEpromDialog::updateUI() void FlashEEpromDialog::updateUI()
{ {
// ui->burnButton->setEnabled(true); // ui->burnButton->setEnabled(true);
ui->eepromFilename->setText(eepromFilename); ui->eepromFilename->setText(eepromFilename);
if (getEEpromVersion(eepromFilename) >= 0) { if (!eepromFilename.isEmpty() && getEEpromVersion(eepromFilename) >= 0) {
ui->profileLabel->show(); ui->profileLabel->show();
ui->patchCalibration->show(); ui->patchCalibration->show();
ui->patchHardwareSettings->show(); ui->patchHardwareSettings->show();
@@ -290,9 +294,10 @@ void FlashEEpromDialog::on_burnButton_clicked()
} }
// and write... // and write...
writeEeprom(filename, progressDialog.progress()); bool result = writeEeprom(filename, progressDialog.progress());
if (!result && !progressDialog.isEmpty()) {
progressDialog.exec(); progressDialog.exec();
}
} }
void FlashEEpromDialog::on_cancelButton_clicked() void FlashEEpromDialog::on_cancelButton_clicked()
+1
View File
@@ -54,6 +54,7 @@ protected:
int getEEpromVersion(const QString &filename); int getEEpromVersion(const QString &filename);
bool patchCalibration(); bool patchCalibration();
bool patchHardwareSettings(); bool patchHardwareSettings();
virtual void showEvent(QShowEvent *);
private: private:
Ui::FlashEEpromDialog *ui; Ui::FlashEEpromDialog *ui;
+10
View File
@@ -777,6 +777,11 @@ bool MainWindow::readEepromFromRadio(const QString & filename)
void MainWindow::writeBackup() void MainWindow::writeBackup()
{ {
if (IS_HORUS(getCurrentBoard())) {
QMessageBox::information(this, "Companion", tr("This function is not yet implemented"));
return;
// TODO implementation
}
FlashEEpromDialog *cd = new FlashEEpromDialog(this); FlashEEpromDialog *cd = new FlashEEpromDialog(this);
cd->exec(); cd->exec();
} }
@@ -789,6 +794,11 @@ void MainWindow::writeFlash(QString fileToFlash)
void MainWindow::readBackup() void MainWindow::readBackup()
{ {
if (IS_HORUS(getCurrentBoard())) {
QMessageBox::information(this, "Companion", tr("This function is not yet implemented"));
return;
// TODO implementation
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Radio Backup to File"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER)); QString fileName = QFileDialog::getSaveFileName(this, tr("Save Radio Backup to File"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
if (!readEepromFromRadio(fileName)) if (!readEepromFromRadio(fileName))
+2 -2
View File
@@ -351,7 +351,7 @@ bool readEeprom(const QString & filename, ProgressWidget * progress)
path = findMassstoragePath("ERSKY9X.BIN"); path = findMassstoragePath("ERSKY9X.BIN");
} }
if (path.isEmpty()) { if (path.isEmpty()) {
RadioNotFoundDialog dialog; RadioNotFoundDialog dialog(progress);
dialog.exec(); dialog.exec();
return false; return false;
} }
@@ -398,7 +398,7 @@ bool writeEeprom(const QString & filename, ProgressWidget * progress)
} }
if (IS_ARM(board)) { if (IS_ARM(board)) {
RadioNotFoundDialog dialog; RadioNotFoundDialog dialog(progress);
dialog.exec(); dialog.exec();
} }