1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-26 09:45:16 +03:00

One settings to rule them all ! (#5449)

This commit is contained in:
3djc 2017-12-01 11:54:30 +01:00 committed by Bertrand Songis
parent bdf0983642
commit d90ac05d6e
7 changed files with 50 additions and 69 deletions

View file

@ -61,9 +61,8 @@ AppPreferencesDialog::~AppPreferencesDialog()
void AppPreferencesDialog::writeValues() void AppPreferencesDialog::writeValues()
{ {
g.autoCheckApp(ui->autoCheckCompanion->isChecked()); g.autoCheckApp(ui->autoCheckCompanion->isChecked());
g.companionBranch(DownloadBranchType(ui->companionBranch->currentIndex())); g.OpenTxBranch(DownloadBranchType(ui->OpenTxBranch->currentIndex()));
g.autoCheckFw(ui->autoCheckFirmware->isChecked()); g.autoCheckFw(ui->autoCheckFirmware->isChecked());
g.firmwareBranch(DownloadBranchType(ui->firmwareBranch->currentIndex()));
g.showSplash(ui->showSplash->isChecked()); g.showSplash(ui->showSplash->isChecked());
g.simuSW(ui->simuSW->isChecked()); g.simuSW(ui->simuSW->isChecked());
g.removeModelSlots(ui->opt_removeBlankSlots->isChecked()); g.removeModelSlots(ui->opt_removeBlankSlots->isChecked());
@ -137,8 +136,7 @@ void AppPreferencesDialog::initSettings()
#if !defined(ALLOW_NIGHTLY_BUILDS) #if !defined(ALLOW_NIGHTLY_BUILDS)
// TODO should we gray out nightly builds here? // TODO should we gray out nightly builds here?
#endif #endif
ui->firmwareBranch->setCurrentIndex(g.firmwareBranch()); ui->OpenTxBranch->setCurrentIndex(g.OpenTxBranch());
ui->companionBranch->setCurrentIndex(g.companionBranch());
ui->autoCheckCompanion->setChecked(g.autoCheckApp()); ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->autoCheckFirmware->setChecked(g.autoCheckFw()); ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash()); ui->showSplash->setChecked(g.showSplash());

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>859</width> <width>863</width>
<height>673</height> <height>673</height>
</rect> </rect>
</property> </property>
@ -72,7 +72,16 @@
<item row="6" column="0" colspan="4"> <item row="6" column="0" colspan="4">
<widget class="QWidget" name="widget_splashImage" native="true"> <widget class="QWidget" name="widget_splashImage" native="true">
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -724,15 +733,24 @@ Mode 4:
</sizepolicy> </sizepolicy>
</property> </property>
<layout class="QGridLayout" name="optionsLayout"> <layout class="QGridLayout" name="optionsLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>5</number> <number>5</number>
</property> </property>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>4</number> <number>4</number>
</property> </property>
<property name="margin">
<number>0</number>
</property>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -770,8 +788,8 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="2" column="0">
<widget class="QComboBox" name="firmwareBranch"> <widget class="QComboBox" name="OpenTxBranch">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -780,42 +798,17 @@ Mode 4:
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Use firmware releases (stable)</string> <string>Use releases (stable)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Use firmware releases and release candidates (testing)</string> <string>Use releases and release candidates (testing)</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Use firmware nightly builds (unstable)</string> <string>Use nightly builds (unstable)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="companionBranch">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Use Companion releases (stable)</string>
</property>
</item>
<item>
<property name="text">
<string>Use Companion release and release candidates (testing)</string>
</property>
</item>
<item>
<property name="text">
<string>Use Companion nightly builds (unstable)</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -1184,6 +1177,13 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="21" column="0" colspan="2">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="17" column="0"> <item row="17" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="sizePolicy"> <property name="sizePolicy">
@ -1210,13 +1210,6 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="21" column="0" colspan="2">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View file

@ -1080,7 +1080,7 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint
QString OpenTxFirmware::getFirmwareBaseUrl() QString OpenTxFirmware::getFirmwareBaseUrl()
{ {
return OPENTX_FIRMWARE_DOWNLOAD_URL[g.boundedFirmwareBranch()]; return OPENTX_FIRMWARE_DOWNLOAD_URL[g.boundedOpenTxBranch()];
} }
QString OpenTxFirmware::getFirmwareUrl() QString OpenTxFirmware::getFirmwareUrl()

View file

@ -69,11 +69,11 @@ void FirmwarePreferencesDialog::on_fw_dnld_clicked()
void FirmwarePreferencesDialog::on_sd_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(); QString fwType = g.profile[g.id()].fwType();
QStringList list = fwType.split("-"); QStringList list = fwType.split("-");
QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]); 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)); url.append(QString("%1/").arg(firmware));
} }
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);

