feat(cpn): Enhancements to update component runtime options (#2324)

* enh(cpn): Save update component asset options and manage in app settings

* Add option to delete decompress folders independent of delete download folder

* Fix sdsync to point to last update folder

* Update options dlg to allow choosing release channel and saving settings as defaults

* Rename params

* Asset options dialog shared between settings and update run. Add to Save as defaults
This commit is contained in:
Neil Horne
2022-09-26 08:55:16 +10:00
committed by GitHub
parent 30c54b48c9
commit 3563e917c6
31 changed files with 1016 additions and 555 deletions
+32 -21
View File
@@ -39,9 +39,9 @@ Updates::~Updates()
{
}
void Updates::checkForUpdates(bool manual)
void Updates::autoUpdates(bool interactive)
{
if (!manual) {
if (!interactive) {
if (g.updateCheckFreq() == AppData::UPDATE_CHECK_MANUAL)
return;
@@ -65,45 +65,56 @@ void Updates::checkForUpdates(bool manual)
g.lastUpdateCheck(QDateTime::currentDateTime().toString(Qt::ISODate));
factories->resetAllEnvironments();
QStringList list;
if (!factories->isUpdatesAvailable(list)) {
if (manual)
if (!factories->isUpdateAvailable(list)) {
if (interactive)
QMessageBox::information(parentWidget(), CPN_STR_APP_NAME, tr("No updates available at this time"));
return;
}
if (QMessageBox::question(parentWidget(), CPN_STR_APP_NAME % ": " % tr("Checking for Updates"),
tr("Updates available for:\n %1\n\nUpdate now?").arg(list.join("\n ")),
(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes) {
doUpdates();
tr("Updates available for:\n - %1\n\nProcess now?").arg(list.join("\n - ")),
(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::No) {
return;
}
for (int i = 0; i < list.count(); i++) {
factories->setRunUpdate(list.at(i));
factories->updateRelease(list.at(i));
}
runUpdate();
}
void Updates::doUpdates()
void Updates::manualUpdates()
{
if (factories->sortedComponentsList(true).isEmpty()) {
QMessageBox::warning(this, CPN_STR_APP_NAME, tr("No components have been flagged to check in Update Settings!"));
return;
}
factories->resetAllRunEnvironments();
factories->resetAllEnvironments();
UpdatesDialog *dlg = new UpdatesDialog(this, factories);
dlg->deleteLater();
if (dlg->exec())
runUpdate();
}
void Updates::runUpdate()
{
bool ok = false;
if (dlg->exec()) {
ProgressDialog progressDialog(this, tr("Update Components"), CompanionIcon("fuses.png"), true);
progressDialog.progress()->lock(true);
progressDialog.progress()->setInfo(tr("Starting..."));
ok = factories->manualUpdate(progressDialog.progress());
progressDialog.progress()->lock(false);
progressDialog.progress()->setInfo(tr("Finished %1").arg(ok ? tr("successfully") : tr("with errors")));
progressDialog.exec();
}
delete dlg;
ProgressDialog progressDialog(this, tr("Update Components"), CompanionIcon("fuses.png"), true);
progressDialog.progress()->lock(true);
progressDialog.progress()->setInfo(tr("Starting..."));
ok = factories->updateAll(progressDialog.progress());
progressDialog.progress()->lock(false);
progressDialog.progress()->setInfo(tr("Finished %1").arg(ok ? tr("successfully") : tr("with errors")));
progressDialog.exec();
if (ok)
checkRunSDSync();