Changed package description to indicate Helsinki only
[ptas] / zouba / src / gpscontroller.cpp
1 #include "gpscontroller.h"
2 #include "gpscontroller_p.h"
3
4 #include <QObject>
5 #include <QGeoPositionInfo>
6 #include <QGeoPositionInfoSource>
7 #include <QDebug>
8
9 GpsController::GpsController() :
10   q( new GpsControllerPrivate() )
11 {
12   q->init();
13   q->startGps();
14 }
15
16 GpsController::GpsController( GpsControllerPrivate *gpsControllerPrivate ) :
17   q( gpsControllerPrivate )
18 {
19   q->init();
20   q->startGps();
21 }
22
23 GpsController::~GpsController()
24 {
25   delete q;
26 }
27
28 void GpsController::getGps()
29 {
30   if ( q->currentLocation() != 0 ) {
31     emit locationChanged( q->currentLocation() );
32   }
33 }
34
35 void GpsController::useLiveGps()
36 {
37   q->setUseFakeLocation( false );
38   q->setCurrentLocation( new Location( "livegps" ) );
39   q->startGps();
40 }
41
42 void GpsController::useFakeGps( Location *fakeLocation )
43 {
44   qDebug() << "using fake gps (" << fakeLocation->label() << ")";
45   q->stopGps();
46   q->setUseFakeLocation( true );
47   q->setCurrentLocation( fakeLocation );
48   emit locationChanged( q->currentLocation() );
49 }