1 #include "gpscontroller.h"
2 #include "gpscontroller_p.h"
7 #include <QGeoPositionInfo>
8 #include <QGeoPositionInfoSource>
11 GpsController::GpsController() :
12 q( new GpsControllerPrivate() )
18 GpsController::GpsController( GpsControllerPrivate *gpsControllerPrivate ) :
19 q( gpsControllerPrivate )
25 GpsController::~GpsController()
30 void GpsController::getGps()
34 if ( q->useFakeLocation() ) {
35 Locations *locations = Locations::instance();
36 location = locations->location( q->fakeLocationLabel() );
38 location = q->liveLocation();
41 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 Locations *locations = Locations::instance();
56 Location *fakeLocation = locations->location( fakeLocationLabel );
58 if ( fakeLocation == 0 ) {
59 qDebug() << "invalid fake location label; cannot use fake location";
62 q->setUseFakeLocation( true );
63 q->setFakeLocationLabel( fakeLocationLabel );
64 emit locationChanged( fakeLocation );