1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-25 17:25:10 +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()
{
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());

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>859</width>
<width>863</width>
<height>673</height>
</rect>
</property>
@ -72,7 +72,16 @@
<item row="6" column="0" colspan="4">
<widget class="QWidget" name="widget_splashImage" native="true">
<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>
</property>
<property name="spacing">
@ -724,15 +733,24 @@ Mode 4:
</sizepolicy>
</property>
<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">
<number>5</number>
</property>
<property name="verticalSpacing">
<number>4</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</item>
@ -770,8 +788,8 @@ Mode 4:
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="firmwareBranch">
<item row="2" column="0">
<widget class="QComboBox" name="OpenTxBranch">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -780,42 +798,17 @@ Mode 4:
</property>
<item>
<property name="text">
<string>Use firmware releases (stable)</string>
<string>Use releases (stable)</string>
</property>
</item>
<item>
<property name="text">
<string>Use firmware releases and release candidates (testing)</string>
<string>Use releases and release candidates (testing)</string>
</property>
</item>
<item>
<property name="text">
<string>Use firmware 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>
<string>Use nightly builds (unstable)</string>
</property>
</item>
</widget>
@ -1184,6 +1177,13 @@ Mode 4:
</property>
</widget>
</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">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
@ -1210,13 +1210,6 @@ Mode 4:
</property>
</widget>
</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>
</item>
<item>

View file

@ -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()

View file

@ -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);

View file

@ -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()

View file

@ -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);

View file

@ -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
}