Invoke interactive update mode if any updates found on startup
This commit is contained in:
@@ -176,19 +176,6 @@ UpdateInterface::~UpdateInterface()
|
|||||||
delete runParams;
|
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)
|
bool UpdateInterface::manualUpdate(ProgressWidget * progress)
|
||||||
{
|
{
|
||||||
this->progress = progress;
|
this->progress = progress;
|
||||||
@@ -241,7 +228,7 @@ bool UpdateInterface::update()
|
|||||||
|
|
||||||
reportProgress(tr("%1 update successful").arg(name), QtInfoMsg);
|
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));
|
QMessageBox::information(this, CPN_STR_APP_NAME, tr("%1 update successful").arg(name));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1559,19 +1546,6 @@ const QStringList UpdateFactories::releases(const QString & name)
|
|||||||
return ret;
|
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 UpdateFactories::manualUpdate(ProgressWidget * progress)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ class UpdateInterface : public QWidget
|
|||||||
QString updateDir;
|
QString updateDir;
|
||||||
int logLevel;
|
int logLevel;
|
||||||
|
|
||||||
virtual bool autoUpdate(ProgressWidget * progress = nullptr);
|
|
||||||
virtual bool manualUpdate(ProgressWidget * progress = nullptr);
|
virtual bool manualUpdate(ProgressWidget * progress = nullptr);
|
||||||
|
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
@@ -283,7 +282,6 @@ class UpdateFactories : public QWidget
|
|||||||
const QString latestRelease(const QString & name);
|
const QString latestRelease(const QString & name);
|
||||||
const QStringList releases(const QString & name);
|
const QStringList releases(const QString & name);
|
||||||
|
|
||||||
bool autoUpdate(ProgressWidget * progress = nullptr);
|
|
||||||
bool manualUpdate(ProgressWidget * progress = nullptr);
|
bool manualUpdate(ProgressWidget * progress = nullptr);
|
||||||
const bool isUpdatesAvailable(QStringList & names);
|
const bool isUpdatesAvailable(QStringList & names);
|
||||||
|
|
||||||
|
|||||||
@@ -71,16 +71,7 @@ void Updates::autoUpdates()
|
|||||||
if (QMessageBox::question(parentWidget(), CPN_STR_APP_NAME % ": " % tr("Checking for Updates"),
|
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 ")),
|
tr("Updates available for:\n %1\n\nUpdate now?").arg(list.join("\n ")),
|
||||||
(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes) {
|
(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes) {
|
||||||
|
manualUpdates();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user