View file

@ -244,7 +244,7 @@ void MainWindow::dowloadLastFirmwareUpdate()
QString MainWindow::getCompanionUpdateBaseUrl() QString MainWindow::getCompanionUpdateBaseUrl()
{ {
return OPENTX_COMPANION_DOWNLOAD_URL[g.boundedCompanionBranch()]; return OPENTX_COMPANION_DOWNLOAD_URL[g.boundedOpenTxBranch()];
} }
void MainWindow::checkForUpdates() void MainWindow::checkForUpdates()

View file

@ -589,9 +589,8 @@ void AppData::init()
getset( _snapshotDir, "snapshotpath" ,"" ); getset( _snapshotDir, "snapshotpath" ,"" );
getset( _updatesDir, "lastUpdatesDir" ,"" ); getset( _updatesDir, "lastUpdatesDir" ,"" );
getset( _firmwareBranch, "firmwareBranch", BRANCH_RELEASE_STABLE); getset( _OpenTxBranch, "OpenTxBranch", BRANCH_RELEASE_STABLE);
getset( _companionBranch, "companionBranch", BRANCH_RELEASE_STABLE);
appLogsDir_init(); appLogsDir_init();
enableBackup_init(); enableBackup_init();
backupOnFlash_init(); backupOnFlash_init();
@ -698,7 +697,7 @@ bool AppData::findPreviousVersionSettings(QString * version)
if (!fromSettings) if (!fromSettings)
return false; return false;
return true; return true;
} }
bool AppData::importSettings(QString fromVersion) bool AppData::importSettings(QString fromVersion)
@ -707,7 +706,7 @@ bool AppData::importSettings(QString fromVersion)
QString fromCompany; QString fromCompany;
QString fromProduct; QString fromProduct;
upgradeFromVersion = ""; upgradeFromVersion = "";
if (fromVersion == "2.1") { if (fromVersion == "2.1") {
@ -724,7 +723,7 @@ bool AppData::importSettings(QString fromVersion)
} }
else else
return false; return false;
upgradeFromVersion = fromVersion; upgradeFromVersion = fromVersion;
QSettings fromSettings(fromCompany, fromProduct); QSettings fromSettings(fromCompany, fromProduct);

View file

@ -253,8 +253,7 @@ class AppData: protected CompStoreObj
PROPERTY(bool, appDebugLog, false) PROPERTY(bool, appDebugLog, false)
PROPERTY(bool, fwTraceLog, false) PROPERTY(bool, fwTraceLog, false)
PROPERTY(unsigned, firmwareBranch, BRANCH_RELEASE_STABLE); PROPERTY(unsigned, OpenTxBranch, BRANCH_RELEASE_STABLE);
PROPERTY(unsigned, companionBranch, BRANCH_RELEASE_STABLE);
PROPERTY4(bool, jsSupport, js_support ,false) PROPERTY4(bool, jsSupport, js_support ,false)
PROPERTY4(bool, showSplash, show_splash ,true) PROPERTY4(bool, showSplash, show_splash ,true)
@ -426,19 +425,11 @@ class AppData: protected CompStoreObj
bool findPreviousVersionSettings(QString * version); bool findPreviousVersionSettings(QString * version);
bool importSettings(QString fromVersion); bool importSettings(QString fromVersion);
inline DownloadBranchType boundedFirmwareBranch() { inline DownloadBranchType boundedOpenTxBranch() {
#if defined(ALLOW_NIGHTLY_BUILDS) #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 #else
return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(firmwareBranch()), BRANCH_RC_TESTING); return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(OpenTxBranch()), 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);
#endif #endif
} }