1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 05:15:18 +03:00

#2526 - Firmware nightly builds are now downloadable from Companion -

Tests needed
This commit is contained in:
bsongis 2015-07-22 22:24:28 +02:00
parent 0559abd323
commit 8d97235f41
9 changed files with 103 additions and 63 deletions

View file

@ -735,6 +735,9 @@ AppData::AppData()
getset( _backupOnFlash, "backupOnFlash" ,true ); getset( _backupOnFlash, "backupOnFlash" ,true );
getset( _checkHardwareCompatibility, "checkHardwareCompatibility" ,true ); getset( _checkHardwareCompatibility, "checkHardwareCompatibility" ,true );
getset( _useCompanionNightlyBuilds, "useCompanionNightlyBuilds" ,false );
getset( _useFirmwareNightlyBuilds, "useFirmwareNightlyBuilds" ,false );
getset( _jsSupport, "js_support" ,false ); getset( _jsSupport, "js_support" ,false );
getset( _maximized, "maximized" ,false ); getset( _maximized, "maximized" ,false );
getset( _showSplash, "show_splash" ,true ); getset( _showSplash, "show_splash" ,true );

View file

@ -216,6 +216,8 @@ class AppData: protected CompStoreObj
BOOL_PROPERTY(outputDisplayDetails, false) BOOL_PROPERTY(outputDisplayDetails, false)
BOOL_PROPERTY(backupOnFlash, true) BOOL_PROPERTY(backupOnFlash, true)
BOOL_PROPERTY(checkHardwareCompatibility, true) BOOL_PROPERTY(checkHardwareCompatibility, true)
BOOL_PROPERTY(useCompanionNightlyBuilds, false)
BOOL_PROPERTY(useFirmwareNightlyBuilds, false)
// All the global variables // All the global variables
public: public:

View file

@ -41,8 +41,10 @@ AppPreferencesDialog::~AppPreferencesDialog()
void AppPreferencesDialog::writeValues() void AppPreferencesDialog::writeValues()
{ {
g.autoCheckApp(ui->startupCheck_companion9x->isChecked()); g.useCompanionNightlyBuilds(ui->useCompanionNightlyBuilds->isChecked());
g.autoCheckFw(ui->startupCheck_fw->isChecked()); g.autoCheckApp(ui->autoCheckCompanion->isChecked());
g.useFirmwareNightlyBuilds(ui->useFirmwareNightlyBuilds->isChecked());
g.autoCheckFw(ui->autoCheckFirmware->isChecked());
g.showSplash(ui->showSplash->isChecked()); g.showSplash(ui->showSplash->isChecked());
g.simuSW(ui->simuSW->isChecked()); g.simuSW(ui->simuSW->isChecked());
g.useWizard(ui->modelWizard_CB->isChecked()); g.useWizard(ui->modelWizard_CB->isChecked());
@ -107,8 +109,10 @@ void AppPreferencesDialog::initSettings()
ui->snapshotPath->setDisabled(true); ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true); ui->snapshotPathButton->setDisabled(true);
} }
ui->startupCheck_companion9x->setChecked(g.autoCheckApp()); ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
ui->startupCheck_fw->setChecked(g.autoCheckFw()); ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash()); ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.historySize()); ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight()); ui->backLightColor->setCurrentIndex(g.backLight());

View file

