1 #include "gpscontroller.h"
2 #include "gpscontroller_p.h"
5 #include <QGeoPositionInfo>
6 #include <QGeoPositionInfoSource>
9 GpsController::GpsController() :
10 q( new GpsControllerPrivate() )
16 GpsController::GpsController( GpsControllerPrivate *gpsControllerPrivate ) :
17 q( gpsControllerPrivate )
23 GpsController::~GpsController()
28 void GpsController::getGps()
31 Location *previousLocation = q->mostRecentlyReportedLocation();
33 if ( q->useFakeLocation() ) {
34 location = q->fakeLocation();
36 location = q->liveLocation();
39 if ( location != previousLocation ) {
40 emit locationChanged( location );
44 void GpsController::useLiveGps()
46 q->setUseFakeLocation( false );
48 emit locationChanged( q->liveLocation() );
51 void GpsController::useFakeGps( const QString &fakeLocationLabel )
53 qDebug() << "using fake gps (" << fakeLocationLabel << ")";
55 q->setFakeLocationLabel( fakeLocationLabel );
56 Location *fakeLocation = q->fakeLocation();
58 if ( fakeLocation == 0 ) {
59 qDebug() << "invalid fake location label; cannot use fake location";
62 q->setUseFakeLocation( true );
63 emit locationChanged( fakeLocation );