1 #include "gpscontroller.h"
4 #include <QGeoPositionInfo>
5 #include <QGeoPositionInfoSource>
10 GpsController::GpsController() :
11 m_location( QGeoPositionInfoSource::createDefaultSource(this) ),
14 m_location->setUpdateInterval( 1*60*1000 );
17 m_location, SIGNAL( positionUpdated( QGeoPositionInfo ) ),
18 this, SLOT( updateLocation( QGeoPositionInfo ) )
21 m_location->startUpdates();
24 GpsController::~GpsController()
28 delete currentLocation;
32 void GpsController::updateLocation( QGeoPositionInfo positionInfo )
34 qDebug() << "new GPS position";
36 delete currentLocation;
37 currentLocation = new Location( positionInfo );
39 qDebug() << "from location changed";
40 emit locationChanged( currentLocation );
43 void GpsController::startGps()
45 if ( currentLocation != 0 ) {
46 emit locationChanged( currentLocation );