Rename settings and change the way post install deletes are configured and operate
This commit is contained in:
@@ -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<QString, int> 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<QString, int> it(factories->sortedComponentsList());
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="profileTab">
|
||||
<attribute name="title">
|
||||
@@ -727,13 +727,6 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="applicationTab">
|
||||
@@ -1460,7 +1453,7 @@ Mode 4:
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="chkDecompressUseDwnld">
|
||||
<widget class="QCheckBox" name="chkDecompressDirUseDwnld">
|
||||
<property name="text">
|
||||
<string>Create sub-folders in Download folder</string>
|
||||
</property>
|
||||
@@ -1484,7 +1477,7 @@ Mode 4:
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="chkUpdateUseSD">
|
||||
<widget class="QCheckBox" name="chkUpdateDirUseSD">
|
||||
<property name="text">
|
||||
<string>Use Radio Profile SD Structure</string>
|
||||
</property>
|
||||
@@ -1537,6 +1530,45 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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<AssetParams> 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)
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>677</width>
|
||||
<height>393</height>
|
||||
<width>531</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -70,54 +70,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<QString, int> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<height>289</height>
|
||||
<width>593</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -47,7 +47,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="chkDecompressUseDwnld">
|
||||
<widget class="QCheckBox" name="chkDecompressDirUseDwnld">
|
||||
<property name="text">
|
||||
<string>Create sub-folders in Download folder</string>
|
||||
</property>
|
||||
@@ -71,7 +71,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="chkUpdateUseSD">
|
||||
<widget class="QCheckBox" name="chkUpdateDirUseSD">
|
||||
<property name="text">
|
||||
<string>Use Radio Profile SD structure</string>
|
||||
</property>
|
||||
@@ -130,6 +130,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user