@ -39,7 +39,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="profileTab"> <widget class="QWidget" name="profileTab">
<attribute name="title"> <attribute name="title">
@ -645,8 +645,8 @@ Mode 4:
<string>Application Settings</string> <string>Application Settings</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="7" column="1" colspan="3"> <item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="startupCheck_companion9x"> <widget class="QCheckBox" name="autoCheckCompanion">
<property name="text"> <property name="text">
<string>Automatic check for Companion updates</string> <string>Automatic check for Companion updates</string>
</property> </property>
@ -665,7 +665,7 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1" colspan="3"> <item row="13" column="1" colspan="3">
<widget class="QCheckBox" name="backupEnable"> <widget class="QCheckBox" name="backupEnable">
<property name="text"> <property name="text">
<string>Enable automatic backup before writing firmware</string> <string>Enable automatic backup before writing firmware</string>
@ -679,24 +679,7 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1" colspan="3"> <item row="18" column="1">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="startupCheck_fw">
<property name="text">
<string>Automatic check for OpenTX firmware updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="15" column="1">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -709,7 +692,24 @@ Mode 4:
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="12" column="0"> <item row="11" column="1" colspan="3">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QCheckBox" name="autoCheckFirmware">
<property name="text">
<string>Automatic check for OpenTX firmware updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -749,7 +749,7 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="0"> <item row="16" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -784,14 +784,14 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="12" column="0">
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="label_17">
<property name="text"> <property name="text">
<string>Automatic Backup Folder</string> <string>Automatic Backup Folder</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="1" colspan="3"> <item row="14" column="1" colspan="3">
<widget class="Line" name="line_5"> <widget class="Line" name="line_5">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -805,7 +805,7 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="1"> <item row="16" column="1">
<widget class="QLineEdit" name="libraryPath"> <widget class="QLineEdit" name="libraryPath">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -815,7 +815,7 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1"> <item row="15" column="1">
<widget class="QComboBox" name="splashincludeCB"> <widget class="QComboBox" name="splashincludeCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -835,7 +835,7 @@ Mode 4:
</item> </item>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="12" column="1">
<widget class="QLineEdit" name="backupPath"> <widget class="QLineEdit" name="backupPath">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -848,7 +848,7 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="2" colspan="2"> <item row="12" column="2" colspan="2">
<widget class="QPushButton" name="backupPathButton"> <widget class="QPushButton" name="backupPathButton">
<property name="text"> <property name="text">
<string>Open Folder</string> <string>Open Folder</string>
@ -875,13 +875,33 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="2" colspan="2"> <item row="16" column="2" colspan="2">
<widget class="QPushButton" name="libraryPathButton"> <widget class="QPushButton" name="libraryPathButton">
<property name="text"> <property name="text">
<string>Open Folder</string> <string>Open Folder</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1">
<widget class="QCheckBox" name="useFirmwareNightlyBuilds">
<property name="text">
<string>Use OpenTX firmware nightly builds</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" 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>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="simulatorTab"> <widget class="QWidget" name="simulatorTab">
@ -1112,8 +1132,8 @@ Mode 4:
<tabstop>historySize</tabstop> <tabstop>historySize</tabstop>
<tabstop>showSplash</tabstop> <tabstop>showSplash</tabstop>
<tabstop>modelWizard_CB</tabstop> <tabstop>modelWizard_CB</tabstop>
<tabstop>startupCheck_fw</tabstop> <tabstop>autoCheckFirmware</tabstop>
<tabstop>startupCheck_companion9x</tabstop> <tabstop>autoCheckCompanion</tabstop>
<tabstop>backupPath</tabstop> <tabstop>backupPath</tabstop>
<tabstop>backupPathButton</tabstop> <tabstop>backupPathButton</tabstop>
<tabstop>backupEnable</tabstop> <tabstop>backupEnable</tabstop>

View file

