comparison ui/mainwindow.cpp @ 1334:5c6294c201c2

(issue170) Add delay for update checking
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 16 Oct 2014 09:53:35 +0200
parents dd3eefda8503
children 64f812a63de6
comparison
equal deleted inserted replaced
1333:5d7b1650de1f 1334:5c6294c201c2
49 49
50 // The amount of time in minutes stay silent if we have 50 // The amount of time in minutes stay silent if we have
51 // something to say 51 // something to say
52 #define NAG_INTERVAL_MINUTES 70 52 #define NAG_INTERVAL_MINUTES 70
53 53
54 /** @def The interval in which the update check in tray mode is placed
55 *
56 * The interval should be given in minutes. The first update check will
57 * be placed randomly inside this interval. */
58 #define FIRST_CHECK_INTERVAL_MINUTES 180
59
54 #define DATETIME_FORMAT "d. MMM yyyy HH:mm" 60 #define DATETIME_FORMAT "d. MMM yyyy HH:mm"
55 61
56 #ifndef APPNAME 62 #ifndef APPNAME
57 #define APPNAME "TrustBridge" 63 #define APPNAME "TrustBridge"
58 #endif 64 #endif
115 121
116 mMessageTimer = new QTimer(this); 122 mMessageTimer = new QTimer(this);
117 connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage())); 123 connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage()));
118 mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000); 124 mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000);
119 mMessageTimer->start(); 125 mMessageTimer->start();
120 checkUpdates(); 126 if (trayMode) {
127 /* Place the first update in a random interval in the first 3h
128 * after start. */
129 QTimer::singleShot(qrand() % (FIRST_CHECK_INTERVAL_MINUTES * 60 * 1000), this, SLOT(checkUpdates()));
130 } else {
131 checkUpdates();
132 }
121 loadUnselectedCertificates(); 133 loadUnselectedCertificates();
122 loadCertificateList(); 134 loadCertificateList();
123 135
124 if (mSettings.value("ShowOnNextStart").toBool()) { 136 if (mSettings.value("ShowOnNextStart").toBool()) {
125 mSettings.remove("ShowOnNextStart"); 137 mSettings.remove("ShowOnNextStart");

http://wald.intevation.org/projects/trustbridge/