Allow compilation against Qt < 4.7 again
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 27 Jan 2013 21:35:33 +0000 (22:35 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 27 Jan 2013 21:35:33 +0000 (22:35 +0100)
Looks like I recently introduced the use of some QDateTime stuff that appeared
in Qt 4.7. Let's use the old way of calculating the lag then if built against older
Qt...

Oh, also this fixes that we would show double the lag.

src/common/remoteconnection.cpp

index 1ce29d4..26a9335 100644 (file)
@@ -166,7 +166,11 @@ void RemoteConnection::handle(const HeartBeat &heartBeat)
 void RemoteConnection::handle(const HeartBeatReply &heartBeatReply)
 {
     _heartBeatCount = 0;
-    emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTimeUtc()));
+#if QT_VERSION < 0x040700
+    emit lagUpdated(heartBeatReply.timestamp().time().msecsTo(QTime::currentTime()) / 2);
+#else
+    emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTime()) / 2);
+#endif
 }
 
 
@@ -185,7 +189,7 @@ void RemoteConnection::sendHeartBeat()
         emit lagUpdated(_lag);
     }
 
-    dispatch(HeartBeat(QDateTime::currentDateTimeUtc()));
+    dispatch(HeartBeat(QDateTime::currentDateTime()));
     ++_heartBeatCount;
 }