@ -1048,7 +1048,7 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
QString OpenTxFirmware::getFirmwareUrl() QString OpenTxFirmware::getFirmwareUrl()
{ {
QString url = OPENTX_FIRMWARE_DOWNLOADS; QString url = (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
switch (board) { switch (board) {
case BOARD_STOCK: case BOARD_STOCK:
case BOARD_M128: case BOARD_M128:
@ -1072,16 +1072,16 @@ QString OpenTxFirmware::getFirmwareUrl()
QString OpenTxFirmware::getReleaseNotesUrl() QString OpenTxFirmware::getReleaseNotesUrl()
{ {
QString url = OPENTX_FIRMWARE_DOWNLOADS; QString url = (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
url.append("/releasenotes.txt"); url.append("/releasenotes.txt");
return url; return url;
} }
QString OpenTxFirmware::getStampUrl() QString OpenTxFirmware::getStampUrl()
{ {
QString url = OPENTX_FIRMWARE_DOWNLOADS; QString url = (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
url.append("/stamp-opentx.txt"); url.append("/stamp-opentx.txt");
return url; return url;
} }
void addOpenTxCommonOptions(OpenTxFirmware * firmware) void addOpenTxCommonOptions(OpenTxFirmware * firmware)

View file

@ -19,7 +19,8 @@
#include "eeprominterface.h" #include "eeprominterface.h"
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware" #define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware"
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/nightly/firmware"
class RleFile; class RleFile;

View file

@ -1017,27 +1017,36 @@ QPixmap makePixMap( QImage image, QString firmwareType )
return(QPixmap::fromImage(image)); return(QPixmap::fromImage(image));
} }
int version2index(QString version) int version2index(const QString & version)
{ {
QStringList parts = version.split('.'); int result = 999;
int result = 0; QStringList parts = version.split(":n");
if (parts.size() > 2)
result = parts[2].toInt();
if (parts.size() > 1) if (parts.size() > 1)
result += 100 * parts[1].toInt(); result = parts[1].toInt(); // nightly build
parts = parts[0].split('.');
if (parts.size() > 2)
result += 1000 * parts[2].toInt();
if (parts.size() > 1)
result += 100000 * parts[1].toInt();
if (parts.size() > 0) if (parts.size() > 0)
result += 10000 * parts[0].toInt(); result += 10000000 * parts[0].toInt();
return result; return result;
} }
QString index2version(int index) QString index2version(int index)
{ {
if (index >= 19900) { if (index >= 19900000) {
int nightly = index % 1000;
index /= 1000;
int revision = index % 100; int revision = index % 100;
index /= 100; index /= 100;
int minor = index % 100; int minor = index % 100;
int major = index / 100; int major = index / 100;
return QString("%1.%2.%3").arg(major).arg(minor).arg(revision); QString result = QString("%1.%2.%3").arg(major).arg(minor).arg(revision);
if (nightly > 0 && nightly < 999) {
result += QString(":n%1").arg(nightly);
}
return result;
} }
else { else {
return QString(); return QString();

View file

@ -162,7 +162,7 @@ QVector<T> findWidgets(QObject * object, const QString & name)
// Format a pixmap to fit on the radio using a specific firmware // Format a pixmap to fit on the radio using a specific firmware
QPixmap makePixMap( QImage image, QString firmwareType ); QPixmap makePixMap( QImage image, QString firmwareType );
int version2index(QString version); int version2index(const QString & version);
QString index2version(int index); QString index2version(int index);
class QTimeS : public QTime class QTimeS : public QTime

View file

@ -70,15 +70,16 @@
#include "radiointerface.h" #include "radiointerface.h"
#include "progressdialog.h" #include "progressdialog.h"
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion" #define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2" #define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/nightly/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
#ifdef __APPLE__ #ifdef __APPLE__
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-macosx.stamp" #define COMPANION_STAMP "companion-macosx.stamp"
#define C9X_INSTALLER "/companion-macosx-%1.dmg" #define COMPANION_INSTALLER "companion-macosx-%1.dmg"
#else #else
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-windows.stamp" #define COMPANION_STAMP "companion-windows.stamp"
#define C9X_INSTALLER "/companion-windows-%1.exe" #define COMPANION_INSTALLER "companion-windows-%1.exe"
#endif #endif
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
@ -228,7 +229,7 @@ void MainWindow::checkForUpdates()
// TODO why create each time a network manager? // TODO why create each time a network manager?
networkManager = new QNetworkAccessManager(this); networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForCompanionUpdateFinished(QNetworkReply*))); connect(networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForCompanionUpdateFinished(QNetworkReply*)));
QNetworkRequest request(QUrl(C9X_STAMP)); QNetworkRequest request(QUrl(QString("%1/%2").arg(g.useCompanionNightlyBuilds() ? OPENTX_NIGHT_COMPANION_DOWNLOADS : OPENTX_COMPANION_DOWNLOADS).arg(COMPANION_STAMP)));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
networkManager->get(request); networkManager->get(request);
} }
@ -289,13 +290,13 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
if (ret == QMessageBox::Yes) { if (ret == QMessageBox::Yes) {
#if defined __APPLE__ #if defined __APPLE__
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version)); QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version));
#else #else
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version), tr("Executable (*.exe)")); QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version), tr("Executable (*.exe)"));
#endif #endif
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.updatesDir(QFileInfo(fileName).dir().absolutePath()); g.updatesDir(QFileInfo(fileName).dir().absolutePath());
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName); downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(g.useCompanionNightlyBuilds() ? OPENTX_NIGHT_COMPANION_DOWNLOADS : OPENTX_COMPANION_DOWNLOADS).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
installer_fileName = fileName; installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded())); connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
dd->exec(); dd->exec();