diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 0b4940f4a..5b35d3a40 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -90,7 +90,7 @@ void AppPreferencesDialog::accept() g.appDebugLog(ui->opt_appDebugLog->isChecked()); g.fwTraceLog(ui->opt_fwTraceLog->isChecked()); g.appLogsDir(ui->appLogsDir->text()); - g.runInstaller(ui->chkPromptInstall->isChecked()); + g.runAppInstaller(ui->chkPromptInstall->isChecked()); if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) { g.jsSupport(ui->joystickChkB ->isChecked()); @@ -106,12 +106,15 @@ void AppPreferencesDialog::accept() g.updateCheckFreq(AppData::UpdateCheckFreq(ui->cboUpdateCheckFreq->currentIndex())); g.downloadDir(ui->leDownloadDir->text()); - g.decompressUseDwnld(ui->chkDecompressUseDwnld->isChecked()); + g.decompressDirUseDwnld(ui->chkDecompressDirUseDwnld->isChecked()); g.decompressDir(ui->leDecompressDir->text()); - g.updateUseSD(ui->chkUpdateUseSD->isChecked()); + g.updateDirUseSD(ui->chkUpdateDirUseSD->isChecked()); g.updateDir(ui->leUpdateDir->text()); + g.updDelDownloads(ui->chkDelDownloads->isChecked()); + g.updLogLevel(ui->cboLogLevel->currentIndex()); + QMapIterator it(factories->sortedComponentsList()); while (it.hasNext()) { @@ -236,7 +239,7 @@ void AppPreferencesDialog::initSettings() ui->opt_fwTraceLog->setChecked(g.fwTraceLog()); ui->appLogsDir->setText(g.appLogsDir()); toggleAppLogSettings(); - ui->chkPromptInstall->setChecked(g.runInstaller()); + ui->chkPromptInstall->setChecked(g.runAppInstaller()); #if defined(JOYSTICKS) ui->joystickChkB->setChecked(g.jsSupport()); @@ -328,7 +331,7 @@ void AppPreferencesDialog::initSettings() } }); - connect(ui->chkDecompressUseDwnld, &QCheckBox::toggled, [=](const bool checked) { + connect(ui->chkDecompressDirUseDwnld, &QCheckBox::toggled, [=](const bool checked) { if (!checked) { ui->leDecompressDir->setText(g.decompressDir()); ui->leDecompressDir->setEnabled(true); @@ -341,7 +344,7 @@ void AppPreferencesDialog::initSettings() } }); - connect(ui->chkUpdateUseSD, &QCheckBox::toggled, [=](const bool checked) { + connect(ui->chkUpdateDirUseSD, &QCheckBox::toggled, [=](const bool checked) { if (!checked) { ui->leUpdateDir->setText(g.updateDir()); ui->leUpdateDir->setEnabled(true); @@ -414,6 +417,8 @@ void AppPreferencesDialog::initSettings() ui->grpComponents->setLayout(grid); + ui->cboLogLevel->addItems(AppData::updateLogLevelsList()); + loadUpdatesTab(); } @@ -422,11 +427,14 @@ void AppPreferencesDialog::loadUpdatesTab() ui->cboUpdateCheckFreq->setCurrentIndex(g.updateCheckFreq()); ui->leDownloadDir->setText(g.downloadDir()); // trigger toggled signal by changing design value and then setting to saved value - ui->chkDecompressUseDwnld->setChecked(!ui->chkDecompressUseDwnld->isChecked()); - ui->chkDecompressUseDwnld->setChecked(g.decompressUseDwnld()); + ui->chkDecompressDirUseDwnld->setChecked(!ui->chkDecompressDirUseDwnld->isChecked()); + ui->chkDecompressDirUseDwnld->setChecked(g.decompressDirUseDwnld()); // trigger toggled signal by changing design value and then setting to saved value - ui->chkUpdateUseSD->setChecked(!ui->chkUpdateUseSD->isChecked()); - ui->chkUpdateUseSD->setChecked(g.updateUseSD()); + ui->chkUpdateDirUseSD->setChecked(!ui->chkUpdateDirUseSD->isChecked()); + ui->chkUpdateDirUseSD->setChecked(g.updateDirUseSD()); + + ui->chkDelDownloads->setChecked(g.updDelDownloads()); + ui->cboLogLevel->setCurrentIndex(g.updLogLevel()); QMapIterator it(factories->sortedComponentsList()); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index 1455265fd..6580f1376 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -45,7 +45,7 @@ - 0 + 3 @@ -727,13 +727,6 @@ Mode 4: - - - - Update - - - @@ -1460,7 +1453,7 @@ Mode 4: - + Create sub-folders in Download folder @@ -1484,7 +1477,7 @@ Mode 4: - + Use Radio Profile SD Structure @@ -1537,6 +1530,45 @@ Mode 4: + + + + + + + + + + Delete downloads after update + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Logging + + + + + + + + + diff --git a/companion/src/storage/appdata.cpp b/companion/src/storage/appdata.cpp index 26a00eba5..56df7da65 100644 --- a/companion/src/storage/appdata.cpp +++ b/companion/src/storage/appdata.cpp @@ -656,8 +656,9 @@ void AppData::resetUpdatesSettings() g.updateCheckFreqReset(); g.downloadDirReset(); g.decompressDirReset(); - g.decompressUseDwnldReset(); + g.decompressDirUseDwnldReset(); g.updateDirReset(); - g.updateUseSDReset(); - g.updateLogLevelReset(); + g.updateDirUseSDReset(); + g.updDelDownloadsReset(); + g.updLogLevelReset(); } diff --git a/companion/src/storage/appdata.h b/companion/src/storage/appdata.h index 153b34062..c993e1907 100644 --- a/companion/src/storage/appdata.h +++ b/companion/src/storage/appdata.h @@ -501,6 +501,8 @@ class AppData: public CompStoreObj static QStringList newModelActionsList() { return { tr("None"), tr("Wizard"), tr("Editor"), tr("Template"), tr("Prompt") } ; } static QStringList updateCheckFreqsList() { return { tr("Manually"), tr("Startup"), tr("Daily"), tr("Weekly"), tr("Monthly") } ; } + // refer enum QtMsgType + static QStringList updateLogLevelsList() { return { tr("Debug"), tr("Warning"), tr("Critical"), tr("Fatal"), tr("Information") } ; } explicit AppData(); void init() override; @@ -598,10 +600,12 @@ class AppData: public CompStoreObj PROPERTYSTRD(templatesDir, CPN_DOCUMENTS_LOCATION % "/templates") PROPERTYSTRD(downloadDir, CPN_DOCUMENTS_LOCATION % "/downloads") PROPERTYSTRD(decompressDir, CPN_DOCUMENTS_LOCATION % "/decompress") - PROPERTY (bool, decompressUseDwnld, true) PROPERTYSTRD(updateDir, CPN_DOCUMENTS_LOCATION % "/updates") - PROPERTY (bool, updateUseSD, true) - PROPERTY (int, updateLogLevel, 4) + PROPERTY (bool, decompressDirUseDwnld, true) + PROPERTY (bool, updateDirUseSD, true) + PROPERTY (bool, runAppInstaller, false) + PROPERTY (int, updLogLevel, 4) + PROPERTY (bool, updDelDownloads, false) PROPERTYSTR (locale) PROPERTYSTR (gePath) @@ -637,7 +641,6 @@ class AppData: public CompStoreObj PROPERTY(bool, tabbedMdi, false) PROPERTY(bool, appDebugLog, false) PROPERTY(bool, fwTraceLog, false) - PROPERTY(bool, runInstaller, false) // Simulator global (non-profile) settings PROPERTY(QStringList, simuDbgFilters, QStringList()) diff --git a/companion/src/updates/updatecompanion.cpp b/companion/src/updates/updatecompanion.cpp index 71bf12f43..d6ab88f99 100644 --- a/companion/src/updates/updatecompanion.cpp +++ b/companion/src/updates/updatecompanion.cpp @@ -62,9 +62,9 @@ UpdateCompanion::UpdateCompanion(QWidget * parent) : bool UpdateCompanion::asyncInstall() { - reportProgress(tr("Run application installer: %1").arg(g.runInstaller() ? tr("true") : tr("false")), QtDebugMsg); + reportProgress(tr("Run application installer: %1").arg(g.runAppInstaller() ? tr("true") : tr("false")), QtDebugMsg); - if (!g.runInstaller()) + if (!g.runAppInstaller()) return true; progressMessage(tr("Async install")); diff --git a/companion/src/updates/updateinterface.cpp b/companion/src/updates/updateinterface.cpp index 0380ba98f..2b5f0be31 100644 --- a/companion/src/updates/updateinterface.cpp +++ b/companion/src/updates/updateinterface.cpp @@ -47,8 +47,8 @@ UpdateParameters::UpdateParameters(QWidget * parent) : QWidget(parent) { data.flags = 0; - data.decompressUseDwnld = true; - data.updateUseSD = true; + data.decompressDirUseDwnld = true; + data.updateDirUseSD = true; } UpdateParameters& UpdateParameters::operator=(const UpdateParameters& source) @@ -63,9 +63,9 @@ UpdateParameters& UpdateParameters::operator=(const UpdateParameters& source) data.currentRelease = source.data.currentRelease; data.updateRelease = source.data.updateRelease; data.downloadDir = source.data.downloadDir; - data.decompressUseDwnld = source.data.decompressUseDwnld; + data.decompressDirUseDwnld = source.data.decompressDirUseDwnld; data.decompressDir = source.data.decompressDir; - data.updateUseSD = source.data.updateUseSD; + data.updateDirUseSD = source.data.updateDirUseSD; data.updateDir = source.data.updateDir; while (!data.assets.isEmpty()) { @@ -144,7 +144,6 @@ UpdateInterface::UpdateInterface(QWidget * parent) : file(nullptr) { progress = nullptr; - logLevel = g.updateLogLevel(); settingsIdx = -1; QNetworkProxyFactory::setUseSystemConfiguration(true); @@ -257,12 +256,8 @@ QString UpdateInterface::updateFlagsToString(UpdateFlags val) return "Preparation"; case UPDFLG_Download: return "Download"; - case UPDFLG_DelDownload: - return "Delete Download"; case UPDFLG_Decompress: return "Decompress"; - case UPDFLG_DelDecompress: - return "Delete Decompress"; case UPDFLG_CopyDest: return "Copy to Destination"; case UPDFLG_CopyFiles: @@ -273,6 +268,8 @@ QString UpdateInterface::updateFlagsToString(UpdateFlags val) return "Housekeeping"; case UPDFLG_AsyncInstall: return "Async Install"; + case UPDFLG_DelDownloads: + return "Delete Downloads"; default: return CPN_STR_UNKNOWN_ITEM; } @@ -345,9 +342,9 @@ void UpdateInterface::initParamFolders(UpdateParameters * params) params->data.downloadDir = g.downloadDir().trimmed(); - params->data.decompressUseDwnld = g.decompressUseDwnld(); + params->data.decompressDirUseDwnld = g.decompressDirUseDwnld(); - if (params->data.decompressUseDwnld) + if (params->data.decompressDirUseDwnld) params->data.decompressDir = params->data.downloadDir; else { if (g.decompressDir().trimmed().isEmpty()) @@ -356,9 +353,9 @@ void UpdateInterface::initParamFolders(UpdateParameters * params) params->data.decompressDir = g.decompressDir().trimmed(); } - params->data.updateUseSD = g.updateUseSD(); + params->data.updateDirUseSD = g.updateDirUseSD(); - if (params->data.updateUseSD && (!g.currentProfile().sdPath().trimmed().isEmpty())) + if (params->data.updateDirUseSD && (!g.currentProfile().sdPath().trimmed().isEmpty())) params->data.updateDir = g.currentProfile().sdPath().trimmed(); else { if (g.updateDir().trimmed().isEmpty()) @@ -371,9 +368,16 @@ void UpdateInterface::initParamFolders(UpdateParameters * params) void UpdateInterface::resetRunEnvironment() { progress = nullptr; + logLevel = g.updLogLevel(); + qDebug() << tr("Log level: %1").arg(logLevel); *runParams = *dfltParams; runParams->data.flags &= ~UPDFLG_Update; + + if (g.updDelDownloads()) + runParams->data.flags |= UpdateInterface::UPDFLG_DelDownloads; + else + runParams->data.flags &= ~UpdateInterface::UPDFLG_DelDownloads; } int UpdateInterface::getSettingsIdx() @@ -542,17 +546,21 @@ bool UpdateInterface::setRunFolders() { QString fldr(releases->name()); fldr = fldr.replace("\"", ""); - fldr = fldr.replace("'", ""); + fldr = fldr.replace("\'", ""); fldr = fldr.replace(" ", "_"); + fldr = fldr.replace("(", "_"); + fldr = fldr.replace(")", "_"); + fldr = fldr.replace("[", "_"); + fldr = fldr.replace("]", "_"); - downloadDir = runParams->data.downloadDir % "/" % name % "/" % fldr; + downloadDir = QString("%1/%2/%3").arg(runParams->data.downloadDir).arg(name).arg(fldr); if (!checkCreateDirectory(downloadDir, UPDFLG_Download)) return false; reportProgress(tr("Download directory: %1").arg(downloadDir), QtDebugMsg); - decompressDir = runParams->data.decompressDir % "/" % name % "/" % fldr; + decompressDir = QString("%1/%2/%3").arg(runParams->data.decompressDir).arg(name).arg(fldr); if (!checkCreateDirectory(decompressDir, UPDFLG_Decompress)) return false; @@ -849,7 +857,7 @@ void UpdateInterface::downloadBinaryToFile(const QString & url, const QString & { downloadSuccess = false; - QFileInfo f(downloadDir % "/" % QString("A%1/%2").arg(assets->id()).arg(filename)); + QFileInfo f(QString("%1/A%2/%3").arg(downloadDir).arg(assets->id()).arg(filename)); progressMessage(tr("Downloading: %1").arg(filename)); reportProgress(tr("Download: %1").arg(filename), QtInfoMsg); @@ -907,14 +915,14 @@ bool UpdateInterface::decompressAsset(int row) if (filename.isEmpty()) return false; - QFileInfo f(downloadDir % "/" % QString("A%1/%2").arg(assets->id()).arg(assets->filename())); + QFileInfo f(QString("%1/A%2/%3").arg(downloadDir).arg(assets->id()).arg(assets->filename())); if (!f.exists()) return false; reportProgress(tr("Decompress: %1").arg(filename), QtInfoMsg); - decompressArchive(f.absoluteFilePath(), decompressDir % "/" % QString("A%1").arg(assets->id())); + decompressArchive(f.absoluteFilePath(), QString("%1/A%2").arg(decompressDir).arg(assets->id())); return true; } @@ -971,7 +979,7 @@ bool UpdateInterface::copyStructure() progress->setMaximum(100); } - QDir srcPath(decompressDir % QString("/A%1/%2").arg(assets->id()).arg(QFileInfo(assets->filename()).completeBaseName())); + QDir srcPath(QString("%1/A%2/%3").arg(decompressDir).arg(assets->id()).arg(QFileInfo(assets->filename()).completeBaseName())); if (!srcPath.exists()) { reportProgress(tr("Decompressed file structure not found at %1").arg(QDir::toNativeSeparators(srcPath.path())), QtCriticalMsg); @@ -1087,9 +1095,9 @@ bool UpdateInterface::copyFiles() QString srcPath; if (assets->flags() & UPDFLG_Decompress) - srcPath = decompressDir % QString("/A%1/%2").arg(assets->id()).arg(QFileInfo(assets->filename()).completeBaseName()); + srcPath = QString("%1/A%2/%3").arg(decompressDir).arg(assets->id()).arg(QFileInfo(assets->filename()).completeBaseName()); else if (assets->flags() & UPDFLG_Download) - srcPath = downloadDir % QString("/A%1").arg(assets->id()); + srcPath = QString("%1/A%2").arg(downloadDir).arg(assets->id()); else { reportProgress(tr("Unable to determine source directory for asset %1").arg(assets->filename()), QtCriticalMsg); return false; @@ -1292,7 +1300,8 @@ bool UpdateInterface::housekeeping() if (progress) progress->setValue(++cnt); - if (runParams->data.assets.at(0).flags & UPDFLG_DelDownload) { + if (runParams->data.flags & UPDFLG_DelDownloads) { + reportProgress(tr("Delete download directory: %1").arg(downloadDir), QtDebugMsg); QDir d(downloadDir); if (!d.removeRecursively()) reportProgress(tr("Failed to delete downloads folder %1").arg(downloadDir), QtCriticalMsg); @@ -1301,7 +1310,8 @@ bool UpdateInterface::housekeeping() if (progress) progress->setValue(++cnt); - if (!g.decompressUseDwnld() && (runParams->data.assets.at(0).flags & UPDFLG_DelDecompress)) { + if (!g.decompressDirUseDwnld() && (runParams->data.flags & UPDFLG_DelDownloads)) { + reportProgress(tr("Delete decompress directory: %1").arg(decompressDir), QtDebugMsg); QDir d(decompressDir); if (!d.removeRecursively()) reportProgress(tr("Failed to delete decompress folder %1").arg(decompressDir), QtCriticalMsg); @@ -1320,6 +1330,7 @@ bool UpdateInterface::asyncInstall() bool UpdateInterface::saveReleaseSettings() { + reportProgress(tr("Save release settings"), QtDebugMsg); g.component[settingsIdx].release(releases->name()); g.component[settingsIdx].version(releases->version()); g.component[settingsIdx].id(releases->id()); diff --git a/companion/src/updates/updateinterface.h b/companion/src/updates/updateinterface.h index 12a251b89..6bad86fe0 100644 --- a/companion/src/updates/updateinterface.h +++ b/companion/src/updates/updateinterface.h @@ -63,9 +63,9 @@ class UpdateParameters : public QWidget QString currentRelease; QString updateRelease; QString downloadDir; - bool decompressUseDwnld; + bool decompressDirUseDwnld; QString decompressDir; - bool updateUseSD; + bool updateDirUseSD; QString updateDir; QVector assets; }; @@ -101,14 +101,13 @@ class UpdateInterface : public QWidget UPDFLG_Locked = 1 << 2, UPDFLG_Preparation = 1 << 3, UPDFLG_Download = 1 << 4, - UPDFLG_DelDownload = 1 << 5, - UPDFLG_Decompress = 1 << 6, - UPDFLG_DelDecompress = 1 << 7, - UPDFLG_CopyDest = 1 << 8, - UPDFLG_CopyFiles = 1 << 9, - UPDFLG_CopyStructure = 1 << 10, - UPDFLG_Housekeeping = 1 << 11, - UPDFLG_AsyncInstall = 1 << 12, + UPDFLG_Decompress = 1 << 5, + UPDFLG_CopyDest = 1 << 6, + UPDFLG_CopyFiles = 1 << 7, + UPDFLG_CopyStructure = 1 << 8, + UPDFLG_Housekeeping = 1 << 9, + UPDFLG_AsyncInstall = 1 << 10, + UPDFLG_DelDownloads = 1 << 11, UPDFLG_Common = UPDFLG_Preparation | UPDFLG_Download | UPDFLG_Decompress | UPDFLG_CopyDest | UPDFLG_Housekeeping, }; Q_ENUM(UpdateFlags) diff --git a/companion/src/updates/updatemultiprotocol.cpp b/companion/src/updates/updatemultiprotocol.cpp index c9e978610..e4c3a638c 100644 --- a/companion/src/updates/updatemultiprotocol.cpp +++ b/companion/src/updates/updatemultiprotocol.cpp @@ -40,7 +40,7 @@ UpdateMultiProtocol::UpdateMultiProtocol(QWidget * parent) : UpdateParameters::AssetParams &ap = dfltParams->addAsset(); ap.filterType = UpdateParameters::UFT_Expression; ap.filter = "^mm-stm-serial-.*\\.bin$"; - ap.flags = (dfltParams->data.flags | UPDFLG_CopyFiles) &~ (UPDFLG_Decompress | UPDFLG_DelDecompress); + ap.flags = (dfltParams->data.flags | UPDFLG_CopyFiles) &~ UPDFLG_Decompress; ap.destSubDir = "FIRMWARE"; } } diff --git a/companion/src/updates/updateoptionsdialog.cpp b/companion/src/updates/updateoptionsdialog.cpp index 210c3380d..22769657f 100644 --- a/companion/src/updates/updateoptionsdialog.cpp +++ b/companion/src/updates/updateoptionsdialog.cpp @@ -212,8 +212,6 @@ UpdateOptionsDialog::UpdateOptionsDialog(QWidget * parent, UpdateFactories * fac chkDecompresses.at(i)->isChecked() ? ap.flags |= UpdateInterface::UPDFLG_Decompress :ap.flags &= ~UpdateInterface::UPDFLG_Decompress; chkInstalls.at(i)->isChecked() ? ap.flags |= UpdateInterface::UPDFLG_AsyncInstall : ap.flags &= ~UpdateInterface::UPDFLG_AsyncInstall; chkCopies.at(i)->isChecked() ? ap.flags |= UpdateInterface::UPDFLG_CopyDest : ap.flags &= ~UpdateInterface::UPDFLG_CopyDest; - ui->chkDelDownload->isChecked() ? ap.flags |= UpdateInterface::UPDFLG_DelDownload : ap.flags &= ~UpdateInterface::UPDFLG_DelDownload; - ui->chkDelDecompress->isChecked() ? ap.flags |= UpdateInterface::UPDFLG_DelDecompress : ap.flags &= ~UpdateInterface::UPDFLG_DelDecompress; } emit changed(idx); @@ -251,9 +249,6 @@ void UpdateOptionsDialog::update() leCopyFilters.at(i)->setText(ap.copyFilter); leSubFolders.at(i)->setText(ap.destSubDir); - ui->chkDelDownload->setChecked(ap.flags & UpdateInterface::UPDFLG_DelDownload); - ui->chkDelDecompress->setChecked(ap.flags & UpdateInterface::UPDFLG_DelDecompress); - i++; } } diff --git a/companion/src/updates/updateoptionsdialog.ui b/companion/src/updates/updateoptionsdialog.ui index 4652c5e00..754a7df1f 100644 --- a/companion/src/updates/updateoptionsdialog.ui +++ b/companion/src/updates/updateoptionsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 677 - 393 + 531 + 282 @@ -70,54 +70,6 @@ - - - - General - - - - - - - 0 - 0 - - - - Delete downloads - - - - - - - - 0 - 0 - - - - Delete decompressions - - - - - - - Qt::Horizontal - - - - 286 - 20 - - - - - - - diff --git a/companion/src/updates/updates.cpp b/companion/src/updates/updates.cpp index 4759aa1fe..97f6803db 100644 --- a/companion/src/updates/updates.cpp +++ b/companion/src/updates/updates.cpp @@ -106,6 +106,6 @@ void Updates::checkRunSDSync() if (!g.currentProfile().runSDSync()) return; - if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Run SD Sync now?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) + if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Run SD card sync now?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) emit runSDSync(); } diff --git a/companion/src/updates/updatesdialog.cpp b/companion/src/updates/updatesdialog.cpp index 2878ce641..34944592c 100644 --- a/companion/src/updates/updatesdialog.cpp +++ b/companion/src/updates/updatesdialog.cpp @@ -47,7 +47,7 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) : ui->leDownloadDir->setText(g.downloadDir()); - connect(ui->chkDecompressUseDwnld, &QCheckBox::stateChanged, [=](const int checked) { + connect(ui->chkDecompressDirUseDwnld, &QCheckBox::stateChanged, [=](const int checked) { if (!checked) { ui->leDecompressDir->setText(g.decompressDir()); ui->leDecompressDir->setEnabled(true); @@ -60,10 +60,10 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) : } }); - ui->chkDecompressUseDwnld->setChecked(!g.decompressUseDwnld()); - ui->chkDecompressUseDwnld->setChecked(g.decompressUseDwnld()); + ui->chkDecompressDirUseDwnld->setChecked(!g.decompressDirUseDwnld()); + ui->chkDecompressDirUseDwnld->setChecked(g.decompressDirUseDwnld()); - connect(ui->chkUpdateUseSD, &QCheckBox::stateChanged, [=](const int checked) { + connect(ui->chkUpdateDirUseSD, &QCheckBox::stateChanged, [=](const int checked) { if (!checked) { ui->leUpdateDir->setText(g.updateDir()); ui->leUpdateDir->setEnabled(true); @@ -76,8 +76,8 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) : } }); - ui->chkUpdateUseSD->setChecked(!g.updateUseSD()); - ui->chkUpdateUseSD->setChecked(g.updateUseSD()); + ui->chkUpdateDirUseSD->setChecked(!g.updateDirUseSD()); + ui->chkUpdateDirUseSD->setChecked(g.updateDirUseSD()); connect(ui->btnDownloadSelect, &QPushButton::clicked, [=]() { QString dirPath = QFileDialog::getExistingDirectory(this,tr("Select your download folder"), g.downloadDir()); @@ -174,6 +174,8 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) : ui->grpComponents->setLayout(grid); + ui->chkDelDownloads->setChecked(g.updDelDownloads()); + connect(ui->buttonBox, &QDialogButtonBox::accepted, [=]() { QMapIterator it(factories->sortedComponentsList()); @@ -187,10 +189,14 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) : UpdateParameters *runParams = factories->getRunParams(name); runParams->data.flags |= UpdateInterface::UPDFLG_Update; runParams->data.downloadDir = ui->leDownloadDir->text(); - runParams->data.decompressUseDwnld = ui->chkDecompressUseDwnld->isChecked(); + runParams->data.decompressDirUseDwnld = ui->chkDecompressDirUseDwnld->isChecked(); runParams->data.decompressDir = ui->leDecompressDir->text(); - runParams->data.updateUseSD = ui->chkUpdateUseSD->isChecked(); + runParams->data.updateDirUseSD = ui->chkUpdateDirUseSD->isChecked(); runParams->data.updateDir = ui->leUpdateDir->text(); + if (ui->chkDelDownloads->isChecked()) + runParams->data.flags |= UpdateInterface::UPDFLG_DelDownloads; + else + runParams->data.flags &= ~UpdateInterface::UPDFLG_DelDownloads; } } } diff --git a/companion/src/updates/updatesdialog.ui b/companion/src/updates/updatesdialog.ui index 37b89da68..39977804f 100644 --- a/companion/src/updates/updatesdialog.ui +++ b/companion/src/updates/updatesdialog.ui @@ -9,8 +9,8 @@ 0 0 - 525 - 289 + 593 + 345 @@ -47,7 +47,7 @@ - + Create sub-folders in Download folder @@ -71,7 +71,7 @@ - + Use Radio Profile SD structure @@ -130,6 +130,35 @@ + + + + + + + + + + Delete downloads after update + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + +