[Companion][FirmwarePreferencesDialog] Update the displayed latest firmware version number after a download completes.
This commit is contained in:
@@ -31,6 +31,9 @@ FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget * parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||||
initSettings();
|
initSettings();
|
||||||
|
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
||||||
|
if (mw)
|
||||||
|
connect(mw, &MainWindow::firmwareDownloadCompleted, this, &FirmwarePreferencesDialog::initSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
|
FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
|
||||||
@@ -40,25 +43,26 @@ FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
|
|||||||
|
|
||||||
void FirmwarePreferencesDialog::initSettings()
|
void FirmwarePreferencesDialog::initSettings()
|
||||||
{
|
{
|
||||||
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
|
ui->fwTypeLbl->setText(g.currentProfile().fwType());
|
||||||
int version = g.fwRev.get(g.profile[g.id()].fwType());
|
int version = g.fwRev.get(g.currentProfile().fwType());
|
||||||
if (version > 0) {
|
if (version > 0)
|
||||||
ui->lastRevisionLbl->setText(index2version(version));
|
ui->lastRevisionLbl->setText(index2version(version));
|
||||||
}
|
else
|
||||||
|
ui->lastRevisionLbl->setText(tr("Unknown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
||||||
{
|
{
|
||||||
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
||||||
mw->checkForFirmwareUpdate();
|
if (mw)
|
||||||
initSettings();
|
mw->checkForFirmwareUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
|
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
|
||||||
{
|
{
|
||||||
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
||||||
mw->dowloadLastFirmwareUpdate();
|
if (mw)
|
||||||
initSettings();
|
mw->dowloadLastFirmwareUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwarePreferencesDialog::on_sd_dnld_clicked()
|
void FirmwarePreferencesDialog::on_sd_dnld_clicked()
|
||||||
|
|||||||
@@ -456,6 +456,7 @@ void MainWindow::firmwareDownloadAccepted()
|
|||||||
writeFlash(g.profile[g.id()].fwName());
|
writeFlash(g.profile[g.id()].fwName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit firmwareDownloadCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class MainWindow : public QMainWindow
|
|||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void firmwareDownloadCompleted();
|
||||||
void firmwareChanged();
|
void firmwareChanged();
|
||||||
void startSync();
|
void startSync();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user