mirror of
https://github.com/opentx/opentx.git
synced 2025-07-22 15:55:26 +03:00
Refactoring of automatic updates (companion and firmware)
This commit is contained in:
parent
dc2ac966a3
commit
e91390690c
10 changed files with 307 additions and 349 deletions
|
@ -2,7 +2,8 @@ PROJECT( companion )
|
||||||
|
|
||||||
SET( C9X_VERSION_MAJOR "1" )
|
SET( C9X_VERSION_MAJOR "1" )
|
||||||
SET( C9X_VERSION_MINOR "99" )
|
SET( C9X_VERSION_MINOR "99" )
|
||||||
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} )
|
SET( C9X_VERSION_REVISION "1" )
|
||||||
|
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||||
|
|
||||||
|
|
|
@ -199,33 +199,14 @@ void CompStoreObj::getset( int &number, const QString tag, const int def, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// ** FwRevision class********************
|
// ** FwRevision class********************
|
||||||
long FwRevision::get( const QString fwType )
|
int FwRevision::get( const QString fwType )
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
retrieve( result, fwType, "", "FwRevisions" );
|
retrieve( result, fwType, "", "FwRevisions" );
|
||||||
return result.toLong();
|
return result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FwRevision::getString( const QString fwType )
|
void FwRevision::set( const QString fwType, const int fwRevision )
|
||||||
{
|
|
||||||
long revision = get(fwType);
|
|
||||||
if (revision > 19920140101) {
|
|
||||||
int day = revision % 100;
|
|
||||||
revision /= 100;
|
|
||||||
int month = revision % 100;
|
|
||||||
revision /= 100;
|
|
||||||
int year = revision % 10000;
|
|
||||||
revision /= 10000;
|
|
||||||
int minor = revision % 100;
|
|
||||||
revision /= 100;
|
|
||||||
return QString("%1.%2 (%3-%4-%5)").arg(revision).arg(minor, 2, 10, (const QChar)'0').arg(year, 4, 10, (const QChar)'0').arg(month, 2, 10, (const QChar)'0').arg(day, 2, 10, (const QChar)'0');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FwRevision::set( const QString fwType, const long fwRevision )
|
|
||||||
{
|
{
|
||||||
QString tempString = QString("%1").arg(fwRevision);
|
QString tempString = QString("%1").arg(fwRevision);
|
||||||
store( tempString, tempString, fwType, "FwRevisions" );
|
store( tempString, tempString, fwType, "FwRevisions" );
|
||||||
|
|
|
@ -58,9 +58,8 @@ class CompStoreObj
|
||||||
class FwRevision: protected CompStoreObj
|
class FwRevision: protected CompStoreObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
long get( const QString);
|
int get( const QString);
|
||||||
QString getString( const QString);
|
void set( const QString, const int );
|
||||||
void set( const QString, const long );
|
|
||||||
void remove( const QString );
|
void remove( const QString );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
#include "hexinterface.h"
|
#include "hexinterface.h"
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
#include "flashinterface.h"
|
#include "flashinterface.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
#define VERS_MARK "VERS"
|
#define VERS_MARK "VERS"
|
||||||
#define DATE_MARK "DATE"
|
#define DATE_MARK "DATE"
|
||||||
#define TIME_MARK "TIME"
|
#define TIME_MARK "TIME"
|
||||||
#define BLD_MARK "BLD"
|
|
||||||
#define EEPR_MARK "EEPR"
|
#define EEPR_MARK "EEPR"
|
||||||
|
|
||||||
int getFileType(const QString &fullFileName)
|
int getFileType(const QString &fullFileName)
|
||||||
|
@ -45,6 +45,7 @@ int getFileType(const QString &fullFileName)
|
||||||
FlashInterface::FlashInterface(QString fileName):
|
FlashInterface::FlashInterface(QString fileName):
|
||||||
flash(MAX_FSIZE, 0),
|
flash(MAX_FSIZE, 0),
|
||||||
flash_size(0),
|
flash_size(0),
|
||||||
|
versionId(0),
|
||||||
splash_offset(0),
|
splash_offset(0),
|
||||||
splash_size(0),
|
splash_size(0),
|
||||||
splash_width(0),
|
splash_width(0),
|
||||||
|
@ -69,6 +70,7 @@ FlashInterface::FlashInterface(QString fileName):
|
||||||
date = seekLabel(DATE_MARK);
|
date = seekLabel(DATE_MARK);
|
||||||
time = seekLabel(TIME_MARK);
|
time = seekLabel(TIME_MARK);
|
||||||
eeprom = seekLabel(EEPR_MARK);
|
eeprom = seekLabel(EEPR_MARK);
|
||||||
|
versionId = version2index(version);
|
||||||
SeekSplash();
|
SeekSplash();
|
||||||
isValidFlag = true;
|
isValidFlag = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ class FlashInterface
|
||||||
FlashInterface(QString filename);
|
FlashInterface(QString filename);
|
||||||
inline QString getDate() { return date; }
|
inline QString getDate() { return date; }
|
||||||
inline QString getTime() { return time; }
|
inline QString getTime() { return time; }
|
||||||
inline QString getStamp() { return QString("%1%2").arg(version.replace(".", "")).arg(date.replace("-", "")); }
|
|
||||||
int getSize() { return flash_size; }
|
int getSize() { return flash_size; }
|
||||||
inline QString getVersion() { return version; }
|
inline QString getVersion() { return version; }
|
||||||
|
unsigned int getVersionId() { return versionId; }
|
||||||
inline QString getEEprom() { return eeprom; }
|
inline QString getEEprom() { return eeprom; }
|
||||||
QImage getSplash();
|
QImage getSplash();
|
||||||
bool setSplash(const QImage & newsplash);
|
bool setSplash(const QImage & newsplash);
|
||||||
|
@ -71,6 +71,7 @@ class FlashInterface
|
||||||
QString date;
|
QString date;
|
||||||
QString time;
|
QString time;
|
||||||
QString version;
|
QString version;
|
||||||
|
int versionId;
|
||||||
QString eeprom;
|
QString eeprom;
|
||||||
QByteArray splash;
|
QByteArray splash;
|
||||||
uint splash_offset;
|
uint splash_offset;
|
||||||
|
|
|
@ -24,17 +24,16 @@ FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
|
||||||
void FirmwarePreferencesDialog::initSettings()
|
void FirmwarePreferencesDialog::initSettings()
|
||||||
{
|
{
|
||||||
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
|
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
|
||||||
QString revision = g.fwRev.getString(g.profile[g.id()].fwType());
|
int version = g.fwRev.get(g.profile[g.id()].fwType());
|
||||||
if (!revision.isEmpty()) {
|
if (version > 0) {
|
||||||
ui->lastRevisionLbl->setText(revision);
|
ui->lastRevisionLbl->setText(index2version(version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
||||||
{
|
{
|
||||||
MainWindow * mw = (MainWindow *)this->parent();
|
MainWindow * mw = (MainWindow *)this->parent();
|
||||||
QString fwType = g.profile[g.id()].fwType();
|
mw->checkForFirmwareUpdate();
|
||||||
mw->checkForUpdates(true, fwType);
|
|
||||||
initSettings();
|
initSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -989,3 +989,30 @@ QPixmap makePixMap( QImage image, QString firmwareType )
|
||||||
}
|
}
|
||||||
return(QPixmap::fromImage(image));
|
return(QPixmap::fromImage(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int version2index(QString version)
|
||||||
|
{
|
||||||
|
QStringList parts = version.split('.');
|
||||||
|
int result = 0;
|
||||||
|
if (parts.size() > 2)
|
||||||
|
result = parts[2].toInt();
|
||||||
|
if (parts.size() > 1)
|
||||||
|
result += 100 * parts[1].toInt();
|
||||||
|
if (parts.size() > 0)
|
||||||
|
result += 10000 * parts[0].toInt();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString index2version(int index)
|
||||||
|
{
|
||||||
|
if (index >= 19900) {
|
||||||
|
int revision = index % 100;
|
||||||
|
index /= 100;
|
||||||
|
int minor = index % 100;
|
||||||
|
int major = index / 100;
|
||||||
|
return QString("%1.%2.%3").arg(major).arg(minor).arg(revision);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -130,4 +130,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
|
||||||
// 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);
|
||||||
|
QString index2version(int index);
|
||||||
|
|
||||||
#endif // HELPERS_H
|
#endif // HELPERS_H
|
||||||
|
|
|
@ -85,7 +85,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MainWindow::MainWindow():
|
MainWindow::MainWindow():
|
||||||
downloadDialog_forWait(NULL)
|
downloadDialog_forWait(NULL),
|
||||||
|
checkForUpdatesState(0)
|
||||||
{
|
{
|
||||||
mdiArea = new QMdiArea(this);
|
mdiArea = new QMdiArea(this);
|
||||||
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
@ -184,78 +185,92 @@ void MainWindow::displayWarnings()
|
||||||
|
|
||||||
void MainWindow::doAutoUpdates()
|
void MainWindow::doAutoUpdates()
|
||||||
{
|
{
|
||||||
checkForUpdates(false, current_firmware_variant.id);
|
if (g.autoCheckApp())
|
||||||
|
checkForUpdatesState |= CHECK_COMPANION;
|
||||||
|
if (g.autoCheckFw())
|
||||||
|
checkForUpdatesState |= CHECK_FIRMWARE;
|
||||||
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::doUpdates()
|
void MainWindow::doUpdates()
|
||||||
{
|
{
|
||||||
checkForUpdates(true, current_firmware_variant.id);
|
checkForUpdatesState = CHECK_COMPANION | CHECK_FIRMWARE | SHOW_DIALOG_WAIT;
|
||||||
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
|
void MainWindow::checkForFirmwareUpdate()
|
||||||
{
|
{
|
||||||
showcheckForUpdatesResult = ignoreSettings;
|
checkForUpdatesState = CHECK_FIRMWARE | SHOW_DIALOG_WAIT;
|
||||||
check1done = true;
|
checkForUpdates();
|
||||||
check2done = true;
|
}
|
||||||
fwToUpdate = fwId;
|
|
||||||
QString stamp = GetFirmware(fwToUpdate)->getStampUrl();
|
|
||||||
|
|
||||||
|
void MainWindow::checkForUpdates()
|
||||||
|
{
|
||||||
|
if (checkForUpdatesState & SHOW_DIALOG_WAIT) {
|
||||||
|
checkForUpdatesState -= SHOW_DIALOG_WAIT;
|
||||||
|
downloadDialog_forWait = new downloadDialog(this, tr("Checking for updates"));
|
||||||
|
downloadDialog_forWait->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkForUpdatesState & CHECK_COMPANION) {
|
||||||
|
checkForUpdatesState -= CHECK_COMPANION;
|
||||||
|
// TODO why create each time a network manager?
|
||||||
|
networkManager = new QNetworkAccessManager(this);
|
||||||
|
connect(networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForCompanionUpdateFinished(QNetworkReply*)));
|
||||||
|
QNetworkRequest request(QUrl(C9X_STAMP));
|
||||||
|
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||||
|
networkManager->get(request);
|
||||||
|
}
|
||||||
|
else if (checkForUpdatesState & CHECK_FIRMWARE) {
|
||||||
|
checkForUpdatesState -= CHECK_FIRMWARE;
|
||||||
|
QString stamp = GetFirmware(current_firmware_variant.id)->getStampUrl();
|
||||||
if (!stamp.isEmpty()) {
|
if (!stamp.isEmpty()) {
|
||||||
if (g.autoCheckFw() || ignoreSettings) {
|
networkManager = new QNetworkAccessManager(this);
|
||||||
check1done=false;
|
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForFirmwareUpdateFinished(QNetworkReply*)));
|
||||||
manager1 = new QNetworkAccessManager(this);
|
QUrl url(stamp);
|
||||||
connect(manager1, SIGNAL(finished(QNetworkReply*)), this, SLOT(reply1Finished(QNetworkReply*)));
|
QNetworkRequest request(url);
|
||||||
QUrl url(stamp);
|
|
||||||
QNetworkRequest request(url);
|
|
||||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
|
||||||
manager1->get(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g.autoCheckApp() || ignoreSettings) {
|
|
||||||
check2done = false;
|
|
||||||
manager2 = new QNetworkAccessManager(this);
|
|
||||||
connect(manager2, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForUpdateFinished(QNetworkReply*)));
|
|
||||||
QNetworkRequest request(QUrl(C9X_STAMP));
|
|
||||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||||
manager2->get(request);
|
networkManager->get(request);
|
||||||
}
|
|
||||||
|
|
||||||
if(ignoreSettings) {
|
|
||||||
downloadDialog_forWait = new downloadDialog(this, tr("Checking for updates"));
|
|
||||||
downloadDialog_forWait->exec();
|
|
||||||
} else {
|
|
||||||
downloadDialog_forWait = NULL; // TODO needed?
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (checkForUpdatesState==0) {
|
||||||
|
closeUpdatesWaitDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
|
void MainWindow::onUpdatesError()
|
||||||
{
|
{
|
||||||
check2done = true;
|
checkForUpdatesState = 0;
|
||||||
if(check1done && check2done && downloadDialog_forWait) {
|
closeUpdatesWaitDialog();
|
||||||
downloadDialog_forWait->close();
|
QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
|
||||||
// TODO delete downloadDialog_forWait?
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void MainWindow::closeUpdatesWaitDialog()
|
||||||
|
{
|
||||||
|
if (downloadDialog_forWait) {
|
||||||
|
downloadDialog_forWait->close();
|
||||||
|
delete downloadDialog_forWait;
|
||||||
|
downloadDialog_forWait = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||||
|
{
|
||||||
QByteArray qba = reply->readAll();
|
QByteArray qba = reply->readAll();
|
||||||
int i = qba.indexOf("C9X_VERSION");
|
int i = qba.indexOf("C9X_VERSION");
|
||||||
|
|
||||||
if (i>0) {
|
if (i>0) {
|
||||||
QString version = qba.mid(i+14, 4);
|
QString version = qba.mid(i+14, qba.indexOf("\"", i+14)-i-14);
|
||||||
|
|
||||||
if (version.isNull()) {
|
if (version.isNull()) {
|
||||||
QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
|
return onUpdatesError();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
double vnum=version.toDouble();
|
|
||||||
QString c9xversion=QString(C9X_VERSION);
|
int vnum = version2index(version);
|
||||||
int i;
|
|
||||||
for (i=0; i<c9xversion.length();i++) {
|
QString c9xversion = QString(C9X_VERSION);
|
||||||
if (!(c9xversion.at(i).isDigit() || c9xversion.at(i).isPunct()))
|
int c9xver = version2index(c9xversion);
|
||||||
break;
|
|
||||||
}
|
if (c9xver < vnum) {
|
||||||
double c9xver=(c9xversion.left(i).toDouble());
|
|
||||||
if (c9xver< vnum) {
|
|
||||||
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
|
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
|
||||||
showcheckForUpdatesResult = false; // update is available - do not show dialog
|
showcheckForUpdatesResult = false; // update is available - do not show dialog
|
||||||
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
|
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
|
||||||
|
@ -279,14 +294,18 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
|
||||||
#else
|
#else
|
||||||
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
|
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
if (showcheckForUpdatesResult && check1done && check2done)
|
|
||||||
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
|
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
if(check1done && check2done)
|
if (downloadDialog_forWait && checkForUpdatesState==0) {
|
||||||
QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
|
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return onUpdatesError();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateDownloaded()
|
void MainWindow::updateDownloaded()
|
||||||
|
@ -294,7 +313,7 @@ void MainWindow::updateDownloaded()
|
||||||
int ret = QMessageBox::question(this, "Companion", tr("Would you like to launch the installer?") ,
|
int ret = QMessageBox::question(this, "Companion", tr("Would you like to launch the installer?") ,
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
if (ret == QMessageBox::Yes) {
|
if (ret == QMessageBox::Yes) {
|
||||||
if(QDesktopServices::openUrl(QUrl::fromLocalFile(installer_fileName)))
|
if (QDesktopServices::openUrl(QUrl::fromLocalFile(installer_fileName)))
|
||||||
QApplication::exit();
|
QApplication::exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,7 +326,6 @@ void MainWindow::downloadLatestFW(FirmwareVariant & firmware)
|
||||||
ext = url.mid(url.lastIndexOf("."));
|
ext = url.mid(url.lastIndexOf("."));
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmware.id + ext);
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmware.id + ext);
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
downloadedFW = firmware.id;
|
|
||||||
needRename = true;
|
needRename = true;
|
||||||
g.profile[g.id()].fwName(fileName);
|
g.profile[g.id()].fwName(fileName);
|
||||||
if (!cpuid.isEmpty()) {
|
if (!cpuid.isEmpty()) {
|
||||||
|
@ -316,279 +334,205 @@ void MainWindow::downloadLatestFW(FirmwareVariant & firmware)
|
||||||
}
|
}
|
||||||
g.flashDir(QFileInfo(fileName).dir().absolutePath());
|
g.flashDir(QFileInfo(fileName).dir().absolutePath());
|
||||||
downloadDialog * dd = new downloadDialog(this, url, fileName);
|
downloadDialog * dd = new downloadDialog(this, url, fileName);
|
||||||
connect(dd, SIGNAL(accepted()), this, SLOT(reply1Accepted()));
|
connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted()));
|
||||||
dd->exec();
|
dd->exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reply1Accepted()
|
void MainWindow::firmwareDownloadAccepted()
|
||||||
{
|
{
|
||||||
QString errormsg;
|
QString errormsg;
|
||||||
if (g.profile[g.id()].fwName().isEmpty()) {
|
QFile file(g.profile[g.id()].fwName());
|
||||||
if (!(downloadedFW.isEmpty())) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||||
QFile file(downloadedFW);
|
QMessageBox::critical(this, tr("Error"),
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
tr("Error opening file %1:\n%2.")
|
||||||
QMessageBox::critical(this, tr("Error"),
|
.arg(g.profile[g.id()].fwName())
|
||||||
tr("Error opening file %1:\n%2.")
|
.arg(file.errorString()));
|
||||||
.arg(downloadedFW)
|
return;
|
||||||
.arg(file.errorString()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
file.reset();
|
|
||||||
QTextStream inputStream(&file);
|
|
||||||
QString hline = inputStream.readLine();
|
|
||||||
if (hline.startsWith("ERROR:")) {
|
|
||||||
int errnum=hline.mid(6).toInt();
|
|
||||||
switch(errnum) {
|
|
||||||
case 1:
|
|
||||||
errormsg=tr("Not enough memory for all the selected firmware options");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
errormsg=tr("Compilation server temporary failure, try later");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
errormsg=tr("Compilation server too busy, try later");
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
errormsg=tr("Compilation server requires registration, please check OpenTX web site");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
errormsg=tr("Unknown server failure, try later");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
QMessageBox::critical(this, tr("Error"), errormsg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
currentFWrev = currentFWrev_temp;
|
|
||||||
qDebug() << currentFWrev;
|
|
||||||
g.fwRev.set(downloadedFW, currentFWrev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
file.reset();
|
||||||
QFile file(g.profile[g.id()].fwName());
|
QTextStream inputStream(&file);
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
QString hline = inputStream.readLine();
|
||||||
QMessageBox::critical(this, tr("Error"),
|
if (hline.startsWith("ERROR:")) {
|
||||||
tr("Error opening file %1:\n%2.")
|
int errnum=hline.mid(6).toInt();
|
||||||
.arg(g.profile[g.id()].fwName())
|
switch(errnum) {
|
||||||
.arg(file.errorString()));
|
case 1:
|
||||||
return;
|
errormsg = tr("Not enough memory for all the selected firmware options");
|
||||||
}
|
break;
|
||||||
file.reset();
|
case 2:
|
||||||
QTextStream inputStream(&file);
|
errormsg = tr("Compilation server termporary failure, try later");
|
||||||
QString hline = inputStream.readLine();
|
break;
|
||||||
if (hline.startsWith("ERROR:")) {
|
case 3:
|
||||||
int errnum=hline.mid(6).toInt();
|
errormsg = tr("Compilation server too busy, try later");
|
||||||
switch(errnum) {
|
break;
|
||||||
case 1:
|
case 4:
|
||||||
errormsg = tr("Not enough memory for all the selected firmware options");
|
errormsg = tr("Compilation server requires registration, please check OpenTX web site");
|
||||||
break;
|
break;
|
||||||
case 2:
|
default:
|
||||||
errormsg = tr("Compilation server termporary failure, try later");
|
errormsg = tr("Unknown server failure, try later");
|
||||||
break;
|
break;
|
||||||
case 3:
|
|
||||||
errormsg = tr("Compilation server too busy, try later");
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
errormsg = tr("Compilation server requires registration, please check OpenTX web site");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
errormsg = tr("Unknown server failure, try later");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
QMessageBox::critical(this, tr("Error"), errormsg);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
FlashInterface flash(g.profile[g.id()].fwName());
|
QMessageBox::critical(this, tr("Error"), errormsg);
|
||||||
long stamp = flash.getStamp().toLong();
|
return;
|
||||||
if (stamp > 0) {
|
}
|
||||||
currentFWrev = stamp;
|
file.close();
|
||||||
|
FlashInterface flash(g.profile[g.id()].fwName());
|
||||||
|
int stamp = flash.getVersionId();
|
||||||
|
if (stamp > 0) {
|
||||||
#if 0
|
#if 0
|
||||||
// TODO what's that?
|
if (g.profile[g.id()].renameFwFiles() && needRename) {
|
||||||
if (g.profile[g.id()].renameFwFiles() && needRename) {
|
QFileInfo fi(g.profile[g.id()].fwName());
|
||||||
QFileInfo fi(g.profile[g.id()].fwName());
|
QString path=fi.path()+QDir::separator ();
|
||||||
QString path=fi.path()+QDir::separator ();
|
path.append(fi.completeBaseName());
|
||||||
path.append(fi.completeBaseName());
|
path.append(rev.mid(pos));
|
||||||
path.append(rev.mid(pos));
|
path.append(".");
|
||||||
path.append(".");
|
path.append(fi.suffix());
|
||||||
path.append(fi.suffix());
|
QDir qd;
|
||||||
QDir qd;
|
qd.remove(path);
|
||||||
qd.remove(path);
|
qd.rename(g.profile[g.id()].fwName(),path);
|
||||||
qd.rename(g.profile[g.id()].fwName(),path);
|
g.profile[g.id()].fwName(path);
|
||||||
g.profile[g.id()].fwName(path);
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
g.fwRev.set(downloadedFW, currentFWrev);
|
g.fwRev.set(current_firmware_variant.id, stamp);
|
||||||
if (g.profile[g.id()].burnFirmware()) {
|
if (g.profile[g.id()].burnFirmware()) {
|
||||||
int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
|
int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
|
||||||
if (ret == QMessageBox::Yes) {
|
if (ret == QMessageBox::Yes) {
|
||||||
writeFlash(g.profile[g.id()].fwName());
|
writeFlash(g.profile[g.id()].fwName());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reply1Finished(QNetworkReply * reply)
|
void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||||
{
|
{
|
||||||
int OldFwRev;
|
|
||||||
check1done = true;
|
|
||||||
bool download = false;
|
bool download = false;
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
QString cpuid;
|
QString cpuid;
|
||||||
|
|
||||||
if(check1done && check2done && downloadDialog_forWait) {
|
|
||||||
downloadDialog_forWait->close();
|
|
||||||
// TODO delete downloadDialog_forWait?
|
|
||||||
}
|
|
||||||
|
|
||||||
cpuid = g.cpuId();
|
cpuid = g.cpuId();
|
||||||
QByteArray qba = reply->readAll();
|
QByteArray qba = reply->readAll();
|
||||||
int i = qba.indexOf("SVN_VERS");
|
|
||||||
int warning = qba.indexOf("WARNING");
|
|
||||||
|
|
||||||
|
long version = 0;
|
||||||
|
|
||||||
if (i>0) {
|
int versionIndex = qba.indexOf("VERS_STR");
|
||||||
bool cres;
|
int dateIndex = qba.indexOf("DATE_STR");
|
||||||
int k = qba.indexOf("-r", i);
|
|
||||||
int l = qba.indexOf('"', k);
|
|
||||||
qDebug() << qba;
|
|
||||||
int rev = QString::fromAscii(qba.mid(k+2, l-k-2)).toInt(&cres);
|
|
||||||
QString newrev=qba.mid(k).replace('"', "").trimmed();
|
|
||||||
|
|
||||||
if(!cres) {
|
QString versionString;
|
||||||
QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
|
if (versionIndex > 0 && dateIndex > 0) {
|
||||||
g.fwServerFails(g.fwServerFails()+1);
|
versionString = qba.mid(versionIndex+10, qba.indexOf("\"", versionIndex+10)-versionIndex-10);
|
||||||
return;
|
QString dateString = qba.mid(dateIndex+10, 10);
|
||||||
|
version = version2index(versionString);
|
||||||
|
versionString = QString("%1 (%2)").arg(versionString).arg(dateString);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version > 0) {
|
||||||
|
int currentVersion = g.fwRev.get(current_firmware_variant.id);
|
||||||
|
QString currentVersionString = index2version(currentVersion);
|
||||||
|
|
||||||
|
QMessageBox msgBox;
|
||||||
|
QSpacerItem * horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
QGridLayout * layout = (QGridLayout*)msgBox.layout();
|
||||||
|
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
|
|
||||||
|
if (currentVersion == 0) {
|
||||||
|
QString rn = GetFirmware(current_firmware_variant.id)->getReleaseNotesUrl();
|
||||||
|
QAbstractButton *rnButton = NULL;
|
||||||
|
msgBox.setWindowTitle("Companion");
|
||||||
|
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?").arg(current_firmware_variant.id).arg(versionString));
|
||||||
|
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||||
|
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
|
||||||
|
if (!rn.isEmpty()) {
|
||||||
|
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
|
||||||
|
}
|
||||||
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
|
msgBox.resize(0, 0);
|
||||||
|
msgBox.exec();
|
||||||
|
if (msgBox.clickedButton() == rnButton) {
|
||||||
|
contributorsDialog *cd = new contributorsDialog(this,2,rn);
|
||||||
|
cd->exec();
|
||||||
|
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 %2 now ?").arg(versionString), QMessageBox::Yes | QMessageBox::No);
|
||||||
|
if (ret2 == QMessageBox::Yes)
|
||||||
|
download = true;
|
||||||
|
else
|
||||||
|
ignore = true;
|
||||||
|
}
|
||||||
|
else if (msgBox.clickedButton() == YesButton ) {
|
||||||
|
download = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ignore = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (version > currentVersion) {
|
||||||
if(rev>0) {
|
QString rn = GetFirmware(current_firmware_variant.id)->getReleaseNotesUrl();
|
||||||
NewFwRev = rev;
|
QAbstractButton *rnButton;
|
||||||
OldFwRev = g.fwRev.get(fwToUpdate);
|
msgBox.setText("Companion");
|
||||||
QMessageBox msgBox;
|
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now ?").arg(current_firmware_variant.id).arg(currentVersionString).arg(versionString));
|
||||||
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||||
QGridLayout* layout = (QGridLayout*)msgBox.layout();
|
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
|
||||||
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
if (!rn.isEmpty()) {
|
||||||
if (OldFwRev == 0) {
|
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
|
||||||
showcheckForUpdatesResult = false; // update is available - do not show dialog
|
}
|
||||||
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
QAbstractButton *rnButton = NULL;
|
msgBox.resize(0,0);
|
||||||
msgBox.setWindowTitle("Companion");
|
msgBox.exec();
|
||||||
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now ?").arg(fwToUpdate).arg(NewFwRev));
|
if( msgBox.clickedButton() == rnButton ) {
|
||||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
contributorsDialog *cd = new contributorsDialog(this, 2, rn);
|
||||||
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
|
cd->exec();
|
||||||
if (!rn.isEmpty()) {
|
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(versionString),
|
||||||
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
}
|
if (ret2 == QMessageBox::Yes) {
|
||||||
msgBox.setIcon(QMessageBox::Question);
|
|
||||||
msgBox.resize(0,0);
|
|
||||||
msgBox.exec();
|
|
||||||
if( msgBox.clickedButton() == rnButton ) {
|
|
||||||
contributorsDialog *cd = new contributorsDialog(this,2,rn);
|
|
||||||
cd->exec();
|
|
||||||
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(NewFwRev),
|
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if (ret2 == QMessageBox::Yes) {
|
|
||||||
download = true;
|
|
||||||
} else {
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
} else if (msgBox.clickedButton() == YesButton ) {
|
|
||||||
download = true;
|
download = true;
|
||||||
} else {
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (NewFwRev > OldFwRev) {
|
|
||||||
showcheckForUpdatesResult = false; // update is available - do not show dialog
|
|
||||||
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
|
|
||||||
QAbstractButton *rnButton;
|
|
||||||
msgBox.setText("Companion");
|
|
||||||
msgBox.setInformativeText(tr("A new version of %1 firmware is available (current %2 - newer %3).\nDo you want to download it now ?").arg(fwToUpdate).arg(OldFwRev).arg(NewFwRev));
|
|
||||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
|
||||||
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
|
|
||||||
if (!rn.isEmpty()) {
|
|
||||||
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
|
|
||||||
}
|
|
||||||
msgBox.setIcon(QMessageBox::Question);
|
|
||||||
msgBox.resize(0,0);
|
|
||||||
msgBox.exec();
|
|
||||||
if( msgBox.clickedButton() == rnButton ) {
|
|
||||||
warning=0;
|
|
||||||
contributorsDialog *cd = new contributorsDialog(this,2,rn);
|
|
||||||
cd->exec();
|
|
||||||
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(NewFwRev),
|
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if (ret2 == QMessageBox::Yes) {
|
|
||||||
download = true;
|
|
||||||
} else {
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
} else if (msgBox.clickedButton() == YesButton ) {
|
|
||||||
download = true;
|
|
||||||
} else {
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(showcheckForUpdatesResult && check1done && check2done)
|
|
||||||
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
|
|
||||||
}
|
|
||||||
if (ignore) {
|
|
||||||
int res = QMessageBox::question(this, "Companion",tr("Ignore this version (r%1)?").arg(rev), QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if (res==QMessageBox::Yes) {
|
|
||||||
g.fwRev.set(fwToUpdate, NewFwRev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (download == true) {
|
|
||||||
if (warning>0) {
|
|
||||||
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
|
|
||||||
if (!rn.isEmpty()) {
|
|
||||||
int ret2 = QMessageBox::warning(this, "Companion", tr("Release notes contain very important informations. Do you want to see them now ?"), QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if (ret2 == QMessageBox::Yes) {
|
|
||||||
contributorsDialog *cd = new contributorsDialog(this,2,rn);
|
|
||||||
cd->exec();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
downloadedFW = fwToUpdate;
|
|
||||||
QString url = GetFirmwareVariant(fwToUpdate).getFirmwareUrl();
|
|
||||||
QString ext = url.mid(url.lastIndexOf("."));
|
|
||||||
needRename=false;
|
|
||||||
bool addversion=g.profile[g.id()].renameFwFiles();
|
|
||||||
QString fileName;
|
|
||||||
if (addversion) {
|
|
||||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + fwToUpdate + newrev + ext);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + fwToUpdate + ext);
|
ignore = true;
|
||||||
}
|
|
||||||
if (!fileName.isEmpty()) {
|
|
||||||
if (!cpuid.isEmpty()) {
|
|
||||||
url.append("&cpuid=");
|
|
||||||
url.append(cpuid);
|
|
||||||
}
|
|
||||||
g.profile[g.id()].fwName( fileName );
|
|
||||||
g.flashDir(QFileInfo(fileName).dir().absolutePath());
|
|
||||||
downloadDialog * dd = new downloadDialog(this, url, fileName);
|
|
||||||
currentFWrev_temp = NewFwRev;
|
|
||||||
connect(dd, SIGNAL(accepted()), this, SLOT(reply1Accepted()));
|
|
||||||
dd->exec();
|
|
||||||
downloadedFW = fwToUpdate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
else if (msgBox.clickedButton() == YesButton ) {
|
||||||
QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
|
download = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ignore = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
if(check1done && check2done) {
|
if (downloadDialog_forWait && checkForUpdatesState==0) {
|
||||||
QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
|
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
|
||||||
g.fwServerFails(g.fwServerFails()+1);
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (ignore) {
|
||||||
|
int res = QMessageBox::question(this, "Companion", tr("Ignore this release %1?").arg(versionString), QMessageBox::Yes | QMessageBox::No);
|
||||||
|
if (res==QMessageBox::Yes) {
|
||||||
|
g.fwRev.set(current_firmware_variant.id, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (download == true) {
|
||||||
|
QString url = GetFirmwareVariant(current_firmware_variant.id).getFirmwareUrl();
|
||||||
|
QString ext = url.mid(url.lastIndexOf("."));
|
||||||
|
needRename=false;
|
||||||
|
QString fileName;
|
||||||
|
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + current_firmware_variant.id + ext);
|
||||||
|
if (!fileName.isEmpty()) {
|
||||||
|
if (!cpuid.isEmpty()) {
|
||||||
|
url.append("&cpuid=");
|
||||||
|
url.append(cpuid);
|
||||||
|
}
|
||||||
|
g.profile[g.id()].fwName(fileName);
|
||||||
|
g.flashDir(QFileInfo(fileName).dir().absolutePath());
|
||||||
|
downloadDialog * dd = new downloadDialog(this, url, fileName);
|
||||||
|
connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted()));
|
||||||
|
dd->exec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// TODO remove serverFails config?
|
||||||
|
return onUpdatesError();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
@ -604,7 +548,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setLanguage(QString langString)
|
void MainWindow::setLanguage(QString langString)
|
||||||
{
|
{
|
||||||
g.locale( langString );
|
g.locale( langString );
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@ class QMdiSubWindow;
|
||||||
class QSignalMapper;
|
class QSignalMapper;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#define CHECK_COMPANION 1
|
||||||
|
#define CHECK_FIRMWARE 2
|
||||||
|
#define SHOW_DIALOG_WAIT 4
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
friend class FirmwarePreferencesDialog;
|
friend class FirmwarePreferencesDialog;
|
||||||
|
@ -111,14 +115,17 @@ class MainWindow : public QMainWindow
|
||||||
void setBigIconThemeSize() {setIconThemeSize(2);};
|
void setBigIconThemeSize() {setIconThemeSize(2);};
|
||||||
void setHugeIconThemeSize() {setIconThemeSize(3);};
|
void setHugeIconThemeSize() {setIconThemeSize(3);};
|
||||||
|
|
||||||
void checkForUpdates(bool ignoreSettings, QString & fwId);
|
void checkForUpdates();
|
||||||
void checkForUpdateFinished(QNetworkReply * reply);
|
void checkForFirmwareUpdate();
|
||||||
|
|
||||||
|
void checkForCompanionUpdateFinished(QNetworkReply * reply);
|
||||||
|
void checkForFirmwareUpdateFinished(QNetworkReply * reply);
|
||||||
|
|
||||||
void displayWarnings();
|
void displayWarnings();
|
||||||
void doAutoUpdates();
|
void doAutoUpdates();
|
||||||
void doUpdates();
|
void doUpdates();
|
||||||
void updateDownloaded();
|
void updateDownloaded();
|
||||||
void reply1Finished(QNetworkReply * reply);
|
void firmwareDownloadAccepted();
|
||||||
void reply1Accepted();
|
|
||||||
void newFile();
|
void newFile();
|
||||||
void openFile();
|
void openFile();
|
||||||
void save();
|
void save();
|
||||||
|
@ -158,6 +165,9 @@ class MainWindow : public QMainWindow
|
||||||
void autoClose();
|
void autoClose();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void closeUpdatesWaitDialog();
|
||||||
|
void onUpdatesError();
|
||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
QAction * addAct(const QString &, const QString &, const QString &, enum QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
|
QAction * addAct(const QString &, const QString &, const QString &, enum QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
|
||||||
QAction * addAct(const QString &, const QString &, const QString &, const QKeySequence &, const char *, QObject *slotObj=NULL);
|
QAction * addAct(const QString &, const QString &, const QString &, const QKeySequence &, const char *, QObject *slotObj=NULL);
|
||||||
|
@ -198,19 +208,11 @@ class MainWindow : public QMainWindow
|
||||||
QSignalMapper *windowMapper;
|
QSignalMapper *windowMapper;
|
||||||
|
|
||||||
QString installer_fileName;
|
QString installer_fileName;
|
||||||
QString downloadedFW;
|
|
||||||
downloadDialog * downloadDialog_forWait;
|
downloadDialog * downloadDialog_forWait;
|
||||||
|
|
||||||
bool needRename;
|
bool needRename;
|
||||||
bool showcheckForUpdatesResult;
|
unsigned int checkForUpdatesState;
|
||||||
long currentFWrev;
|
|
||||||
long currentFWrev_temp;
|
|
||||||
long NewFwRev;
|
|
||||||
bool check1done;
|
|
||||||
bool check2done;
|
|
||||||
|
|
||||||
QNetworkAccessManager *manager1;
|
QNetworkAccessManager *networkManager;
|
||||||
QNetworkAccessManager *manager2;
|
|
||||||
|
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu;
|
||||||
QMenu *editMenu;
|
QMenu *editMenu;
|
||||||
|
@ -279,7 +281,6 @@ class MainWindow : public QMainWindow
|
||||||
QAction *russianLangAct;
|
QAction *russianLangAct;
|
||||||
QAction *dutchLangAct;
|
QAction *dutchLangAct;
|
||||||
QAction *openDocURLAct;
|
QAction *openDocURLAct;
|
||||||
QString fwToUpdate;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue