qtmobility/examples/sensors/panorama/timedcontroller.cpp
changeset 11 06b8e2af4411
child 14 6fbed849b4f4
equal deleted inserted replaced
8:71781823f776 11:06b8e2af4411
       
     1 
       
     2 
       
     3 #include "inputcontroller.h"
       
     4 #include "timedcontroller.h"
       
     5 #include <QTime>
       
     6 #include <QDebug>
       
     7 
       
     8 TimedController::TimedController( ): m_delay(10){ m_exTime = QTime::currentTime(); }
       
     9 
       
    10 void TimedController::startTimer()
       
    11 {
       
    12     m_timer.setSingleShot(false);
       
    13     m_timer.start(m_delay);
       
    14     connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleTimedUpdate()));
       
    15 }
       
    16 
       
    17 void TimedController::stopTimer(){ m_timer.stop();}
       
    18 
       
    19 
       
    20 void TimedController::handleTimedUpdate()
       
    21 {
       
    22     int timeDiff = m_exTime.msecsTo(QTime::currentTime());
       
    23     if (timeDiff<  m_delay) return;
       
    24     updateCoordinates();
       
    25     m_exTime = QTime::currentTime();
       
    26 }
       
    27 
       
    28 
       
    29 void TimedController::updateCoordinates(){}
       
    30