1 #include "gpscontroller_p.h"
7 #include <QGeoPositionInfo>
8 #include <QGeoPositionInfoSource>
13 GpsControllerPrivate::GpsControllerPrivate() :
15 m_liveLocation( new Location( "livegps" ) ),
16 m_fakeLocationLabel(),
17 m_useFakeLocation(false)
21 GpsControllerPrivate::~GpsControllerPrivate()
25 delete m_liveLocation;
29 void GpsControllerPrivate::init()
31 m_gps = QGeoPositionInfoSource::createDefaultSource(this);
33 m_gps, SIGNAL( positionUpdated( QGeoPositionInfo ) ),
34 this, SLOT( updateLocation( QGeoPositionInfo ) )
38 void GpsControllerPrivate::startGps()
40 m_gps->startUpdates();
43 void GpsControllerPrivate::stopGps()
48 QGeoPositionInfoSource *GpsControllerPrivate::gps()
53 void GpsControllerPrivate::setGps( QGeoPositionInfoSource *gps )
58 Location *GpsControllerPrivate::liveLocation()
60 return m_liveLocation;
63 Location *GpsControllerPrivate::fakeLocation()
65 Locations *locations = Locations::instance();
66 Location *location = locations->location( fakeLocationLabel() );
70 QString GpsControllerPrivate::fakeLocationLabel()
72 return m_fakeLocationLabel;
75 void GpsControllerPrivate::setFakeLocationLabel( const QString &label )
77 m_fakeLocationLabel = label;
80 bool GpsControllerPrivate::useFakeLocation()
82 return m_useFakeLocation;
85 void GpsControllerPrivate::setUseFakeLocation( bool useFake )
87 m_useFakeLocation = useFake;
90 void GpsControllerPrivate::updateLocation( QGeoPositionInfo positionInfo )
92 m_liveLocation->setLocation( positionInfo );