examples/sensors/panoramaWithSense/timedcontroller.cpp
changeset 5 603d3f8b6302
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/sensors/panoramaWithSense/timedcontroller.cpp	Mon Oct 04 01:37:06 2010 +0300
@@ -0,0 +1,36 @@
+
+
+#include "timedcontroller.h"
+
+TimedController::TimedController(): m_delay(10), m_interval(0){
+    m_exTime = QTime::currentTime();
+    m_exTimestamp =QTime::currentTime();
+    m_timer.setSingleShot(false);
+    doStart();
+}
+
+TimedController::~TimedController(){
+    doStop();
+}
+
+
+void TimedController::handleTimedUpdate()
+{
+    int timeDiff = m_exTime.msecsTo(QTime::currentTime());
+    if (timeDiff<  m_delay) return;
+    updateCoordinates();
+    m_exTime = QTime::currentTime();
+}
+
+
+
+void TimedController::doStart(){
+    m_timer.start(m_delay);
+    connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleTimedUpdate()));
+}
+
+
+void TimedController::doStop(){
+    disconnect(&m_timer);
+    m_timer.stop();
+}