diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-03-22 17:01:48 +0300 |
---|---|---|
committer | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-03-22 17:01:48 +0300 |
commit | d6cc9dc037988bb3acd3895837c0345b487711c9 (patch) | |
tree | 3b9801069665051a43bdf2bccc2493dc00e642af /src/gui/updater | |
parent | b01835a3dbf4e239f238cd75933839b43b0007c1 (diff) | |
parent | 994cb79d2a6839c5cedee8aaad7b95963f035a14 (diff) |
Merge remote-tracking branch 'origin/2.10'
Diffstat (limited to 'src/gui/updater')
-rw-r--r-- | src/gui/updater/ocupdater.cpp | 10 | ||||
-rw-r--r-- | src/gui/updater/ocupdater.h | 18 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index 4a0c096c7..67c1b6224 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -28,7 +28,7 @@ #include <QtGui> #include <QtWidgets> -#include <stdio.h> +using namespace std::chrono_literals; using namespace std::chrono_literals; @@ -44,7 +44,13 @@ UpdaterScheduler::UpdaterScheduler(QObject *parent) if (OCUpdater *updater = qobject_cast<OCUpdater *>(Updater::instance())) { connect(updater, &OCUpdater::newUpdateAvailable, this, &UpdaterScheduler::updaterAnnouncement); + connect(updater, &OCUpdater::requestRestart, this, &UpdaterScheduler::requestRestart); + + connect(updater, &OCUpdater::retryUpdateCheckLater, this, [this]() { + qCInfo(lcUpdater) << "Retrying update check in 10 minutes"; + QTimer::singleShot(10min, this, &UpdaterScheduler::slotTimerFired); + }); } // at startup, do a check in any case. @@ -252,6 +258,7 @@ void OCUpdater::slotVersionInfoArrived() if (reply->error() != QNetworkReply::NoError) { qCWarning(lcUpdater) << "Failed to reach version check url: " << reply->errorString(); setDownloadState(OCUpdater::Unknown); + Q_EMIT retryUpdateCheckLater(); return; } @@ -264,6 +271,7 @@ void OCUpdater::slotVersionInfoArrived() } else { qCWarning(lcUpdater) << "Could not parse update information."; setDownloadState(OCUpdater::Unknown); + Q_EMIT retryUpdateCheckLater(); } } diff --git a/src/gui/updater/ocupdater.h b/src/gui/updater/ocupdater.h index c97b70948..28965c7c9 100644 --- a/src/gui/updater/ocupdater.h +++ b/src/gui/updater/ocupdater.h @@ -72,7 +72,16 @@ public: UpdaterScheduler(QObject *parent); signals: + /** + * Show an update-related status message on the UI. + * @param title message title + * @param msg message content + */ void updaterAnnouncement(const QString &title, const QString &msg); + + /** + * Request restart of the entire application. Used when updating in the background to make the user use the new version after the update has finished. + */ void requestRestart(); private slots: @@ -115,8 +124,17 @@ public: signals: void downloadStateChanged(); void newUpdateAvailable(const QString &header, const QString &message); + + /** + * Request restart of the entire application. Used when updating in the background to make the user use the new version after the update has finished. + */ void requestRestart(); + /** + * Schedule retry of update check in the future. For use when an update failed previously due to a (temporary) problem which might be resolved in a reasonable amount of time. + */ + void retryUpdateCheckLater(); + public slots: // FIXME Maybe this should be in the NSISUpdater which should have been called WindowsUpdater void slotStartInstaller(); |