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()
32 if ( q->useFakeLocation() ) {
33 location = q->fakeLocation();
35 location = q->liveLocation();
38 emit locationChanged( location );
41 void GpsController::useLiveGps()
43 q->setUseFakeLocation( false );
45 emit locationChanged( q->liveLocation() );
48 void GpsController::useFakeGps( const QString &fakeLocationLabel )
50 qDebug() << "using fake gps (" << fakeLocationLabel << ")";
52 q->setFakeLocationLabel( fakeLocationLabel );
53 Location *fakeLocation = q->fakeLocation();
55 if ( fakeLocation == 0 ) {
56 qDebug() << "invalid fake location label; cannot use fake location";
59 q->setUseFakeLocation( true );
60 emit locationChanged( fakeLocation );