Add prompt sd sync and install app setting
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "updatecompanion.h"
|
||||
#include "constants.h"
|
||||
#include "version.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
@@ -63,6 +62,11 @@ UpdateCompanion::UpdateCompanion(QWidget * parent) :
|
||||
|
||||
bool UpdateCompanion::asyncInstall()
|
||||
{
|
||||
reportProgress(tr("Run application installer: %1").arg(g.runInstaller() ? tr("true") : tr("false")), QtDebugMsg);
|
||||
|
||||
if (!g.runInstaller())
|
||||
return true;
|
||||
|
||||
progressMessage(tr("Async install"));
|
||||
|
||||
assets->setFilterFlags(UPDFLG_AsyncInstall);
|
||||
|
||||
@@ -44,6 +44,11 @@ UpdateFirmware::UpdateFirmware(QWidget * parent) :
|
||||
|
||||
bool UpdateFirmware::asyncInstall()
|
||||
{
|
||||
reportProgress(tr("Write firmware to radio: %1").arg(g.currentProfile().burnFirmware() ? tr("true") : tr("false")), QtDebugMsg);
|
||||
|
||||
if (!g.currentProfile().burnFirmware())
|
||||
return true;
|
||||
|
||||
progressMessage(tr("Async install"));
|
||||
|
||||
assets->setFilterFlags(UPDFLG_AsyncInstall);
|
||||
@@ -84,15 +89,11 @@ bool UpdateFirmware::asyncInstall()
|
||||
|
||||
g.currentProfile().fwName(destPath);
|
||||
|
||||
reportProgress(tr("Write firmware to radio option setting: %1").arg(g.currentProfile().burnFirmware() ? tr("true") : tr("false")), QtDebugMsg);
|
||||
|
||||
if (g.currentProfile().burnFirmware()) {
|
||||
int ret = QMessageBox::question(this, CPN_STR_APP_NAME, tr("Do you want to write the firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::Yes) {
|
||||
FlashFirmwareDialog *dlg = new FlashFirmwareDialog(this);
|
||||
dlg->exec();
|
||||
dlg->deleteLater();
|
||||
}
|
||||
int ret = QMessageBox::question(this, CPN_STR_APP_NAME, tr("Write the updated firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::Yes) {
|
||||
FlashFirmwareDialog *dlg = new FlashFirmwareDialog(this);
|
||||
dlg->exec();
|
||||
dlg->deleteLater();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -72,7 +72,8 @@ void Updates::autoUpdates()
|
||||
|
||||
factories->resetAllRunEnvironments();
|
||||
|
||||
factories->autoUpdate();
|
||||
if (factories->autoUpdate())
|
||||
checkRunSDSync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,15 +83,29 @@ void Updates::manualUpdates()
|
||||
|
||||
UpdatesDialog *dlg = new UpdatesDialog(this, factories);
|
||||
|
||||
bool ok = false;
|
||||
|
||||
if (dlg->exec()) {
|
||||
ProgressDialog progressDialog(this, tr("Update Components"), CompanionIcon("fuses.png"), true);
|
||||
progressDialog.progress()->lock(true);
|
||||
progressDialog.progress()->setInfo(tr("Starting..."));
|
||||
bool ok = factories->manualUpdate(progressDialog.progress());
|
||||
ok = factories->manualUpdate(progressDialog.progress());
|
||||
progressDialog.progress()->lock(false);
|
||||
progressDialog.progress()->setInfo(tr("Finished %1").arg(ok ? tr("successfully") : tr("with errors")));
|
||||
progressDialog.exec();
|
||||
}
|
||||
|
||||
delete dlg;
|
||||
|
||||
if (ok)
|
||||
checkRunSDSync();
|
||||
}
|
||||
|
||||
void Updates::checkRunSDSync()
|
||||
{
|
||||
if (!g.currentProfile().runSDSync())
|
||||
return;
|
||||
|
||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Run SD Sync now?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
emit runSDSync();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,11 @@ class Updates : public QWidget
|
||||
void autoUpdates();
|
||||
void manualUpdates();
|
||||
|
||||
signals:
|
||||
void runSDSync();
|
||||
|
||||
private:
|
||||
UpdateFactories *factories;
|
||||
|
||||
void checkRunSDSync();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user