diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp
index d60595852..0b4940f4a 100644
--- a/companion/src/apppreferencesdialog.cpp
+++ b/companion/src/apppreferencesdialog.cpp
@@ -90,6 +90,7 @@ void AppPreferencesDialog::accept()
g.appDebugLog(ui->opt_appDebugLog->isChecked());
g.fwTraceLog(ui->opt_fwTraceLog->isChecked());
g.appLogsDir(ui->appLogsDir->text());
+ g.runInstaller(ui->chkPromptInstall->isChecked());
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
g.jsSupport(ui->joystickChkB ->isChecked());
@@ -130,6 +131,7 @@ void AppPreferencesDialog::accept()
profile.pBackupDir(ui->profilebackupPath->text());
profile.penableBackup(ui->pbackupEnable->isChecked());
profile.splashFile(ui->SplashFileName->text());
+ profile.runSDSync(ui->chkPromptSDSync->isChecked());
// The profile name may NEVER be empty
if (ui->profileNameLE->text().isEmpty())
@@ -234,6 +236,7 @@ void AppPreferencesDialog::initSettings()
ui->opt_fwTraceLog->setChecked(g.fwTraceLog());
ui->appLogsDir->setText(g.appLogsDir());
toggleAppLogSettings();
+ ui->chkPromptInstall->setChecked(g.runInstaller());
#if defined(JOYSTICKS)
ui->joystickChkB->setChecked(g.jsSupport());
@@ -296,6 +299,7 @@ void AppPreferencesDialog::initSettings()
hwSettings = tr("AVAILABLE: Radio settings stored %1").arg(str);
}
ui->lblGeneralSettings->setText(hwSettings);
+ ui->chkPromptSDSync->setChecked(profile.runSDSync());
QString currType = QStringList(profile.fwType().split('-').mid(0, 2)).join('-');
foreach(Firmware * firmware, Firmware::getRegisteredFirmwares()) {
diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui
index 3126fe96e..1455265fd 100644
--- a/companion/src/apppreferencesdialog.ui
+++ b/companion/src/apppreferencesdialog.ui
@@ -45,7 +45,7 @@
- 3
+ 0
@@ -65,6 +65,109 @@
+ -
+
+
+ If set it will override the application general setting
+
+
+ false
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ Profile Name
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 5
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ SD Structure path
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Menu Language
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ General Settings
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Prompt to write firmware to radio after update
+
+
+
-
@@ -201,26 +304,6 @@
- -
-
-
- If set it will override the application general setting
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
@@ -237,6 +320,86 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Options
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ Other Settings
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ if set, will override general backup enable
+
+
+ Enable automatic backup before writing firmware
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ The profile specific folder, if set, will override general Backup folder
+
+
+ Backup folder
+
+
+
-
@@ -301,45 +464,50 @@ Mode 4:
- -
-
-
- true
-
+
-
+
-
-
-
- false
+ Default Int. Module
- -
-
-
- -
-
-
- true
-
-
-
- -
-
+
-
+
-
+
0
0
+ Ubuntu
75
true
- Profile Name
+ Radio Type
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Select Folder
+
+
+
+ -
+
+
+
+ 0
+ 0
+
@@ -352,75 +520,7 @@ Mode 4:
- Append version number to FW file name
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- SD Structure path
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- General Settings
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- The profile specific folder, if set, will override general Backup folder
-
-
- Backup folder
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Default Channel Order
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
- Default Int. Module
+ Append version number to firmware file name
@@ -437,37 +537,8 @@ Mode 4:
- -
-
-
-
- 0
- 0
-
-
-
- Offer to write FW to Tx after download
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Build Options
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
+
-
+
0
@@ -475,85 +546,13 @@ Mode 4:
- Menu Language
+ Default Channel Order
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
- -
-
-
- Select Folder
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 5
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- Sans Serif
- 75
- true
-
-
-
- Radio Type
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- if set, will override general backup enable
-
-
- Enable automatic backup before writing firmware
-
-
-
-
@@ -668,6 +667,29 @@ Mode 4:
+ -
+
+
+ true
+
+
+
+
+
+ false
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
-
@@ -698,27 +720,19 @@ Mode 4:
- -
-
-
-
- 0
- 0
-
-
-
-
- 75
- true
-
-
+
-
+
- Other Settings
+ Prompt to run SD Sync after update
- -
-
+
-
+
+
+ Update
+
+
@@ -732,41 +746,39 @@ Mode 4:
6
- -
-
-
-
- 0
- 0
-
-
-
- Enable automatic backup before writing firmware
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Startup Settings
-
-
-
- -
-
+
-
+
Qt::Horizontal
- -
-
+
-
+
+
-
+
+
+ false
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Select Folder
+
+
+
+
+
+ -
+
0
@@ -774,7 +786,36 @@ Mode 4:
- Remember
+ Automatic Backup Folder
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Debug Output Logging
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Google Earth Executable
@@ -802,6 +843,44 @@ Mode 4:
+ -
+
+
-
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Select Executable
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
-
@@ -809,8 +888,8 @@ Mode 4:
- -
-
+
-
+
0
@@ -818,7 +897,17 @@ Mode 4:
- Debug Output Logging
+ Output Logs Folder
+
+
+
+ -
+
+
+ Show splash screen
+
+
+ true
@@ -829,13 +918,6 @@ Mode 4:
- -
-
-
- Qt::Horizontal
-
-
-
-
@@ -856,33 +938,13 @@ Mode 4:
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Show splash screen
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ <html><head/><body><p>This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. </p><p>When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.</p></body></html>
- Action on New Model
+ Remove empty model slots when deleting models (only applies for radios w/out categories)
@@ -899,8 +961,8 @@ Mode 4:
- -
-
+
-
+
0
@@ -908,21 +970,24 @@ Mode 4:
- Google Earth Executable
+ Action on New Model
- -
-
+
-
+
-
-
-
+
+
true
+
+ false
+
-
-
+
0
@@ -930,7 +995,7 @@ Mode 4:
- Select Executable
+ Select Folder
@@ -972,13 +1037,6 @@ Mode 4:
- -
-
-
- Qt::Horizontal
-
-
-
-
@@ -992,8 +1050,8 @@ Mode 4:
- -
-
+
-
+
0
@@ -1001,47 +1059,17 @@ Mode 4:
- Output Logs Folder
+ Startup Settings
- -
-
-
- <html><head/><body><p>This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. </p><p>When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.</p></body></html>
-
-
- Remove empty model slots when deleting models (only applies for radios w/out categories)
+
-
+
+
+ Qt::Horizontal
- -
-
-
-
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Select Folder
-
-
-
-
-
- -
-
-
-
-
@@ -1063,35 +1091,21 @@ Mode 4:
- -
-
-
-
-
-
- true
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Select Folder
-
-
-
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Enable automatic backup before writing firmware
+
+
- -
-
+
-
+
0
@@ -1099,7 +1113,21 @@ Mode 4:
- Automatic Backup Folder
+ Remember
+
+
+
+ -
+
+
+ Prompt to run installer after update
+
+
+
+ -
+
+
+ Update
diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp
index 29f6dd35d..29bcb590d 100644
--- a/companion/src/mainwindow.cpp
+++ b/companion/src/mainwindow.cpp
@@ -237,15 +237,27 @@ void MainWindow::onLanguageChanged(QAction * act)
void MainWindow::autoUpdates()
{
- Updates *upd = new Updates(this, updateFactories);
- upd->autoUpdates();
- delete upd;
+ doUpdates(false);
}
void MainWindow::manualUpdates()
+{
+ doUpdates(true);
+}
+
+void MainWindow::doUpdates(bool manual)
{
Updates *upd = new Updates(this, updateFactories);
- upd->manualUpdates();
+
+ connect(upd, &Updates::runSDSync, [=] () {
+ sdsync(true);
+ });
+
+ if (manual)
+ upd->manualUpdates();
+ else
+ upd->autoUpdates();
+
delete upd;
}
@@ -439,7 +451,7 @@ void MainWindow::appPrefs()
dialog->deleteLater();
}
-void MainWindow::sdsync()
+void MainWindow::sdsync(bool postUpdate)
{
// remember user-selectable options for duration of session TODO: save to settings
static SyncProcess::SyncOptions syncOpts;
@@ -453,6 +465,9 @@ void MainWindow::sdsync()
syncOpts.sessionId = g.sessionId();
}
+ if (postUpdate)
+ syncOpts.folderA = g.updateDir();
+
if (syncOpts.folderA.isEmpty())
syncOpts.folderA = g.profile[g.id()].sdPath();
if (syncOpts.folderB.isEmpty())
diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h
index 3dd40afa9..bb7c0cb82 100644
--- a/companion/src/mainwindow.h
+++ b/companion/src/mainwindow.h
@@ -95,7 +95,7 @@ class MainWindow : public QMainWindow
void readBackup();
void burnConfig();
void burnList();
- void sdsync();
+ void sdsync(bool postUpdate = false);
void changelog();
void customizeSplash();
void about();
@@ -112,6 +112,7 @@ class MainWindow : public QMainWindow
void chooseProfile();
void manualUpdates();
void autoUpdates();
+ void doUpdates(bool manual);
void openFile(const QString & fileName, bool updateLastUsedDir = false);
diff --git a/companion/src/storage/appdata.h b/companion/src/storage/appdata.h
index 64e6c178f..153b34062 100644
--- a/companion/src/storage/appdata.h
+++ b/companion/src/storage/appdata.h
@@ -382,6 +382,7 @@ class Profile: public CompStoreObj
PROPERTY4(bool, renameFwFiles, "rename_firmware_files", false)
PROPERTY (bool, burnFirmware, false)
PROPERTY (bool, penableBackup, false)
+ PROPERTY (bool, runSDSync, false)
// Simulator variables
PROPERTY(SimulatorOptions, simulatorOptions, SimulatorOptions())
@@ -636,6 +637,7 @@ class AppData: public CompStoreObj
PROPERTY(bool, tabbedMdi, false)
PROPERTY(bool, appDebugLog, false)
PROPERTY(bool, fwTraceLog, false)
+ PROPERTY(bool, runInstaller, false)
// Simulator global (non-profile) settings
PROPERTY(QStringList, simuDbgFilters, QStringList())
diff --git a/companion/src/updates/updatecompanion.cpp b/companion/src/updates/updatecompanion.cpp
index c56d1bd6e..71bf12f43 100644
--- a/companion/src/updates/updatecompanion.cpp
+++ b/companion/src/updates/updatecompanion.cpp
@@ -20,8 +20,7 @@
*/
#include "updatecompanion.h"
-#include "constants.h"
-#include "version.h"
+#include "appdata.h"
#include
#include
@@ -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);
diff --git a/companion/src/updates/updatefirmware.cpp b/companion/src/updates/updatefirmware.cpp
index d51b9e6e9..dcc963639 100644
--- a/companion/src/updates/updatefirmware.cpp
+++ b/companion/src/updates/updatefirmware.cpp
@@ -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;
diff --git a/companion/src/updates/updates.cpp b/companion/src/updates/updates.cpp
index 72fec7196..4759aa1fe 100644
--- a/companion/src/updates/updates.cpp
+++ b/companion/src/updates/updates.cpp
@@ -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();
}
diff --git a/companion/src/updates/updates.h b/companion/src/updates/updates.h
index 09cec55f8..b63f853ec 100644
--- a/companion/src/updates/updates.h
+++ b/companion/src/updates/updates.h
@@ -37,6 +37,11 @@ class Updates : public QWidget
void autoUpdates();
void manualUpdates();
+ signals:
+ void runSDSync();
+
private:
UpdateFactories *factories;
+
+ void checkRunSDSync();
};