mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
OpenTX 2.0 downloads from Companion should be working now
This commit is contained in:
parent
a178d6b326
commit
73faca60d7
11 changed files with 118 additions and 138 deletions
|
@ -199,16 +199,35 @@ void CompStoreObj::getset( int &number, const QString tag, const int def, const
|
|||
}
|
||||
|
||||
// ** FwRevision class********************
|
||||
int FwRevision::get( const QString fwType )
|
||||
long FwRevision::get( const QString fwType )
|
||||
{
|
||||
QString result;
|
||||
retrieve( result, fwType, "", "FwRevisions" );
|
||||
return result.toInt();
|
||||
return result.toLong();
|
||||
}
|
||||
|
||||
void FwRevision::set( const QString fwType, const int fwRevision )
|
||||
QString FwRevision::getString( const QString fwType )
|
||||
{
|
||||
QString tempString= QString("%1").arg(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);
|
||||
store( tempString, tempString, fwType, "FwRevisions" );
|
||||
}
|
||||
|
||||
|
@ -480,7 +499,6 @@ QString AppData::armMcu() { return _armMcu; }
|
|||
QString AppData::avrArguments() { return _avrArguments; }
|
||||
QString AppData::avrPort() { return _avrPort; }
|
||||
QString AppData::avrdudeLocation() { return _avrdudeLocation; }
|
||||
QString AppData::compileServer() { return _compileServer; }
|
||||
QString AppData::cpuId() { return _cpuId; }
|
||||
QString AppData::dfuArguments() { return _dfuArguments; }
|
||||
QString AppData::dfuLocation() { return _dfuLocation; }
|
||||
|
@ -532,7 +550,6 @@ void AppData::armMcu (const QString x) { store(x, _armMcu,
|
|||
void AppData::avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );}
|
||||
void AppData::avrPort (const QString x) { store(x, _avrPort, "avr_port" );}
|
||||
void AppData::avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );}
|
||||
void AppData::compileServer (const QString x) { store(x, _compileServer, "compilation-server" );}
|
||||
void AppData::cpuId (const QString x) { store(x, _cpuId, "cpu_id" );}
|
||||
void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );}
|
||||
void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );}
|
||||
|
@ -651,7 +668,6 @@ AppData::AppData()
|
|||
getset( _avrArguments, "avr_arguments" ,"" );
|
||||
getset( _avrPort, "avr_port" ,"" );
|
||||
getset( _avrdudeLocation, "avrdudeLocation" ,"" );
|
||||
getset( _compileServer, "compilation-server" ,"" );
|
||||
getset( _cpuId, "cpu_id" ,"" );
|
||||
getset( _dfuArguments, "dfu_arguments" ,"-a 0" );
|
||||
getset( _dfuLocation, "dfu_location" ,"" );
|
||||
|
|
|
@ -58,8 +58,9 @@ class CompStoreObj
|
|||
class FwRevision: protected CompStoreObj
|
||||
{
|
||||
public:
|
||||
int get( const QString);
|
||||
void set( const QString, const int );
|
||||
long get( const QString);
|
||||
QString getString( const QString);
|
||||
void set( const QString, const long );
|
||||
void remove( const QString );
|
||||
};
|
||||
|
||||
|
@ -206,7 +207,6 @@ class AppData: protected CompStoreObj
|
|||
QString _avrArguments;
|
||||
QString _avrPort;
|
||||
QString _avrdudeLocation;
|
||||
QString _compileServer;
|
||||
QString _cpuId;
|
||||
QString _dfuArguments;
|
||||
QString _dfuLocation;
|
||||
|
@ -259,7 +259,6 @@ class AppData: protected CompStoreObj
|
|||
QString avrArguments();
|
||||
QString avrPort();
|
||||
QString avrdudeLocation();
|
||||
QString compileServer();
|
||||
QString cpuId();
|
||||
QString dfuArguments();
|
||||
QString dfuLocation();
|
||||
|
@ -312,7 +311,6 @@ class AppData: protected CompStoreObj
|
|||
void avrArguments (const QString);
|
||||
void avrPort (const QString);
|
||||
void avrdudeLocation (const QString);
|
||||
void compileServer (const QString);
|
||||
void cpuId (const QString);
|
||||
void dfuArguments (const QString);
|
||||
void dfuLocation (const QString);
|
||||
|
|
|
@ -192,7 +192,7 @@ void burnDialog::checkFw(QString fileName)
|
|||
if (flash.isValid()) {
|
||||
ui->FramFWInfo->show();
|
||||
ui->DateField->setText(flash.getDate() + " " + flash.getTime());
|
||||
ui->versionField->setText(flash.getVersion().isEmpty() ? flash.getSvn() : flash.getVersion());
|
||||
ui->versionField->setText(flash.getVersion());
|
||||
ui->ModField->setText(flash.getEEprom());
|
||||
|
||||
ui->SplashFrame->hide();
|
||||
|
|
|
@ -5,43 +5,41 @@
|
|||
#include <QTime>
|
||||
#include "helpers.h"
|
||||
|
||||
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::downloadDialog)
|
||||
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt):
|
||||
QDialog(parent),
|
||||
ui(new Ui::downloadDialog),
|
||||
file(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
ui->progressBar->setValue(1);
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(0);
|
||||
|
||||
if(tgt.isEmpty())
|
||||
{
|
||||
setWindowTitle(src);
|
||||
return; // just show wait dialog.
|
||||
if (tgt.isEmpty()) {
|
||||
setWindowTitle(src);
|
||||
return; // just show wait dialog.
|
||||
}
|
||||
|
||||
file = new QFile(tgt);
|
||||
if (!file->open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::critical(this, "Companion",
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(tgt).arg(file->errorString()));
|
||||
QTimer::singleShot(0, this, SLOT(fileError()));
|
||||
} else {
|
||||
|
||||
reply = qnam.get(QNetworkRequest(QUrl(src)));
|
||||
connect(reply, SIGNAL(finished()),
|
||||
this, SLOT(httpFinished()));
|
||||
connect(reply, SIGNAL(readyRead()),
|
||||
this, SLOT(httpReadyRead()));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
|
||||
this, SLOT(updateDataReadProgress(qint64,qint64)));
|
||||
|
||||
QMessageBox::critical(this, "Companion",
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(tgt).arg(file->errorString()));
|
||||
QTimer::singleShot(0, this, SLOT(fileError()));
|
||||
}
|
||||
else {
|
||||
reply = qnam.get(QNetworkRequest(QUrl(src)));
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(httpFinished()));
|
||||
connect(reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataReadProgress(qint64,qint64)));
|
||||
}
|
||||
}
|
||||
|
||||
downloadDialog::~downloadDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
delete file;
|
||||
}
|
||||
|
||||
void downloadDialog::httpFinished()
|
||||
|
@ -50,8 +48,7 @@ void downloadDialog::httpFinished()
|
|||
file->close();
|
||||
|
||||
bool ok = true;
|
||||
if (reply->error())
|
||||
{
|
||||
if (reply->error()) {
|
||||
file->remove();
|
||||
QMessageBox::information(this, tr("Companion"),
|
||||
tr("Download failed: %1.")
|
||||
|
@ -62,31 +59,32 @@ void downloadDialog::httpFinished()
|
|||
reply->deleteLater();
|
||||
reply = 0;
|
||||
delete file;
|
||||
file = 0;
|
||||
file = NULL;
|
||||
|
||||
if(ok)
|
||||
accept();
|
||||
if (ok)
|
||||
accept();
|
||||
else
|
||||
reject();
|
||||
reject();
|
||||
}
|
||||
|
||||
void downloadDialog::httpReadyRead()
|
||||
{
|
||||
if (file)
|
||||
file->write(reply->readAll());
|
||||
if (file) {
|
||||
file->write(reply->readAll());
|
||||
}
|
||||
}
|
||||
|
||||
void downloadDialog::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||
{
|
||||
ui->progressBar->setMaximum(totalBytes);
|
||||
ui->progressBar->setValue(bytesRead);
|
||||
ui->progressBar->setMaximum(totalBytes);
|
||||
ui->progressBar->setValue(bytesRead);
|
||||
}
|
||||
|
||||
void downloadDialog::fileError()
|
||||
{
|
||||
delete file;
|
||||
file = 0;
|
||||
reject();
|
||||
delete file;
|
||||
file = NULL;
|
||||
reject();
|
||||
}
|
||||
|
||||
void downloadDialog::closeEvent( QCloseEvent * event)
|
||||
|
|
|
@ -911,12 +911,8 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
|
|||
|
||||
QString OpenTxFirmware::getFirmwareUrl(QString & id)
|
||||
{
|
||||
QString url = g.compileServer();
|
||||
if (url.isEmpty()){
|
||||
url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
g.compileServer(url);
|
||||
}
|
||||
switch(board) {
|
||||
QString url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
case BOARD_M128:
|
||||
case BOARD_GRUVIN9X:
|
||||
|
@ -936,22 +932,14 @@ QString OpenTxFirmware::getFirmwareUrl(QString & id)
|
|||
|
||||
QString OpenTxFirmware::getReleaseNotesUrl()
|
||||
{
|
||||
QString url = g.compileServer();
|
||||
if (url.isEmpty()){
|
||||
url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
g.compileServer(url);
|
||||
}
|
||||
QString url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
url.append("/releasenotes.txt");
|
||||
return url;
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getStampUrl()
|
||||
{
|
||||
QString url = g.compileServer();
|
||||
if (url.isEmpty()){
|
||||
url= OPENTX_FIRMWARE_DOWNLOADS;
|
||||
g.compileServer(url);
|
||||
}
|
||||
QString url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
url.append("/stamp-opentx.txt");
|
||||
return url;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads.open-tx.org/companion"
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://next.open-tx.org/firmware"
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-20.open-tx.org/companion"
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-20.open-tx.org/firmware"
|
||||
|
||||
class EFile;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "flashinterface.h"
|
||||
|
||||
#define VERS_MARK "VERS"
|
||||
#define SVN_MARK "SVN"
|
||||
#define DATE_MARK "DATE"
|
||||
#define TIME_MARK "TIME"
|
||||
#define BLD_MARK "BLD"
|
||||
|
@ -66,7 +65,6 @@ FlashInterface::FlashInterface(QString fileName):
|
|||
}
|
||||
|
||||
if (flash_size > 0) {
|
||||
svn = seekLabel(SVN_MARK);
|
||||
version = seekLabel(VERS_MARK);
|
||||
date = seekLabel(DATE_MARK);
|
||||
time = seekLabel(TIME_MARK);
|
||||
|
@ -123,7 +121,6 @@ bool FlashInterface::SeekSplash(QByteArray splash)
|
|||
|
||||
bool FlashInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
|
||||
{
|
||||
qDebug() << "Seek";
|
||||
int start = 0;
|
||||
while (start>=0) {
|
||||
start = flash.indexOf(sps, start+1);
|
||||
|
|
|
@ -46,7 +46,7 @@ class FlashInterface
|
|||
FlashInterface(QString filename);
|
||||
inline QString getDate() { return date; }
|
||||
inline QString getTime() { return time; }
|
||||
inline QString getSvn() { return svn; }
|
||||
inline QString getStamp() { return QString("%1%2").arg(version.replace(".", "")).arg(date.replace("-", "")); }
|
||||
int getSize() { return flash_size; }
|
||||
inline QString getVersion() { return version; }
|
||||
inline QString getEEprom() { return eeprom; }
|
||||
|
@ -70,7 +70,6 @@ class FlashInterface
|
|||
QString filename;
|
||||
QString date;
|
||||
QString time;
|
||||
QString svn;
|
||||
QString version;
|
||||
QString eeprom;
|
||||
QByteArray splash;
|
||||
|
|
|
@ -24,9 +24,10 @@ FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
|
|||
void FirmwarePreferencesDialog::initSettings()
|
||||
{
|
||||
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
|
||||
int revision = g.fwRev.get(g.profile[g.id()].fwType());
|
||||
if (revision > 0)
|
||||
ui->lastRevisionLbl->setText(QString("%1").arg(revision));
|
||||
QString revision = g.fwRev.getString(g.profile[g.id()].fwType());
|
||||
if (!revision.isEmpty()) {
|
||||
ui->lastRevisionLbl->setText(revision);
|
||||
}
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
||||
|
@ -46,7 +47,7 @@ void FirmwarePreferencesDialog::on_fw_dnld_clicked()
|
|||
|
||||
void FirmwarePreferencesDialog::on_voice_dnld_clicked()
|
||||
{
|
||||
QString url="http://voice.open-tx.org/";
|
||||
QString url = "http://voices-20.open-tx.org/";
|
||||
QString fwType = g.profile[g.id()].fwType();
|
||||
QStringList list = fwType.split("-");
|
||||
QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]);
|
||||
|
|
|
@ -165,20 +165,19 @@ MainWindow::MainWindow():
|
|||
|
||||
void MainWindow::displayWarnings()
|
||||
{
|
||||
int warnId=g.warningId();
|
||||
int warnId = g.warningId();
|
||||
if (warnId<WARNING_ID && warnId!=0) {
|
||||
int res=0;
|
||||
if (WARNING_LEVEL>0) {
|
||||
if (WARNING_LEVEL>0)
|
||||
QMessageBox::warning(this, "Companion", WARNING);
|
||||
res = QMessageBox::question(this, "Companion",tr("Display previous warning again at startup ?"),QMessageBox::Yes | QMessageBox::No);
|
||||
} else {
|
||||
else
|
||||
QMessageBox::about(this, "Companion", WARNING);
|
||||
res = QMessageBox::question(this, "Companion",tr("Display previous message again at startup ?"),QMessageBox::Yes | QMessageBox::No);
|
||||
}
|
||||
res = QMessageBox::question(this, "Companion", tr("Display previous warning again at startup ?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (res == QMessageBox::No) {
|
||||
g.warningId(WARNING_ID);
|
||||
}
|
||||
} else if (warnId==0) {
|
||||
}
|
||||
else if (warnId==0) {
|
||||
g.warningId(WARNING_ID);
|
||||
}
|
||||
}
|
||||
|
@ -304,13 +303,13 @@ void MainWindow::downloadLatestFW(FirmwareVariant & firmware)
|
|||
{
|
||||
QString url, ext, cpuid;
|
||||
url = firmware.getFirmwareUrl();
|
||||
cpuid=g.cpuId();
|
||||
cpuid = g.cpuId();
|
||||
ext = url.mid(url.lastIndexOf("."));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmware.id + ext);
|
||||
if (!fileName.isEmpty()) {
|
||||
downloadedFW = firmware.id;
|
||||
needRename=true;
|
||||
g.profile[g.id()].fwName( fileName );
|
||||
needRename = true;
|
||||
g.profile[g.id()].fwName(fileName);
|
||||
if (!cpuid.isEmpty()) {
|
||||
url.append("&cpuid=");
|
||||
url.append(cpuid);
|
||||
|
@ -329,10 +328,10 @@ void MainWindow::reply1Accepted()
|
|||
if (!(downloadedFW.isEmpty())) {
|
||||
QFile file(downloadedFW);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error opening file %1:\n%2.")
|
||||
.arg(downloadedFW)
|
||||
.arg(file.errorString()));
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error opening file %1:\n%2.")
|
||||
.arg(downloadedFW)
|
||||
.arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
file.reset();
|
||||
|
@ -363,15 +362,17 @@ void MainWindow::reply1Accepted()
|
|||
}
|
||||
file.close();
|
||||
currentFWrev = currentFWrev_temp;
|
||||
qDebug() << currentFWrev;
|
||||
g.fwRev.set(downloadedFW, currentFWrev);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QFile file(g.profile[g.id()].fwName());
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error opening file %1:\n%2.")
|
||||
.arg(g.profile[g.id()].fwName())
|
||||
.arg(file.errorString()));
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error opening file %1:\n%2.")
|
||||
.arg(g.profile[g.id()].fwName())
|
||||
.arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
file.reset();
|
||||
|
@ -381,19 +382,19 @@ void MainWindow::reply1Accepted()
|
|||
int errnum=hline.mid(6).toInt();
|
||||
switch(errnum) {
|
||||
case 1:
|
||||
errormsg=tr("Not enough memory for all the selected firmware options");
|
||||
errormsg = tr("Not enough memory for all the selected firmware options");
|
||||
break;
|
||||
case 2:
|
||||
errormsg=tr("Compilation server termporary failure, try later");
|
||||
errormsg = tr("Compilation server termporary failure, try later");
|
||||
break;
|
||||
case 3:
|
||||
errormsg=tr("Compilation server too busy, try later");
|
||||
errormsg = tr("Compilation server too busy, try later");
|
||||
break;
|
||||
case 4:
|
||||
errormsg=tr("Compilation server requires registration, please check OpenTX web site");
|
||||
errormsg = tr("Compilation server requires registration, please check OpenTX web site");
|
||||
break;
|
||||
default:
|
||||
errormsg=tr("Unknown server failure, try later");
|
||||
errormsg = tr("Unknown server failure, try later");
|
||||
break;
|
||||
}
|
||||
file.close();
|
||||
|
@ -402,10 +403,11 @@ void MainWindow::reply1Accepted()
|
|||
}
|
||||
file.close();
|
||||
FlashInterface flash(g.profile[g.id()].fwName());
|
||||
QString rev=flash.getSvn();
|
||||
int pos=rev.lastIndexOf("-r");
|
||||
if (pos>0) {
|
||||
currentFWrev=rev.mid(pos+2).toInt();
|
||||
long stamp = flash.getStamp().toLong();
|
||||
if (stamp > 0) {
|
||||
currentFWrev = stamp;
|
||||
#if 0
|
||||
// TODO what's that?
|
||||
if (g.profile[g.id()].renameFwFiles() && needRename) {
|
||||
QFileInfo fi(g.profile[g.id()].fwName());
|
||||
QString path=fi.path()+QDir::separator ();
|
||||
|
@ -418,6 +420,7 @@ void MainWindow::reply1Accepted()
|
|||
qd.rename(g.profile[g.id()].fwName(),path);
|
||||
g.profile[g.id()].fwName(path);
|
||||
}
|
||||
#endif
|
||||
g.fwRev.set(downloadedFW, currentFWrev);
|
||||
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);
|
||||
|
@ -442,15 +445,17 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
// TODO delete downloadDialog_forWait?
|
||||
}
|
||||
|
||||
cpuid=g.cpuId();
|
||||
cpuid = g.cpuId();
|
||||
QByteArray qba = reply->readAll();
|
||||
int i = qba.indexOf("SVN_VERS");
|
||||
int warning = qba.indexOf("WARNING");
|
||||
|
||||
if(i>0) {
|
||||
|
||||
if (i>0) {
|
||||
bool cres;
|
||||
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();
|
||||
|
||||
|
@ -461,7 +466,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
}
|
||||
|
||||
if(rev>0) {
|
||||
NewFwRev=rev;
|
||||
NewFwRev = rev;
|
||||
OldFwRev = g.fwRev.get(fwToUpdate);
|
||||
QMessageBox msgBox;
|
||||
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
@ -536,7 +541,8 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
if (res==QMessageBox::Yes) {
|
||||
g.fwRev.set(fwToUpdate, NewFwRev);
|
||||
}
|
||||
} else if (download == true) {
|
||||
}
|
||||
else if (download == true) {
|
||||
if (warning>0) {
|
||||
QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
|
||||
if (!rn.isEmpty()) {
|
||||
|
@ -555,7 +561,8 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
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);
|
||||
}
|
||||
if (!fileName.isEmpty()) {
|
||||
|
@ -1269,35 +1276,11 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
if (!flash.isValid())
|
||||
return false;
|
||||
|
||||
QString fwSvn = flash.getSvn();
|
||||
if (fwSvn.isEmpty() || !fwSvn.contains("-r"))
|
||||
return false;
|
||||
QStringList svnTags = fwSvn.split("-r", QString::SkipEmptyParts);
|
||||
fwSvn = svnTags.back();
|
||||
if (fwSvn.endsWith('M'))
|
||||
fwSvn = fwSvn.mid(0, fwSvn.size()-1);
|
||||
int revision = fwSvn.toInt();
|
||||
if (!revision)
|
||||
return false;
|
||||
|
||||
unsigned int version = 0;
|
||||
unsigned int variant = 0;
|
||||
|
||||
if ((svnTags.at(0) == "open9x")||(svnTags.at(0) == "opentx")) {
|
||||
if (revision > 1464) {
|
||||
QString fwEEprom = flash.getEEprom();
|
||||
if (fwEEprom.contains("-")) {
|
||||
QStringList buildTags = fwEEprom.split("-", QString::SkipEmptyParts);
|
||||
if (buildTags.size() >= 1)
|
||||
version = buildTags.at(0).toInt();
|
||||
if (buildTags.size() >= 2)
|
||||
variant = buildTags.at(1).toInt();
|
||||
}
|
||||
else {
|
||||
version = fwEEprom.toInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
QString fwEEprom = flash.getEEprom();
|
||||
version = fwEEprom.toInt();
|
||||
|
||||
QFile file(backupFile);
|
||||
int eeprom_size = file.size();
|
||||
|
|
|
@ -203,9 +203,9 @@ class MainWindow : public QMainWindow
|
|||
|
||||
bool needRename;
|
||||
bool showcheckForUpdatesResult;
|
||||
int currentFWrev;
|
||||
int currentFWrev_temp;
|
||||
int NewFwRev;
|
||||
long currentFWrev;
|
||||
long currentFWrev_temp;
|
||||
long NewFwRev;
|
||||
bool check1done;
|
||||
bool check2done;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue