From d90ac05d6e62966ca47b1be5a06bb9ad6b655e9f Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 1 Dec 2017 11:54:30 +0100 Subject: [PATCH] One settings to rule them all ! (#5449) --- companion/src/apppreferencesdialog.cpp | 6 +- companion/src/apppreferencesdialog.ui | 77 ++++++++++------------ companion/src/firmwares/opentx/opentxinterface.cpp | 2 +- companion/src/fwpreferencesdialog.cpp | 4 +- companion/src/mainwindow.cpp | 2 +- companion/src/storage/appdata.cpp | 11 ++-- companion/src/storage/appdata.h | 17 ++--- 7 files changed, 50 insertions(+), 69 deletions(-) diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 6cdd9deda..5b5d4fb3a 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -61,9 +61,8 @@ AppPreferencesDialog::~AppPreferencesDialog() void AppPreferencesDialog::writeValues() { g.autoCheckApp(ui->autoCheckCompanion->isChecked()); - g.companionBranch(DownloadBranchType(ui->companionBranch->currentIndex())); + g.OpenTxBranch(DownloadBranchType(ui->OpenTxBranch->currentIndex())); g.autoCheckFw(ui->autoCheckFirmware->isChecked()); - g.firmwareBranch(DownloadBranchType(ui->firmwareBranch->currentIndex())); g.showSplash(ui->showSplash->isChecked()); g.simuSW(ui->simuSW->isChecked()); g.removeModelSlots(ui->opt_removeBlankSlots->isChecked()); @@ -137,8 +136,7 @@ void AppPreferencesDialog::initSettings() #if !defined(ALLOW_NIGHTLY_BUILDS) // TODO should we gray out nightly builds here? #endif - ui->firmwareBranch->setCurrentIndex(g.firmwareBranch()); - ui->companionBranch->setCurrentIndex(g.companionBranch()); + ui->OpenTxBranch->setCurrentIndex(g.OpenTxBranch()); ui->autoCheckCompanion->setChecked(g.autoCheckApp()); ui->autoCheckFirmware->setChecked(g.autoCheckFw()); ui->showSplash->setChecked(g.showSplash()); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index a2f06ac00..1454d39e4 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -6,7 +6,7 @@ 0 0 - 859 + 863 673 @@ -72,7 +72,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -724,15 +733,24 @@ Mode 4: + + 0 + + + 0 + + + 0 + + + 0 + 5 4 - - 0 - @@ -770,33 +788,8 @@ Mode 4: - - - - - 0 - 0 - - - - - Use firmware releases (stable) - - - - - Use firmware releases and release candidates (testing) - - - - - Use firmware nightly builds (unstable) - - - - - - + + 0 @@ -805,17 +798,17 @@ Mode 4: - Use Companion releases (stable) + Use releases (stable) - Use Companion release and release candidates (testing) + Use releases and release candidates (testing) - Use Companion nightly builds (unstable) + Use nightly builds (unstable) @@ -1184,6 +1177,13 @@ Mode 4: + + + + Qt::Horizontal + + + @@ -1210,13 +1210,6 @@ Mode 4: - - - - Qt::Horizontal - - - diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 0019ac61c..440d9cb90 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -1080,7 +1080,7 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint QString OpenTxFirmware::getFirmwareBaseUrl() { - return OPENTX_FIRMWARE_DOWNLOAD_URL[g.boundedFirmwareBranch()]; + return OPENTX_FIRMWARE_DOWNLOAD_URL[g.boundedOpenTxBranch()]; } QString OpenTxFirmware::getFirmwareUrl() diff --git a/companion/src/fwpreferencesdialog.cpp b/companion/src/fwpreferencesdialog.cpp index ac4b59838..74bb0bae1 100644 --- a/companion/src/fwpreferencesdialog.cpp +++ b/companion/src/fwpreferencesdialog.cpp @@ -69,11 +69,11 @@ void FirmwarePreferencesDialog::on_fw_dnld_clicked() void FirmwarePreferencesDialog::on_sd_dnld_clicked() { - QString url = OPENTX_SDCARD_DOWNLOAD_URL[g.boundedFirmwareBranch()]; + QString url = OPENTX_SDCARD_DOWNLOAD_URL[g.boundedOpenTxBranch()]; QString fwType = g.profile[g.id()].fwType(); QStringList list = fwType.split("-"); QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]); - if (g.boundedFirmwareBranch() != BRANCH_NIGHTLY_UNSTABLE) { + if (g.boundedOpenTxBranch() != BRANCH_NIGHTLY_UNSTABLE) { url.append(QString("%1/").arg(firmware)); } QDesktopServices::openUrl(url); diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index db89b2a71..4a6064d83 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -244,7 +244,7 @@ void MainWindow::dowloadLastFirmwareUpdate() QString MainWindow::getCompanionUpdateBaseUrl() { - return OPENTX_COMPANION_DOWNLOAD_URL[g.boundedCompanionBranch()]; + return OPENTX_COMPANION_DOWNLOAD_URL[g.boundedOpenTxBranch()]; } void MainWindow::checkForUpdates() diff --git a/companion/src/storage/appdata.cpp b/companion/src/storage/appdata.cpp index 301c9c4d2..eef0fc231 100644 --- a/companion/src/storage/appdata.cpp +++ b/companion/src/storage/appdata.cpp @@ -589,9 +589,8 @@ void AppData::init() getset( _snapshotDir, "snapshotpath" ,"" ); getset( _updatesDir, "lastUpdatesDir" ,"" ); - getset( _firmwareBranch, "firmwareBranch", BRANCH_RELEASE_STABLE); - getset( _companionBranch, "companionBranch", BRANCH_RELEASE_STABLE); - + getset( _OpenTxBranch, "OpenTxBranch", BRANCH_RELEASE_STABLE); + appLogsDir_init(); enableBackup_init(); backupOnFlash_init(); @@ -698,7 +697,7 @@ bool AppData::findPreviousVersionSettings(QString * version) if (!fromSettings) return false; - return true; + return true; } bool AppData::importSettings(QString fromVersion) @@ -707,7 +706,7 @@ bool AppData::importSettings(QString fromVersion) QString fromCompany; QString fromProduct; - + upgradeFromVersion = ""; if (fromVersion == "2.1") { @@ -724,7 +723,7 @@ bool AppData::importSettings(QString fromVersion) } else return false; - + upgradeFromVersion = fromVersion; QSettings fromSettings(fromCompany, fromProduct); diff --git a/companion/src/storage/appdata.h b/companion/src/storage/appdata.h index 71b8eda98..7ac02bdcb 100644 --- a/companion/src/storage/appdata.h +++ b/companion/src/storage/appdata.h @@ -253,8 +253,7 @@ class AppData: protected CompStoreObj PROPERTY(bool, appDebugLog, false) PROPERTY(bool, fwTraceLog, false) - PROPERTY(unsigned, firmwareBranch, BRANCH_RELEASE_STABLE); - PROPERTY(unsigned, companionBranch, BRANCH_RELEASE_STABLE); + PROPERTY(unsigned, OpenTxBranch, BRANCH_RELEASE_STABLE); PROPERTY4(bool, jsSupport, js_support ,false) PROPERTY4(bool, showSplash, show_splash ,true) @@ -426,19 +425,11 @@ class AppData: protected CompStoreObj bool findPreviousVersionSettings(QString * version); bool importSettings(QString fromVersion); - inline DownloadBranchType boundedFirmwareBranch() { + inline DownloadBranchType boundedOpenTxBranch() { #if defined(ALLOW_NIGHTLY_BUILDS) - return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(firmwareBranch()), BRANCH_NIGHTLY_UNSTABLE); + return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(OpenTxBranch()), BRANCH_NIGHTLY_UNSTABLE); #else - return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(firmwareBranch()), BRANCH_RC_TESTING); -#endif - } - - inline DownloadBranchType boundedCompanionBranch() { -#if defined(ALLOW_NIGHTLY_BUILDS) - return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(companionBranch()), BRANCH_NIGHTLY_UNSTABLE); -#else - return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(companionBranch()), BRANCH_RC_TESTING); + return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(OpenTxBranch()), BRANCH_RC_TESTING); #endif } -- 2.11.4.GIT