X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=zouba%2Fgpscontroller.cpp;fp=zouba%2Fgpscontroller.cpp;h=932c0cfe025165a1eb2147973f80ce21114875c1;hb=5614aafa30d804dfe692671003d9d94f3b3dd182;hp=0000000000000000000000000000000000000000;hpb=0e395576fcb11ccf19ebf6a936a07607bb3c821d;p=ptas diff --git a/zouba/gpscontroller.cpp b/zouba/gpscontroller.cpp new file mode 100644 index 0000000..932c0cf --- /dev/null +++ b/zouba/gpscontroller.cpp @@ -0,0 +1,43 @@ +#include "gpscontroller.h" + +#include +#include +#include +#include + +QTM_USE_NAMESPACE + +GpsController::~GpsController() +{ + qDebug() << __PRETTY_FUNCTION__; + delete m_location; + m_location = 0; +} + +GpsController::GpsController() : + m_location( QGeoPositionInfoSource::createDefaultSource(this) ) +{ + qDebug() << __PRETTY_FUNCTION__; + m_location->setUpdateInterval( 1*60*1000 ); + + connect( + m_location, SIGNAL( positionUpdated( QGeoPositionInfo ) ), + this, SLOT( updateLocation( QGeoPositionInfo ) ) + ); + + m_location->stopUpdates(); +} + +void GpsController::updateLocation( QGeoPositionInfo positionInfo ) +{ + qDebug() << __PRETTY_FUNCTION__; + Location newLocation( positionInfo ); + + emit locationChanged( newLocation ); +} + +void GpsController::startGps() +{ + qDebug() << __PRETTY_FUNCTION__; + m_location->startUpdates(); +}