Invoke interactive update mode if any updates found on startup
This commit is contained in:
@@ -176,19 +176,6 @@ UpdateInterface::~UpdateInterface()
|
||||
delete runParams;
|
||||
}
|
||||
|
||||
bool UpdateInterface::autoUpdate(ProgressWidget * progress)
|
||||
{
|
||||
this->progress = progress;
|
||||
|
||||
if (g.component[m_settingsIdx].checkForUpdate() && !isLatestRelease()) {
|
||||
runParams->data.flags |= UPDFLG_Update;
|
||||
runParams->data.updateRelease = latestRelease();
|
||||
return update();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UpdateInterface::manualUpdate(ProgressWidget * progress)
|
||||
{
|
||||
this->progress = progress;
|
||||
@@ -241,7 +228,7 @@ bool UpdateInterface::update()
|
||||
|
||||
reportProgress(tr("%1 update successful").arg(name), QtInfoMsg);
|
||||
|
||||
if (!progress) // auto update
|
||||
if (!progress)
|
||||
QMessageBox::information(this, CPN_STR_APP_NAME, tr("%1 update successful").arg(name));
|
||||
|
||||
return true;
|
||||
@@ -1559,19 +1546,6 @@ const QStringList UpdateFactories::releases(const QString & name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool UpdateFactories::autoUpdate(ProgressWidget * progress)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
foreach (UpdateFactoryInterface * factory, registeredUpdateFactories) {
|
||||
ok = factory->instance()->autoUpdate(progress);
|
||||
if (!ok)
|
||||
break;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool UpdateFactories::manualUpdate(ProgressWidget * progress)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
@@ -135,7 +135,6 @@ class UpdateInterface : public QWidget
|
||||
QString updateDir;
|
||||
int logLevel;
|
||||
|
||||
virtual bool autoUpdate(ProgressWidget * progress = nullptr);
|
||||
virtual bool manualUpdate(ProgressWidget * progress = nullptr);
|
||||
|
||||
virtual bool update();
|
||||
@@ -283,7 +282,6 @@ class UpdateFactories : public QWidget
|
||||
const QString latestRelease(const QString & name);
|
||||
const QStringList releases(const QString & name);
|
||||
|
||||
bool autoUpdate(ProgressWidget * progress = nullptr);
|
||||
bool manualUpdate(ProgressWidget * progress = nullptr);
|
||||
const bool isUpdatesAvailable(QStringList & names);
|
||||
|
||||
|
||||
@@ -71,16 +71,7 @@ void Updates::autoUpdates()
|
||||
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) {
|
||||
|
||||
factories->resetAllRunEnvironments();
|
||||
|
||||
if (!factories->autoUpdate()) {
|
||||
QMessageBox::warning(this, CPN_STR_APP_NAME, tr("Updates finished with errors"));
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, CPN_STR_APP_NAME, tr("Updates finished successfully"));
|
||||
checkRunSDSync();
|
||||
}
|
||||
manualUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user