diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index 21145f978..ec634da4d 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -188,17 +188,17 @@ void CompStoreObj::getset( int &number, const QString tag, const int def, const } // ** FwRevision class******************** -int FwRevision::get( const QString fwName ) +int FwRevision::get( const QString fwType ) { QString result; - retrieve( result, fwName, "", "FwRevisions" ); + retrieve( result, fwType, "", "FwRevisions" ); return result.toInt(); } -void FwRevision::set( const QString fwName, const int fwRevision ) +void FwRevision::set( const QString fwType, const int fwRevision ) { QString tempString= QString("%1").arg(fwRevision); - store( tempString, tempString, fwName, "FwRevisions" ); + store( tempString, tempString, fwType, "FwRevisions" ); } void FwRevision::remove( const QString tag ) @@ -280,13 +280,13 @@ void JStickData::flush() // ** Profile class******************** // Get declarations -QString Profile::firmware() const { return _firmware; } +QString Profile::fwName() const { return _fwName; } +QString Profile::fwType() const { return _fwType; } QString Profile::name() const { return _name; } QString Profile::sdPath() const { return _sdPath; } QString Profile::splashFile() const { return _splashFile; } bool Profile::burnFirmware() const { return _burnFirmware; } bool Profile::renameFwFiles() const { return _renameFwFiles; } -bool Profile::patchImage() const { return _patchImage; } int Profile::channelOrder() const { return _channelOrder; } int Profile::defaultMode() const { return _defaultMode; } @@ -305,12 +305,12 @@ int Profile::vBatWarn() const { return _vBatWarn; } // Set declarations void Profile::name (const QString x) { store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));} -void Profile::firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));} +void Profile::fwName (const QString x) { store(x, _fwName, "fwName" ,"Profiles", QString("profile%1").arg(index));} +void Profile::fwType (const QString x) { store(x, _fwType, "fwType" ,"Profiles", QString("profile%1").arg(index));} void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));} void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));} void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));} -void Profile::patchImage (const bool x) { store(x, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));} void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));} void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));} @@ -337,12 +337,12 @@ Profile::Profile() Profile& Profile::operator=(const Profile& rhs) { name ( rhs.name() ); - firmware ( rhs.firmware() ); + fwName ( rhs.fwName() ); + fwType ( rhs.fwType() ); sdPath ( rhs.sdPath() ); splashFile ( rhs.splashFile() ); burnFirmware ( rhs.burnFirmware() ); renameFwFiles( rhs.renameFwFiles() ); - patchImage ( rhs.patchImage() ); channelOrder ( rhs.channelOrder() ); defaultMode ( rhs.defaultMode() ); beeper ( rhs.beeper() ); @@ -389,13 +389,13 @@ void Profile::init(int newIndex) { index = newIndex; - _firmware = ""; + _fwName = ""; + _fwType = ""; _name = ""; _sdPath = ""; _splashFile = ""; _burnFirmware = false; _renameFwFiles = false; - _patchImage = false; _channelOrder = 0; _defaultMode = 1; @@ -423,13 +423,13 @@ void Profile::init(int newIndex) void Profile::flush() { // Load and store all variables. Use default values if setting values are missing - getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _fwName, "fwName" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _fwType, "fwType" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index)); getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); @@ -464,7 +464,6 @@ QString AppData::compileServer() { return _compileServer; } QString AppData::cpuId() { return _cpuId; } QString AppData::dfuArguments() { return _dfuArguments; } QString AppData::dfuLocation() { return _dfuLocation; } -QString AppData::lastFw() { return _lastFw; } QString AppData::locale() { return _locale; } QString AppData::mcu() { return _mcu; } QString AppData::programmer() { return _programmer; } @@ -519,7 +518,6 @@ void AppData::compileServer (const QString x) { store(x, _compileServer, 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" );} -void AppData::lastFw (const QString x) { store(x, _lastFw, "lastFw" );} void AppData::locale (const QString x) { store(x, _locale, "locale" );} void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );} void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );} @@ -586,11 +584,11 @@ AppData::AppData() // Store old values in new locations autoCheckApp(settings.value("startup_check_companion9x", true).toBool()); - // Convert and store the firmware name - QString firmware = settings.value("firmware", "").toString(); - firmware.replace("open9x","opentx"); - firmware.replace("x9da","taranis"); - profile[0].firmware( firmware ); + // Convert and store the firmware type + QString fwType = settings.value("firmware", "").toString(); + fwType.replace("open9x","opentx"); + fwType.replace("x9da","taranis"); + profile[0].fwType( fwType ); // Move the Companion9x profile settings to profile0, the new default profile profile[0].name( settings.value( "Name", "" ).toString()); @@ -598,7 +596,6 @@ AppData::AppData() profile[0].splashFile( settings.value( "SplashFileName", "" ).toString()); profile[0].burnFirmware( settings.value( "burnFirmware", false ).toBool()); profile[0].renameFwFiles( settings.value( "rename_firmware_files", false ).toBool()); - profile[0].patchImage( settings.value( "patchImage", false ).toBool()); profile[0].channelOrder( settings.value( "default_channel_order", "0" ).toInt()); profile[0].defaultMode( settings.value( "default_mode", "1" ).toInt()); @@ -613,6 +610,7 @@ AppData::AppData() settings.remove("default_channel_order"); settings.remove("default_mode"); settings.remove("firmware"); + settings.remove("lastFw"); settings.remove("Name"); settings.remove("patchImage"); settings.remove("rename_firmware_files"); @@ -638,7 +636,6 @@ AppData::AppData() getset( _cpuId, "cpu_id" ,"" ); getset( _dfuArguments, "dfu_arguments" ,"-a 0" ); getset( _dfuLocation, "dfu_location" ,"" ); - getset( _lastFw, "lastFw" ,"" ); getset( _locale, "locale" ,"" ); getset( _mcu, "mcu" ,"m64" ); getset( _programmer, "programmer" ,"usbasp" ); diff --git a/companion/src/appdata.h b/companion/src/appdata.h index fd037dd3b..479229221 100644 --- a/companion/src/appdata.h +++ b/companion/src/appdata.h @@ -92,13 +92,13 @@ class Profile: protected CompStoreObj int index; // Application Variables - QString _firmware; + QString _fwName; + QString _fwType; QString _name; QString _sdPath; QString _splashFile; bool _burnFirmware; bool _renameFwFiles; - bool _patchImage; int _channelOrder; int _defaultMode; @@ -118,13 +118,13 @@ class Profile: protected CompStoreObj public: // All the get definitions - QString firmware() const; + QString fwName() const; + QString fwType() const; QString name() const; QString sdPath() const; QString splashFile() const; bool burnFirmware() const; bool renameFwFiles() const; - bool patchImage() const; //TODO This variable is unused and should be removed int channelOrder() const; int defaultMode() const; @@ -143,12 +143,12 @@ class Profile: protected CompStoreObj // All the set definitions void name (const QString); - void firmware (const QString); + void fwName (const QString); + void fwType (const QString); void sdPath (const QString); void splashFile (const QString); void burnFirmware (const bool); void renameFwFiles (const bool); - void patchImage (const bool); void channelOrder (const int); void defaultMode (const int); @@ -195,7 +195,6 @@ class AppData: protected CompStoreObj QString _cpuId; QString _dfuArguments; QString _dfuLocation; - QString _lastFw; QString _locale; QString _mcu; QString _programmer; @@ -251,7 +250,7 @@ class AppData: protected CompStoreObj QString cpuId(); QString dfuArguments(); QString dfuLocation(); - QString lastFw(); + QString lastFw(); QString locale(); QString mcu(); QString programmer(); diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 5215fda5e..c416ff3db 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -63,7 +63,8 @@ void appPreferencesDialog::writeValues() g.profile[g.id()].name(ui->profileNameLE->text()); g.profile[g.id()].sdPath(ui->sdPath->text()); g.profile[g.id()].splashFile(ui->SplashFileName->text()); - g.profile[g.id()].firmware(ui->firmwareLE->text()); + g.profile[g.id()].fwName(ui->fwNameLE->text()); + g.profile[g.id()].fwType(ui->fwTypeLE->text()); saveProfile(); } @@ -145,7 +146,8 @@ void appPreferencesDialog::initSettings() ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles()); ui->sdPath->setText(g.profile[g.id()].sdPath()); ui->profileNameLE->setText(g.profile[g.id()].name()); - ui->firmwareLE->setText(g.profile[g.id()].firmware()); + ui->fwNameLE->setText(g.profile[g.id()].fwName()); + ui->fwTypeLE->setText(g.profile[g.id()].fwType()); ui->SplashFileName->setText(g.profile[g.id()].splashFile()); displayImage( g.profile[g.id()].splashFile() ); @@ -248,7 +250,8 @@ void appPreferencesDialog::saveProfile() g.profile[g.id()].renameFwFiles( ui->renameFirmware->isChecked()); g.profile[g.id()].sdPath( ui->sdPath->text()); g.profile[g.id()].splashFile( ui->SplashFileName->text()); - g.profile[g.id()].firmware( ui->firmwareLE->text()); + g.profile[g.id()].fwName( ui->fwNameLE->text()); + g.profile[g.id()].fwType( ui->fwTypeLE->text()); } void appPreferencesDialog::on_removeProfileButton_clicked() @@ -274,7 +277,7 @@ bool appPreferencesDialog::displayImage( QString fileName ) // Use the firmware name to determine splash width int width = SPLASH_WIDTH; - if (g.profile[g.id()].firmware().contains("taranis")) + if (g.profile[g.id()].fwType().contains("taranis")) width = SPLASHX9D_WIDTH; ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(width, SPLASH_HEIGHT))); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index 98824f3b5..f6ace593c 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -502,7 +502,7 @@ Radio Settings Profile - + @@ -556,7 +556,7 @@ Mode 4: - + @@ -706,7 +706,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -726,7 +726,7 @@ This is used by the templated to determine which channel goes to what number out - + Qt::Vertical @@ -739,7 +739,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -752,7 +752,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -768,14 +768,14 @@ This is used by the templated to determine which channel goes to what number out - + Append version number to FW file name - + @@ -791,7 +791,7 @@ This is used by the templated to determine which channel goes to what number out - + true @@ -813,7 +813,7 @@ This is used by the templated to determine which channel goes to what number out - + Qt::Horizontal @@ -826,35 +826,35 @@ This is used by the templated to determine which channel goes to what number out - + Offer to write FW to Tx after download - + Remove Profile - + Open Folder - + Qt::Horizontal - + true @@ -879,12 +879,12 @@ This is used by the templated to determine which channel goes to what number out - Firmware + Firmware Variant - + false @@ -902,14 +902,14 @@ This is used by the templated to determine which channel goes to what number out - + Select Image - + Clear Image @@ -932,7 +932,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -966,13 +966,39 @@ This is used by the templated to determine which channel goes to what number out - + Qt::Horizontal + + + + Firmware File + + + + + + + false + + + + 350 + 0 + + + + + 350 + 16777215 + + + + diff --git a/companion/src/burndialog.cpp b/companion/src/burndialog.cpp index 81c0ef3df..dfc9d62b4 100644 --- a/companion/src/burndialog.cpp +++ b/companion/src/burndialog.cpp @@ -109,8 +109,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac hexfileName->clear(); } else if (Type==FLASH_FILE_TYPE) { - QString FileName; - FileName = g.lastFw(); + QString FileName = g.profile[g.id()].fwName(); QFile file(FileName); if (file.exists()) { checkFw(FileName); @@ -353,31 +352,32 @@ void burnDialog::on_useFwImageCB_clicked() FlashInterface flash(fileName); if (!flash.isValid()) { QMessageBox::critical(this, tr("Error"), tr( "The firmware file is not valid." )); - return; } - if (!flash.hasSplash()) { - QMessageBox::critical(this, tr("Error"), tr( "There is no start screen image in the firmware file." )); - return; + else { + if (!flash.hasSplash()) { + QMessageBox::critical(this, tr("Error"), tr( "There is no start screen image in the firmware file." )); + } + else{ + imageSource = FIRMWARE; + imageFile = fileName; + } } - imageSource = FIRMWARE; - imageFile = fileName; updateUI(); } void burnDialog::on_useProfileImageCB_clicked() { QString fileName = g.profile[g.id()].splashFile(); - if (fileName.isEmpty()){ - QMessageBox::critical(this, tr("Error"), tr( "The radio profile has no defined start screen." )); - return; + if (!fileName.isEmpty()){ + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not contain an image.").arg(fileName)); + } + else { + imageSource = PROFILE; + imageFile = fileName; + } } - QImage image(fileName); - if (image.isNull()) { - QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not seem to contain an image.").arg(fileName)); - return; - } - imageSource = PROFILE; - imageFile = fileName; updateUI(); } @@ -388,17 +388,17 @@ void burnDialog::on_useAnotherImageCB_clicked() supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; } QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats)); - if (fileName.isEmpty()){ - return; + if (!fileName.isEmpty()){ + g.imagesDir( QFileInfo(fileName).dir().absolutePath() ); + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName)); + } + else{ + imageSource = ANOTHER; + imageFile = fileName; + } } - g.imagesDir( QFileInfo(fileName).dir().absolutePath() ); - QImage image(fileName); - if (image.isNull()) { - QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName)); - return; - } - imageSource = ANOTHER; - imageFile = fileName; updateUI(); } @@ -407,16 +407,16 @@ void burnDialog::on_useLibraryImageCB_clicked() QString fileName; splashLibrary *ld = new splashLibrary(this,&fileName); ld->exec(); - if (fileName.isEmpty()) { - return; + if (!fileName.isEmpty()) { + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded")); + } + else{ + imageSource = LIBRARY; + imageFile = fileName; + } } - QImage image(fileName); - if (image.isNull()) { - QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded")); - return; - } - imageSource = LIBRARY; - imageFile = fileName; updateUI(); } @@ -426,7 +426,6 @@ void burnDialog::on_BurnFlashButton_clicked() QString fileName=ui->FWFileName->text(); if (!fileName.isEmpty()) { g.flashDir( QFileInfo(fileName).dir().absolutePath() ); - g.lastFw( fileName ); if (!ui->useFwImageCB->isChecked()) { QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height()); if (!image.isNull()) { diff --git a/companion/src/companion.cpp b/companion/src/companion.cpp index 96a6d5597..37a988273 100644 --- a/companion/src/companion.cpp +++ b/companion/src/companion.cpp @@ -95,15 +95,18 @@ int main(int argc, char *argv[]) QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); - if (g.profile[g.id()].firmware().isEmpty()) - g.profile[g.id()].firmware(default_firmware_variant.id); + if (g.profile[g.id()].fwType().isEmpty()){ + g.profile[g.id()].fwType(default_firmware_variant.id); + g.profile[g.id()].fwName(""); + } + - QPixmap pixmap = QPixmap(g.profile[g.id()].firmware().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png"); + QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png"); QSplashScreen *splash = new QSplashScreen(pixmap); RegisterFirmwares(); - current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware()); + current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); MainWindow *mainWin = new MainWindow(); if (g.showSplash()) { diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp index 1be93d4a5..09c55aec3 100644 --- a/companion/src/customizesplashdialog.cpp +++ b/companion/src/customizesplashdialog.cpp @@ -56,7 +56,7 @@ bool Side::displayImage( QString fileName, Source pictSource ) if (pictSource== PICT) *format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X; else if (pictSource == PROFILE) - *format = (g.profile[g.id()].firmware().contains("taranis")) ? LCDTARANIS : LCD9X; + *format = (g.profile[g.id()].fwType().contains("taranis")) ? LCDTARANIS : LCD9X; } if (image.isNull()) { return false; diff --git a/companion/src/fwpreferencesdialog.cpp b/companion/src/fwpreferencesdialog.cpp index 17c7c6caf..ec2585ddc 100644 --- a/companion/src/fwpreferencesdialog.cpp +++ b/companion/src/fwpreferencesdialog.cpp @@ -213,7 +213,7 @@ void fwPreferencesDialog::writeValues() { g.cpuId( ui->CPU_ID_LE->text() ); current_firmware_variant = getFirmwareVariant(); - g.profile[g.id()].firmware( current_firmware_variant.id ); + g.profile[g.id()].fwType( current_firmware_variant.id ); } void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware) @@ -290,7 +290,7 @@ void fwPreferencesDialog::on_checkFWUpdates_clicked() FirmwareVariant variant = getFirmwareVariant(); if (g.profile[g.id()].burnFirmware()) { current_firmware_variant = variant; - g.profile[g.id()].firmware( variant.id ); + g.profile[g.id()].fwType( variant.id ); } MainWindow * mw = (MainWindow *)this->parent(); mw->checkForUpdates(true, variant.id); @@ -305,7 +305,7 @@ void fwPreferencesDialog::on_fw_dnld_clicked() if (!variant.firmware->getUrl(variant.id).isNull()) { if (g.profile[g.id()].burnFirmware()) { current_firmware_variant = getFirmwareVariant(); - g.profile[g.id()].firmware( current_firmware_variant.id ); + g.profile[g.id()].fwType( current_firmware_variant.id ); } mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id); } diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp index 6e96e0368..6c5b6dfc9 100644 --- a/companion/src/generaledit.cpp +++ b/companion/src/generaledit.cpp @@ -20,7 +20,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : ui->setupUi(this); this->setWindowIcon(CompanionIcon("open.png")); - QString firmware_id = g.profile[g.id()].firmware(); + QString firmware_id = g.profile[g.id()].fwType(); ui->tabWidget->setCurrentIndex( g.generalEditTab() ); QString name=g.profile[g.id()].name(); if (name.isEmpty()) { diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index e4bb27f80..596f6b78c 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -308,7 +308,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw if (!fileName.isEmpty()) { downloadedFW = firmwareId; needRename=true; - downloadedFWFilename = fileName; + g.profile[g.id()].fwName( fileName ); if (!cpuid.isEmpty()) { url.append("&cpuid="); url.append(cpuid); @@ -323,7 +323,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw void MainWindow::reply1Accepted() { QString errormsg; - if (downloadedFWFilename.isEmpty()) { + if (g.profile[g.id()].fwName().isEmpty()) { if (!(downloadedFW.isEmpty())) { QFile file(downloadedFW); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file @@ -364,11 +364,11 @@ void MainWindow::reply1Accepted() g.fwRev.set(downloadedFW, currentFWrev); } } else { - QFile file(downloadedFWFilename); + 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(downloadedFWFilename) + .arg(g.profile[g.id()].fwName()) .arg(file.errorString())); return; } @@ -399,13 +399,13 @@ void MainWindow::reply1Accepted() return; } file.close(); - FlashInterface flash(downloadedFWFilename); + 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(); if (g.profile[g.id()].renameFwFiles() && needRename) { - QFileInfo fi(downloadedFWFilename); + QFileInfo fi(g.profile[g.id()].fwName()); QString path=fi.path()+QDir::separator (); path.append(fi.completeBaseName()); path.append(rev.mid(pos)); @@ -413,14 +413,14 @@ void MainWindow::reply1Accepted() path.append(fi.suffix()); QDir qd; qd.remove(path); - qd.rename(downloadedFWFilename,path); - downloadedFWFilename=path; + qd.rename(g.profile[g.id()].fwName(),path); + g.profile[g.id()].fwName(path); } 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 transmitter now ?"), QMessageBox::Yes | QMessageBox::No); if (ret == QMessageBox::Yes) { - writeFlash(downloadedFWFilename); + writeFlash(g.profile[g.id()].fwName()); } } } @@ -560,7 +560,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply) url.append("&cpuid="); url.append(cpuid); } - downloadedFWFilename = fileName; + g.profile[g.id()].fwName( fileName ); g.flashDir(QFileInfo(fileName).dir().absolutePath()); downloadDialog * dd = new downloadDialog(this, url, fileName); currentFWrev_temp = NewFwRev; @@ -702,7 +702,7 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW! g.id( profnum ); // TODO Get rid of this global variable - The profile.firmware is the real source - current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware()); + current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); foreach (QMdiSubWindow *window, mdiArea->subWindowList()) { MdiChild *mdiChild = qobject_cast(window->widget()); diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h index f746b1eb8..8bfca1fa8 100644 --- a/companion/src/mainwindow.h +++ b/companion/src/mainwindow.h @@ -197,7 +197,6 @@ private: QString installer_fileName; QString downloadedFW; - QString downloadedFWFilename; downloadDialog * downloadDialog_forWait; bool needRename; diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 099ba56ab..e06fe96a3 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -457,7 +457,7 @@ TelemetryPanel::~TelemetryPanel() void TelemetryPanel::setup() { - QString firmware_id = g.profile[g.id()].firmware(); + QString firmware_id = g.profile[g.id()].fwType(); lock=true;