Rename settings and change the way post install deletes are configured and operate

This commit is contained in:
elecpower
2022-09-06 09:29:41 +10:00
committed by Peter Feerick
parent 97048a1544
commit 07f9d38237
13 changed files with 168 additions and 132 deletions
+18 -10
View File
@@ -90,7 +90,7 @@ void AppPreferencesDialog::accept()
g.appDebugLog(ui->opt_appDebugLog->isChecked()); g.appDebugLog(ui->opt_appDebugLog->isChecked());
g.fwTraceLog(ui->opt_fwTraceLog->isChecked()); g.fwTraceLog(ui->opt_fwTraceLog->isChecked());
g.appLogsDir(ui->appLogsDir->text()); g.appLogsDir(ui->appLogsDir->text());
g.runInstaller(ui->chkPromptInstall->isChecked()); g.runAppInstaller(ui->chkPromptInstall->isChecked());
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) { if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
g.jsSupport(ui->joystickChkB ->isChecked()); g.jsSupport(ui->joystickChkB ->isChecked());
@@ -106,12 +106,15 @@ void AppPreferencesDialog::accept()
g.updateCheckFreq(AppData::UpdateCheckFreq(ui->cboUpdateCheckFreq->currentIndex())); g.updateCheckFreq(AppData::UpdateCheckFreq(ui->cboUpdateCheckFreq->currentIndex()));
g.downloadDir(ui->leDownloadDir->text()); g.downloadDir(ui->leDownloadDir->text());
g.decompressUseDwnld(ui->chkDecompressUseDwnld->isChecked()); g.decompressDirUseDwnld(ui->chkDecompressDirUseDwnld->isChecked());
g.decompressDir(ui->leDecompressDir->text()); g.decompressDir(ui->leDecompressDir->text());
g.updateUseSD(ui->chkUpdateUseSD->isChecked()); g.updateDirUseSD(ui->chkUpdateDirUseSD->isChecked());
g.updateDir(ui->leUpdateDir->text()); g.updateDir(ui->leUpdateDir->text());
g.updDelDownloads(ui->chkDelDownloads->isChecked());
g.updLogLevel(ui->cboLogLevel->currentIndex());
QMapIterator<QString, int> it(factories->sortedComponentsList()); QMapIterator<QString, int> it(factories->sortedComponentsList());
while (it.hasNext()) { while (it.hasNext()) {
@@ -236,7 +239,7 @@ void AppPreferencesDialog::initSettings()
ui->opt_fwTraceLog->setChecked(g.fwTraceLog()); ui->opt_fwTraceLog->setChecked(g.fwTraceLog());
ui->appLogsDir->setText(g.appLogsDir()); ui->appLogsDir->setText(g.appLogsDir());
toggleAppLogSettings(); toggleAppLogSettings();
ui->chkPromptInstall->setChecked(g.runInstaller()); ui->chkPromptInstall->setChecked(g.runAppInstaller());
#if defined(JOYSTICKS) #if defined(JOYSTICKS)
ui->joystickChkB->setChecked(g.jsSupport()); 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) { if (!checked) {
ui->leDecompressDir->setText(g.decompressDir()); ui->leDecompressDir->setText(g.decompressDir());
ui->leDecompressDir->setEnabled(true); 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) { if (!checked) {
ui->leUpdateDir->setText(g.updateDir()); ui->leUpdateDir->setText(g.updateDir());
ui->leUpdateDir->setEnabled(true); ui->leUpdateDir->setEnabled(true);
@@ -414,6 +417,8 @@ void AppPreferencesDialog::initSettings()
ui->grpComponents->setLayout(grid); ui->grpComponents->setLayout(grid);
ui->cboLogLevel->addItems(AppData::updateLogLevelsList());
loadUpdatesTab(); loadUpdatesTab();
} }
@@ -422,11 +427,14 @@ void AppPreferencesDialog::loadUpdatesTab()
ui->cboUpdateCheckFreq->setCurrentIndex(g.updateCheckFreq()); ui->cboUpdateCheckFreq->setCurrentIndex(g.updateCheckFreq());
ui->leDownloadDir->setText(g.downloadDir()); ui->leDownloadDir->setText(g.downloadDir());
// trigger toggled signal by changing design value and then setting to saved value // trigger toggled signal by changing design value and then setting to saved value
ui->chkDecompressUseDwnld->setChecked(!ui->chkDecompressUseDwnld->isChecked()); ui->chkDecompressDirUseDwnld->setChecked(!ui->chkDecompressDirUseDwnld->isChecked());
ui->chkDecompressUseDwnld->setChecked(g.decompressUseDwnld()); ui->chkDecompressDirUseDwnld->setChecked(g.decompressDirUseDwnld());
// trigger toggled signal by changing design value and then setting to saved value // trigger toggled signal by changing design value and then setting to saved value
ui->chkUpdateUseSD->setChecked(!ui->chkUpdateUseSD->isChecked()); ui->chkUpdateDirUseSD->setChecked(!ui->chkUpdateDirUseSD->isChecked());
ui->chkUpdateUseSD->setChecked(g.updateUseSD()); ui->chkUpdateDirUseSD->setChecked(g.updateDirUseSD());
ui->chkDelDownloads->setChecked(g.updDelDownloads());
ui->cboLogLevel->setCurrentIndex(g.updLogLevel());
QMapIterator<QString, int> it(factories->sortedComponentsList()); QMapIterator<QString, int> it(factories->sortedComponentsList());
+42 -10
View File
@@ -45,7 +45,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="profileTab"> <widget class="QWidget" name="profileTab">
<attribute name="title"> <attribute name="title">
@@ -727,13 +727,6 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item row="16" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="applicationTab"> <widget class="QWidget" name="applicationTab">
@@ -1460,7 +1453,7 @@ Mode 4:
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QCheckBox" name="chkDecompressUseDwnld"> <widget class="QCheckBox" name="chkDecompressDirUseDwnld">
<property name="text"> <property name="text">
<string>Create sub-folders in Download folder</string> <string>Create sub-folders in Download folder</string>
</property> </property>
@@ -1484,7 +1477,7 @@ Mode 4:
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="chkUpdateUseSD"> <widget class="QCheckBox" name="chkUpdateDirUseSD">
<property name="text"> <property name="text">
<string>Use Radio Profile SD Structure</string> <string>Use Radio Profile SD Structure</string>
</property> </property>
@@ -1537,6 +1530,45 @@ Mode 4:
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="grpOther">
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="chkDelDownloads">
<property name="text">
<string>Delete downloads after update</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lblLogging">
<property name="text">
<string>Logging</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboLogLevel"/>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
+4 -3
View File
@@ -656,8 +656,9 @@ void AppData::resetUpdatesSettings()
g.updateCheckFreqReset(); g.updateCheckFreqReset();
g.downloadDirReset(); g.downloadDirReset();
g.decompressDirReset(); g.decompressDirReset();
g.decompressUseDwnldReset(); g.decompressDirUseDwnldReset();
g.updateDirReset(); g.updateDirReset();
g.updateUseSDReset(); g.updateDirUseSDReset();
g.updateLogLevelReset(); g.updDelDownloadsReset();
g.updLogLevelReset();
} }
+7 -4
View File
@@ -501,6 +501,8 @@ class AppData: public CompStoreObj
static QStringList newModelActionsList() { return { tr("None"), tr("Wizard"), tr("Editor"), tr("Template"), tr("Prompt") } ; } 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") } ; } 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(); explicit AppData();
void init() override; void init() override;
@@ -598,10 +600,12 @@ class AppData: public CompStoreObj
PROPERTYSTRD(templatesDir, CPN_DOCUMENTS_LOCATION % "/templates") PROPERTYSTRD(templatesDir, CPN_DOCUMENTS_LOCATION % "/templates")
PROPERTYSTRD(downloadDir, CPN_DOCUMENTS_LOCATION % "/downloads") PROPERTYSTRD(downloadDir, CPN_DOCUMENTS_LOCATION % "/downloads")
PROPERTYSTRD(decompressDir, CPN_DOCUMENTS_LOCATION % "/decompress") PROPERTYSTRD(decompressDir, CPN_DOCUMENTS_LOCATION % "/decompress")
PROPERTY (bool, decompressUseDwnld, true)
PROPERTYSTRD(updateDir, CPN_DOCUMENTS_LOCATION % "/updates") PROPERTYSTRD(updateDir, CPN_DOCUMENTS_LOCATION % "/updates")
PROPERTY (bool, updateUseSD, true) PROPERTY (bool, decompressDirUseDwnld, true)
PROPERTY (int, updateLogLevel, 4) PROPERTY (bool, updateDirUseSD, true)
PROPERTY (bool, runAppInstaller, false)
PROPERTY (int, updLogLevel, 4)
PROPERTY (bool, updDelDownloads, false)
PROPERTYSTR (locale) PROPERTYSTR (locale)
PROPERTYSTR (gePath) PROPERTYSTR (gePath)
@@ -637,7 +641,6 @@ class AppData: public CompStoreObj
PROPERTY(bool, tabbedMdi, false) PROPERTY(bool, tabbedMdi, false)
PROPERTY(bool, appDebugLog, false) PROPERTY(bool, appDebugLog, false)
PROPERTY(bool, fwTraceLog, false) PROPERTY(bool, fwTraceLog, false)
PROPERTY(bool, runInstaller, false)
// Simulator global (non-profile) settings // Simulator global (non-profile) settings
PROPERTY(QStringList, simuDbgFilters, QStringList()) PROPERTY(QStringList, simuDbgFilters, QStringList())
+2 -2
View File
@@ -62,9 +62,9 @@ UpdateCompanion::UpdateCompanion(QWidget * parent) :
bool UpdateCompanion::asyncInstall() 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; return true;
progressMessage(tr("Async install")); progressMessage(tr("Async install"));
+35 -24
View File
@@ -47,8 +47,8 @@ UpdateParameters::UpdateParameters(QWidget * parent) :
QWidget(parent) QWidget(parent)
{ {
data.flags = 0; data.flags = 0;
data.decompressUseDwnld = true; data.decompressDirUseDwnld = true;
data.updateUseSD = true; data.updateDirUseSD = true;
} }
UpdateParameters& UpdateParameters::operator=(const UpdateParameters& source) UpdateParameters& UpdateParameters::operator=(const UpdateParameters& source)
@@ -63,9 +63,9 @@ UpdateParameters& UpdateParameters::operator=(const UpdateParameters& source)
data.currentRelease = source.data.currentRelease; data.currentRelease = source.data.currentRelease;
data.updateRelease = source.data.updateRelease; data.updateRelease = source.data.updateRelease;
data.downloadDir = source.data.downloadDir; data.downloadDir = source.data.downloadDir;
data.decompressUseDwnld = source.data.decompressUseDwnld; data.decompressDirUseDwnld = source.data.decompressDirUseDwnld;
data.decompressDir = source.data.decompressDir; data.decompressDir = source.data.decompressDir;
data.updateUseSD = source.data.updateUseSD; data.updateDirUseSD = source.data.updateDirUseSD;
data.updateDir = source.data.updateDir; data.updateDir = source.data.updateDir;
while (!data.assets.isEmpty()) { while (!data.assets.isEmpty()) {
@@ -144,7 +144,6 @@ UpdateInterface::UpdateInterface(QWidget * parent) :
file(nullptr) file(nullptr)
{ {
progress = nullptr; progress = nullptr;
logLevel = g.updateLogLevel();
settingsIdx = -1; settingsIdx = -1;
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
@@ -257,12 +256,8 @@ QString UpdateInterface::updateFlagsToString(UpdateFlags val)
return "Preparation"; return "Preparation";
case UPDFLG_Download: case UPDFLG_Download:
return "Download"; return "Download";
case UPDFLG_DelDownload:
return "Delete Download";
case UPDFLG_Decompress: case UPDFLG_Decompress:
return "Decompress"; return "Decompress";
case UPDFLG_DelDecompress:
return "Delete Decompress";
case UPDFLG_CopyDest: case UPDFLG_CopyDest:
return "Copy to Destination"; return "Copy to Destination";
case UPDFLG_CopyFiles: case UPDFLG_CopyFiles:
@@ -273,6 +268,8 @@ QString UpdateInterface::updateFlagsToString(UpdateFlags val)
return "Housekeeping"; return "Housekeeping";
case UPDFLG_AsyncInstall: case UPDFLG_AsyncInstall:
return "Async Install"; return "Async Install";
case UPDFLG_DelDownloads:
return "Delete Downloads";
default: default:
return CPN_STR_UNKNOWN_ITEM; return CPN_STR_UNKNOWN_ITEM;
} }
@@ -345,9 +342,9 @@ void UpdateInterface::initParamFolders(UpdateParameters * params)
params->data.downloadDir = g.downloadDir().trimmed(); 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; params->data.decompressDir = params->data.downloadDir;
else { else {
if (g.decompressDir().trimmed().isEmpty()) if (g.decompressDir().trimmed().isEmpty())
@@ -356,9 +353,9 @@ void UpdateInterface::initParamFolders(UpdateParameters * params)
params->data.decompressDir = g.decompressDir().trimmed(); 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(); params->data.updateDir = g.currentProfile().sdPath().trimmed();
else { else {
if (g.updateDir().trimmed().isEmpty()) if (g.updateDir().trimmed().isEmpty())
@@ -371,9 +368,16 @@ void UpdateInterface::initParamFolders(UpdateParameters * params)
void UpdateInterface::resetRunEnvironment() void UpdateInterface::resetRunEnvironment()
{ {
progress = nullptr; progress = nullptr;
logLevel = g.updLogLevel();
qDebug() << tr("Log level: %1").arg(logLevel);
*runParams = *dfltParams; *runParams = *dfltParams;
runParams->data.flags &= ~UPDFLG_Update; runParams->data.flags &= ~UPDFLG_Update;
if (g.updDelDownloads())
runParams->data.flags |= UpdateInterface::UPDFLG_DelDownloads;
else
runParams->data.flags &= ~UpdateInterface::UPDFLG_DelDownloads;
} }
int UpdateInterface::getSettingsIdx() int UpdateInterface::getSettingsIdx()
@@ -542,17 +546,21 @@ bool UpdateInterface::setRunFolders()
{ {
QString fldr(releases->name()); 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(")", "_");
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)) if (!checkCreateDirectory(downloadDir, UPDFLG_Download))
return false; return false;
reportProgress(tr("Download directory: %1").arg(downloadDir), QtDebugMsg); 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)) if (!checkCreateDirectory(decompressDir, UPDFLG_Decompress))
return false; return false;
@@ -849,7 +857,7 @@ void UpdateInterface::downloadBinaryToFile(const QString & url, const QString &
{ {
downloadSuccess = false; 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)); progressMessage(tr("Downloading: %1").arg(filename));
reportProgress(tr("Download: %1").arg(filename), QtInfoMsg); reportProgress(tr("Download: %1").arg(filename), QtInfoMsg);
@@ -907,14 +915,14 @@ bool UpdateInterface::decompressAsset(int row)
if (filename.isEmpty()) if (filename.isEmpty())
return false; 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()) if (!f.exists())
return false; return false;
reportProgress(tr("Decompress: %1").arg(filename), QtInfoMsg); 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; return true;
} }
@@ -971,7 +979,7 @@ bool UpdateInterface::copyStructure()
progress->setMaximum(100); 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()) { if (!srcPath.exists()) {
reportProgress(tr("Decompressed file structure not found at %1").arg(QDir::toNativeSeparators(srcPath.path())), QtCriticalMsg); reportProgress(tr("Decompressed file structure not found at %1").arg(QDir::toNativeSeparators(srcPath.path())), QtCriticalMsg);
@@ -1087,9 +1095,9 @@ bool UpdateInterface::copyFiles()
QString srcPath; QString srcPath;
if (assets->flags() & UPDFLG_Decompress) 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) 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 { else {
reportProgress(tr("Unable to determine source directory for asset %1").arg(assets->filename()), QtCriticalMsg); reportProgress(tr("Unable to determine source directory for asset %1").arg(assets->filename()), QtCriticalMsg);
return false; return false;
@@ -1292,7 +1300,8 @@ bool UpdateInterface::housekeeping()
if (progress) if (progress)
progress->setValue(++cnt); 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); QDir d(downloadDir);
if (!d.removeRecursively()) if (!d.removeRecursively())
reportProgress(tr("Failed to delete downloads folder %1").arg(downloadDir), QtCriticalMsg); reportProgress(tr("Failed to delete downloads folder %1").arg(downloadDir), QtCriticalMsg);
@@ -1301,7 +1310,8 @@ bool UpdateInterface::housekeeping()
if (progress) if (progress)
progress->setValue(++cnt); 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); QDir d(decompressDir);
if (!d.removeRecursively()) if (!d.removeRecursively())
reportProgress(tr("Failed to delete decompress folder %1").arg(decompressDir), QtCriticalMsg); reportProgress(tr("Failed to delete decompress folder %1").arg(decompressDir), QtCriticalMsg);
@@ -1320,6 +1330,7 @@ bool UpdateInterface::asyncInstall()
bool UpdateInterface::saveReleaseSettings() bool UpdateInterface::saveReleaseSettings()
{ {
reportProgress(tr("Save release settings"), QtDebugMsg);
g.component[settingsIdx].release(releases->name()); g.component[settingsIdx].release(releases->name());
g.component[settingsIdx].version(releases->version()); g.component[settingsIdx].version(releases->version());
g.component[settingsIdx].id(releases->id()); g.component[settingsIdx].id(releases->id());
+9 -10
View File
@@ -63,9 +63,9 @@ class UpdateParameters : public QWidget
QString currentRelease; QString currentRelease;
QString updateRelease; QString updateRelease;
QString downloadDir; QString downloadDir;
bool decompressUseDwnld; bool decompressDirUseDwnld;
QString decompressDir; QString decompressDir;
bool updateUseSD; bool updateDirUseSD;
QString updateDir; QString updateDir;
QVector<AssetParams> assets; QVector<AssetParams> assets;
}; };
@@ -101,14 +101,13 @@ class UpdateInterface : public QWidget
UPDFLG_Locked = 1 << 2, UPDFLG_Locked = 1 << 2,
UPDFLG_Preparation = 1 << 3, UPDFLG_Preparation = 1 << 3,
UPDFLG_Download = 1 << 4, UPDFLG_Download = 1 << 4,
UPDFLG_DelDownload = 1 << 5, UPDFLG_Decompress = 1 << 5,
UPDFLG_Decompress = 1 << 6, UPDFLG_CopyDest = 1 << 6,
UPDFLG_DelDecompress = 1 << 7, UPDFLG_CopyFiles = 1 << 7,
UPDFLG_CopyDest = 1 << 8, UPDFLG_CopyStructure = 1 << 8,
UPDFLG_CopyFiles = 1 << 9, UPDFLG_Housekeeping = 1 << 9,
UPDFLG_CopyStructure = 1 << 10, UPDFLG_AsyncInstall = 1 << 10,
UPDFLG_Housekeeping = 1 << 11, UPDFLG_DelDownloads = 1 << 11,
UPDFLG_AsyncInstall = 1 << 12,
UPDFLG_Common = UPDFLG_Preparation | UPDFLG_Download | UPDFLG_Decompress | UPDFLG_CopyDest | UPDFLG_Housekeeping, UPDFLG_Common = UPDFLG_Preparation | UPDFLG_Download | UPDFLG_Decompress | UPDFLG_CopyDest | UPDFLG_Housekeeping,
}; };
Q_ENUM(UpdateFlags) Q_ENUM(UpdateFlags)
@@ -40,7 +40,7 @@ UpdateMultiProtocol::UpdateMultiProtocol(QWidget * parent) :
UpdateParameters::AssetParams &ap = dfltParams->addAsset(); UpdateParameters::AssetParams &ap = dfltParams->addAsset();
ap.filterType = UpdateParameters::UFT_Expression; ap.filterType = UpdateParameters::UFT_Expression;
ap.filter = "^mm-stm-serial-.*\\.bin$"; 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"; ap.destSubDir = "FIRMWARE";
} }
} }
@@ -212,8 +212,6 @@ UpdateOptionsDialog::UpdateOptionsDialog(QWidget * parent, UpdateFactories * fac
chkDecompresses.at(i)->isChecked() ? ap.flags |= UpdateInterface::UPDFLG_Decompress :ap.flags &= ~UpdateInterface::UPDFLG_Decompress; 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; 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; 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); emit changed(idx);
@@ -251,9 +249,6 @@ void UpdateOptionsDialog::update()
leCopyFilters.at(i)->setText(ap.copyFilter); leCopyFilters.at(i)->setText(ap.copyFilter);
leSubFolders.at(i)->setText(ap.destSubDir); leSubFolders.at(i)->setText(ap.destSubDir);
ui->chkDelDownload->setChecked(ap.flags & UpdateInterface::UPDFLG_DelDownload);
ui->chkDelDecompress->setChecked(ap.flags & UpdateInterface::UPDFLG_DelDecompress);
i++; i++;
} }
} }
+2 -50
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>677</width> <width>531</width>
<height>393</height> <height>282</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -70,54 +70,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="grpGeneral">
<property name="title">
<string>General</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="chkDelDownload">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Delete downloads</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkDelDecompress">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Delete decompressions</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>286</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
+1 -1
View File
@@ -106,6 +106,6 @@ void Updates::checkRunSDSync()
if (!g.currentProfile().runSDSync()) if (!g.currentProfile().runSDSync())
return; 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(); emit runSDSync();
} }
+14 -8
View File
@@ -47,7 +47,7 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
ui->leDownloadDir->setText(g.downloadDir()); ui->leDownloadDir->setText(g.downloadDir());
connect(ui->chkDecompressUseDwnld, &QCheckBox::stateChanged, [=](const int checked) { connect(ui->chkDecompressDirUseDwnld, &QCheckBox::stateChanged, [=](const int checked) {
if (!checked) { if (!checked) {
ui->leDecompressDir->setText(g.decompressDir()); ui->leDecompressDir->setText(g.decompressDir());
ui->leDecompressDir->setEnabled(true); ui->leDecompressDir->setEnabled(true);
@@ -60,10 +60,10 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
} }
}); });
ui->chkDecompressUseDwnld->setChecked(!g.decompressUseDwnld()); ui->chkDecompressDirUseDwnld->setChecked(!g.decompressDirUseDwnld());
ui->chkDecompressUseDwnld->setChecked(g.decompressUseDwnld()); ui->chkDecompressDirUseDwnld->setChecked(g.decompressDirUseDwnld());
connect(ui->chkUpdateUseSD, &QCheckBox::stateChanged, [=](const int checked) { connect(ui->chkUpdateDirUseSD, &QCheckBox::stateChanged, [=](const int checked) {
if (!checked) { if (!checked) {
ui->leUpdateDir->setText(g.updateDir()); ui->leUpdateDir->setText(g.updateDir());
ui->leUpdateDir->setEnabled(true); ui->leUpdateDir->setEnabled(true);
@@ -76,8 +76,8 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
} }
}); });
ui->chkUpdateUseSD->setChecked(!g.updateUseSD()); ui->chkUpdateDirUseSD->setChecked(!g.updateDirUseSD());
ui->chkUpdateUseSD->setChecked(g.updateUseSD()); ui->chkUpdateDirUseSD->setChecked(g.updateDirUseSD());
connect(ui->btnDownloadSelect, &QPushButton::clicked, [=]() { connect(ui->btnDownloadSelect, &QPushButton::clicked, [=]() {
QString dirPath = QFileDialog::getExistingDirectory(this,tr("Select your download folder"), g.downloadDir()); 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->grpComponents->setLayout(grid);
ui->chkDelDownloads->setChecked(g.updDelDownloads());
connect(ui->buttonBox, &QDialogButtonBox::accepted, [=]() { connect(ui->buttonBox, &QDialogButtonBox::accepted, [=]() {
QMapIterator<QString, int> it(factories->sortedComponentsList()); QMapIterator<QString, int> it(factories->sortedComponentsList());
@@ -187,10 +189,14 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
UpdateParameters *runParams = factories->getRunParams(name); UpdateParameters *runParams = factories->getRunParams(name);
runParams->data.flags |= UpdateInterface::UPDFLG_Update; runParams->data.flags |= UpdateInterface::UPDFLG_Update;
runParams->data.downloadDir = ui->leDownloadDir->text(); 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.decompressDir = ui->leDecompressDir->text();
runParams->data.updateUseSD = ui->chkUpdateUseSD->isChecked(); runParams->data.updateDirUseSD = ui->chkUpdateDirUseSD->isChecked();
runParams->data.updateDir = ui->leUpdateDir->text(); runParams->data.updateDir = ui->leUpdateDir->text();
if (ui->chkDelDownloads->isChecked())
runParams->data.flags |= UpdateInterface::UPDFLG_DelDownloads;
else
runParams->data.flags &= ~UpdateInterface::UPDFLG_DelDownloads;
} }
} }
} }
+33 -4
View File
@@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>525</width> <width>593</width>
<height>289</height> <height>345</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -47,7 +47,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QCheckBox" name="chkDecompressUseDwnld"> <widget class="QCheckBox" name="chkDecompressDirUseDwnld">
<property name="text"> <property name="text">
<string>Create sub-folders in Download folder</string> <string>Create sub-folders in Download folder</string>
</property> </property>
@@ -71,7 +71,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="chkUpdateUseSD"> <widget class="QCheckBox" name="chkUpdateDirUseSD">
<property name="text"> <property name="text">
<string>Use Radio Profile SD structure</string> <string>Use Radio Profile SD structure</string>
</property> </property>
@@ -130,6 +130,35 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="grpOther">
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="chkDelDownloads">
<property name="text">
<string>Delete downloads after update</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">