[PATCH 1 of 2] (issue170) Add delay for update checking
Wald Commits
scm-commit at wald.intevation.org
Thu Oct 16 09:53:54 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1413446015 -7200
# Node ID 5c6294c201c255dd060c3979a90f583b170232c9
# Parent 5d7b1650de1f9d63acd3d6abd91178f479eedd48
(issue170) Add delay for update checking
diff -r 5d7b1650de1f -r 5c6294c201c2 ui/mainwindow.cpp
--- a/ui/mainwindow.cpp Wed Oct 15 15:40:27 2014 +0200
+++ b/ui/mainwindow.cpp Thu Oct 16 09:53:35 2014 +0200
@@ -51,6 +51,12 @@
// something to say
#define NAG_INTERVAL_MINUTES 70
+/** @def The interval in which the update check in tray mode is placed
+ *
+ * The interval should be given in minutes. The first update check will
+ * be placed randomly inside this interval. */
+#define FIRST_CHECK_INTERVAL_MINUTES 180
+
#define DATETIME_FORMAT "d. MMM yyyy HH:mm"
#ifndef APPNAME
@@ -117,7 +123,13 @@
connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage()));
mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000);
mMessageTimer->start();
- checkUpdates();
+ if (trayMode) {
+ /* Place the first update in a random interval in the first 3h
+ * after start. */
+ QTimer::singleShot(qrand() % (FIRST_CHECK_INTERVAL_MINUTES * 60 * 1000), this, SLOT(checkUpdates()));
+ } else {
+ checkUpdates();
+ }
loadUnselectedCertificates();
loadCertificateList();
More information about the Trustbridge-commits
mailing list