X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=zouba%2Fsrc%2Fgpscontroller.cpp;h=3ca884713e7b11e86bfa4ed7df6c67cd8dfeb914;hb=93c6dfe0c9a31745192d99e329acf791feb0b706;hp=33ba7e67ad95fb71b0152b5cdc13663a7310616a;hpb=60e0abb85c03e13a1d8704e9eac022eb73fb79fc;p=ptas diff --git a/zouba/src/gpscontroller.cpp b/zouba/src/gpscontroller.cpp index 33ba7e6..3ca8847 100644 --- a/zouba/src/gpscontroller.cpp +++ b/zouba/src/gpscontroller.cpp @@ -9,7 +9,8 @@ QTM_USE_NAMESPACE GpsController::GpsController() : m_location( QGeoPositionInfoSource::createDefaultSource(this) ), - currentLocation(0) + m_currentLocation(0), + m_useFakeLocation(false) { connect( m_location, SIGNAL( positionUpdated( QGeoPositionInfo ) ), @@ -23,19 +24,35 @@ GpsController::~GpsController() { delete m_location; m_location = 0; - delete currentLocation; - currentLocation = 0; + delete m_currentLocation; + m_currentLocation = 0; } void GpsController::updateLocation( QGeoPositionInfo positionInfo ) { - delete currentLocation; - currentLocation = new Location( positionInfo ); + delete m_currentLocation; + m_currentLocation = new Location( positionInfo ); } void GpsController::getGps() { - if ( currentLocation != 0 ) { - emit locationChanged( currentLocation ); + if ( m_currentLocation != 0 ) { + emit locationChanged( m_currentLocation ); } } + +void GpsController::useLiveGps() +{ + m_location->startUpdates(); + m_useFakeLocation=false; + m_currentLocation=0; +} + +void GpsController::useFakeGps( Location *fakeLocation ) +{ + m_location->stopUpdates(); + m_useFakeLocation=true; + delete m_currentLocation; + m_currentLocation = new Location( *fakeLocation ); + emit locationChanged( m_currentLocation ); +}