Improve messages and update options dialog checkbox after Forget
This commit is contained in:
@@ -1574,12 +1574,14 @@ bool UpdateFactories::manualUpdate(ProgressWidget * progress)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool UpdateFactories::updatesAvailable()
|
const bool UpdateFactories::updatesAvailable(QStringList & names)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
names.clear();
|
||||||
|
|
||||||
foreach (UpdateFactoryInterface * factory, registeredUpdateFactories) {
|
foreach (UpdateFactoryInterface * factory, registeredUpdateFactories) {
|
||||||
if (factory->instance()->isUpdateAvailable()) {
|
if (factory->instance()->isUpdateAvailable()) {
|
||||||
|
names.append(factory->name());
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ class UpdateFactories : public QWidget
|
|||||||
|
|
||||||
bool autoUpdate(ProgressWidget * progress = nullptr);
|
bool autoUpdate(ProgressWidget * progress = nullptr);
|
||||||
bool manualUpdate(ProgressWidget * progress = nullptr);
|
bool manualUpdate(ProgressWidget * progress = nullptr);
|
||||||
const bool updatesAvailable();
|
const bool updatesAvailable(QStringList & names);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<UpdateFactoryInterface *> registeredUpdateFactories;
|
QVector<UpdateFactoryInterface *> registeredUpdateFactories;
|
||||||
|
|||||||
@@ -63,17 +63,24 @@ void Updates::autoUpdates()
|
|||||||
|
|
||||||
g.lastUpdateCheck(QDateTime::currentDateTime().toString(Qt::ISODate));
|
g.lastUpdateCheck(QDateTime::currentDateTime().toString(Qt::ISODate));
|
||||||
|
|
||||||
if (!factories->updatesAvailable())
|
QStringList list;
|
||||||
|
|
||||||
|
if (!factories->updatesAvailable(list))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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("One or more updates are available. Update now?"),
|
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) {
|
||||||
|
|
||||||
factories->resetAllRunEnvironments();
|
factories->resetAllRunEnvironments();
|
||||||
|
|
||||||
if (factories->autoUpdate())
|
if (!factories->autoUpdate()) {
|
||||||
checkRunSDSync();
|
QMessageBox::warning(this, CPN_STR_APP_NAME, tr("Updates finished with errors"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox::information(this, CPN_STR_APP_NAME, tr("Updates finished successfully"));
|
||||||
|
checkRunSDSync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
|
|||||||
UpdateOptionsDialog *dlg = new UpdateOptionsDialog(this, factories, i);
|
UpdateOptionsDialog *dlg = new UpdateOptionsDialog(this, factories, i);
|
||||||
connect(dlg, &UpdateOptionsDialog::changed, [=](const int i) {
|
connect(dlg, &UpdateOptionsDialog::changed, [=](const int i) {
|
||||||
QString name = g.component[i].name();
|
QString name = g.component[i].name();
|
||||||
|
chkUpdate[i]->setChecked(!factories->isLatestRelease(name));
|
||||||
lblCurrentRel[i]->setText(factories->currentRelease(name));
|
lblCurrentRel[i]->setText(factories->currentRelease(name));
|
||||||
lblUpdateRel[i]->setText(factories->updateRelease(name));
|
lblUpdateRel[i]->setText(factories->updateRelease(name));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user