A 3rd branch for RC compilation (#5441)

A 3rd branch for RC compilation
This commit is contained in:
Bertrand Songis
2017-11-30 11:51:22 +01:00
committed by GitHub
parent e74349e36c
commit 0faee13bc3
8 changed files with 120 additions and 88 deletions
+7 -12
View File
@@ -23,13 +23,10 @@
#include "mainwindow.h"
#include "appdata.h"
#include "helpers.h"
#include "firmwareinterface.h"
#ifdef JOYSTICKS
#if defined(JOYSTICKS)
#include "joystick.h"
#include "joystickdialog.h"
#endif
#include <QDesktopServices>
#include <QtGui>
AppPreferencesDialog::AppPreferencesDialog(QWidget * parent) :
QDialog(parent),
@@ -63,10 +60,10 @@ AppPreferencesDialog::~AppPreferencesDialog()
void AppPreferencesDialog::writeValues()
{
g.useCompanionNightlyBuilds(ui->useCompanionNightlyBuilds->isChecked());
g.autoCheckApp(ui->autoCheckCompanion->isChecked());
g.useFirmwareNightlyBuilds(ui->useFirmwareNightlyBuilds->isChecked());
g.companionBranch(DownloadBranchType(ui->companionBranch->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,13 +134,11 @@ void AppPreferencesDialog::initSettings()
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
}
#if defined(ALLOW_NIGHTLY_BUILDS)
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
#else
ui->useCompanionNightlyBuilds->hide();
ui->useFirmwareNightlyBuilds->hide();
#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->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash());
+57 -45
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>703</width>
<height>534</height>
<width>859</width>
<height>673</height>
</rect>
</property>
<property name="sizePolicy">
@@ -45,7 +45,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="profileTab">
<attribute name="title">
@@ -72,16 +72,7 @@
<item row="6" column="0" colspan="4">
<widget class="QWidget" name="widget_splashImage" native="true">
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
@@ -733,24 +724,15 @@ 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>
@@ -768,26 +750,6 @@ Mode 4:
</property>
<item row="7" column="1">
<layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="1">
<widget class="QCheckBox" name="useCompanionNightlyBuilds">
<property name="text">
<string>Use Companion nightly builds</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="useFirmwareNightlyBuilds">
<property name="text">
<string>Use firmware nightly builds</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="autoCheckFirmware">
<property name="text">
@@ -808,6 +770,56 @@ Mode 4:
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="firmwareBranch">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Use firmware releases (stable)</string>
</property>
</item>
<item>
<property name="text">
<string>Use firmware 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>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
+8
View File
@@ -68,4 +68,12 @@
#define CPN_STR_SW_INDICATOR_NEUT QCoreApplication::translate("RawSwitch", "-") // Switch neutral (middle) position indicator.
#define CPN_STR_SW_INDICATOR_REV QCoreApplication::translate("RawSwitch", "!") // Switch reversed logic (NOT) indicator.
enum DownloadBranchType {
BRANCH_RELEASE_STABLE,
BRANCH_RC_TESTING,
BRANCH_NIGHTLY_UNSTABLE
};
Q_DECLARE_METATYPE(DownloadBranchType)
#endif // _CONSTANTS_H_
@@ -30,8 +30,11 @@
using namespace Board;
#define OPENTX_FIRMWARE_DOWNLOADS "https://downloads-22.open-tx.org/firmware"
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "https://downloads-22.open-tx.org/nightlies/firmware"
const char * const OPENTX_FIRMWARE_DOWNLOAD_URL[] = {
"https://downloads.open-tx.org/2.2/release/firmware",
"https://downloads.open-tx.org/2.2/rc/firmware",
"https://downloads.open-tx.org/2.2/nightlies/firmware"
};
#define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2
@@ -1077,11 +1080,7 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint
QString OpenTxFirmware::getFirmwareBaseUrl()
{
#if defined(ALLOW_NIGHTLY_BUILDS)
return (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
#else
return OPENTX_FIRMWARE_DOWNLOADS;
#endif
return OPENTX_FIRMWARE_DOWNLOAD_URL[g.boundedFirmwareBranch()];
}
QString OpenTxFirmware::getFirmwareUrl()
+10 -10
View File
@@ -21,16 +21,16 @@
#include "fwpreferencesdialog.h"
#include "ui_fwpreferencesdialog.h"
#include "mainwindow.h"
#include "eeprominterface.h"
#include "helpers.h"
#include "appdata.h"
#include <QDesktopServices>
#include <QtGui>
#define OPENTX_SDCARD_DOWNLOADS "https://downloads.open-tx.org/2.2/sdcard/"
#define OPENTX_NIGHT_SDCARD_DOWNLOADS "https://downloads.open-tx.org/2.2/nightlies/sdcard/"
const char * const OPENTX_SDCARD_DOWNLOAD_URL[] = {
"https://downloads.open-tx.org/2.2/release/sdcard/",
"https://downloads.open-tx.org/2.2/rc/sdcard/",
"https://downloads.open-tx.org/2.2/nightlies/sdcard/"
};
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget * parent) :
QDialog(parent),
ui(new Ui::FirmwarePreferencesDialog)
{
@@ -55,25 +55,25 @@ void FirmwarePreferencesDialog::initSettings()
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
mw->checkForFirmwareUpdate();
initSettings();
}
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
mw->dowloadLastFirmwareUpdate();
initSettings();
}
void FirmwarePreferencesDialog::on_sd_dnld_clicked()
{
QString url = g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_SDCARD_DOWNLOADS : OPENTX_SDCARD_DOWNLOADS;
QString url = OPENTX_SDCARD_DOWNLOAD_URL[g.boundedFirmwareBranch()];
QString fwType = g.profile[g.id()].fwType();
QStringList list = fwType.split("-");
QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]);
if (!g.useFirmwareNightlyBuilds()) {
if (g.boundedFirmwareBranch() != BRANCH_NIGHTLY_UNSTABLE) {
url.append(QString("%1/").arg(firmware));
}
QDesktopServices::openUrl(url);
+7 -8
View File
@@ -54,7 +54,6 @@
#include <QDesktopServices>
#define OPENTX_DOWNLOADS_PAGE_URL "http://www.open-tx.org/downloads"
#define OPENTX_COMPANION_DOWNLOADS "https://downloads-22.open-tx.org/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
#ifdef __APPLE__
@@ -69,12 +68,16 @@
#define COMPANION_INSTALL_QUESTION tr("Would you like to launch the installer?")
#else
#define COMPANION_STAMP "companion-linux.stamp"
#define COMPANION_INSTALLER "" // no automatated updates for linux
#define COMPANION_INSTALLER "" // no automated updates for linux
#define COMPANION_FILEMASK "*.*"
#define COMPANION_INSTALL_QUESTION tr("Would you like to launch the installer?")
#endif
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "https://downloads-22.open-tx.org/nightlies/companion"
const char * const OPENTX_COMPANION_DOWNLOAD_URL[] = {
"https://downloads.open-tx.org/2.2/release/companion",
"https://downloads.open-tx.org/2.2/rc/companion",
"https://downloads.open-tx.org/2.2/nightlies/companion"
};
MainWindow::MainWindow():
downloadDialog_forWait(NULL),
@@ -241,11 +244,7 @@ void MainWindow::dowloadLastFirmwareUpdate()
QString MainWindow::getCompanionUpdateBaseUrl()
{
#if defined(ALLOW_NIGHTLY_BUILDS)
return g.useCompanionNightlyBuilds() ? OPENTX_NIGHT_COMPANION_DOWNLOADS : OPENTX_COMPANION_DOWNLOADS;
#else
return OPENTX_COMPANION_DOWNLOADS;
#endif
return OPENTX_COMPANION_DOWNLOAD_URL[g.boundedCompanionBranch()];
}
void MainWindow::checkForUpdates()
+4 -4
View File
@@ -588,15 +588,15 @@ void AppData::init()
getset( _libDir, "libraryPath" ,"" );
getset( _snapshotDir, "snapshotpath" ,"" );
getset( _updatesDir, "lastUpdatesDir" ,"" );
appLogsDir_init();
// booleans
getset( _firmwareBranch, "firmwareBranch", BRANCH_RELEASE_STABLE);
getset( _companionBranch, "companionBranch", BRANCH_RELEASE_STABLE);
appLogsDir_init();
enableBackup_init();
backupOnFlash_init();
outputDisplayDetails_init();
checkHardwareCompatibility_init();
useCompanionNightlyBuilds_init();
useFirmwareNightlyBuilds_init();
removeModelSlots_init();
maximized_init();
simuSW_init();
+21 -2
View File
@@ -25,12 +25,14 @@
#ifndef _APPDATA_H_
#define _APPDATA_H_
#include <QByteArray>
#include <QStringList>
#include <QString>
#include <QSettings>
#include <QStandardPaths>
#include "constants.h"
#include "simulator.h"
#define COMPANY "OpenTX"
@@ -244,8 +246,6 @@ class AppData: protected CompStoreObj
PROPERTY(bool, backupOnFlash, true)
PROPERTY(bool, outputDisplayDetails, false)
PROPERTY(bool, checkHardwareCompatibility, true)
PROPERTY(bool, useCompanionNightlyBuilds, false)
PROPERTY(bool, useFirmwareNightlyBuilds, false)
PROPERTY(bool, removeModelSlots, true)
PROPERTY(bool, maximized, false)
PROPERTY(bool, simuSW, false)
@@ -253,6 +253,9 @@ class AppData: protected CompStoreObj
PROPERTY(bool, appDebugLog, false)
PROPERTY(bool, fwTraceLog, false)
PROPERTY(unsigned, firmwareBranch, BRANCH_RELEASE_STABLE);
PROPERTY(unsigned, companionBranch, BRANCH_RELEASE_STABLE);
PROPERTY4(bool, jsSupport, js_support ,false)
PROPERTY4(bool, showSplash, show_splash ,true)
PROPERTY4(bool, snapToClpbrd, snapshot_to_clipboard ,false)
@@ -423,6 +426,22 @@ class AppData: protected CompStoreObj
bool findPreviousVersionSettings(QString * version);
bool importSettings(QString fromVersion);
inline DownloadBranchType boundedFirmwareBranch() {
#if defined(ALLOW_NIGHTLY_BUILDS)
return qBound(BRANCH_RELEASE_STABLE, DownloadBranchType(firmwareBranch()), 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);
#endif
}
protected:
void convertSettings(QSettings & settings);