1 #include "gpscontroller_p.h"
6 #include <QGeoPositionInfo>
7 #include <QGeoPositionInfoSource>
12 GpsControllerPrivate::GpsControllerPrivate() :
15 m_useFakeLocation(false)
19 GpsControllerPrivate::~GpsControllerPrivate()
23 delete m_currentLocation;
24 m_currentLocation = 0;
27 void GpsControllerPrivate::init()
29 m_gps = QGeoPositionInfoSource::createDefaultSource(this);
31 m_gps, SIGNAL( positionUpdated( QGeoPositionInfo ) ),
32 this, SLOT( updateLocation( QGeoPositionInfo ) )
36 void GpsControllerPrivate::startGps()
38 m_gps->startUpdates();
41 void GpsControllerPrivate::stopGps()
46 QGeoPositionInfoSource *GpsControllerPrivate::gps()
51 void GpsControllerPrivate::setGps( QGeoPositionInfoSource *gps )
56 Location *GpsControllerPrivate::currentLocation()
58 return m_currentLocation;
61 void GpsControllerPrivate::setCurrentLocation( Location *location )
63 delete m_currentLocation;
64 m_currentLocation = location;
67 bool GpsControllerPrivate::useFakeLocation()
69 return m_useFakeLocation;
72 void GpsControllerPrivate::setUseFakeLocation( bool useFake )
74 m_useFakeLocation = useFake;
77 void GpsControllerPrivate::updateLocation( QGeoPositionInfo positionInfo )
79 if ( !m_useFakeLocation ) {
80 delete m_currentLocation;
81 m_currentLocation = new Location( positionInfo );