X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=zouba%2Fsrc%2Fgpscontroller.cpp;h=e924da56c2d6d3528839d31ebe9cdc1baee92c11;hb=dc139290c3f16ad5d162defc0815c64da4f64d98;hp=3ca884713e7b11e86bfa4ed7df6c67cd8dfeb914;hpb=effa33c0d462b151f3027c22570539bafbc2a3c0;p=ptas diff --git a/zouba/src/gpscontroller.cpp b/zouba/src/gpscontroller.cpp index 3ca8847..e924da5 100644 --- a/zouba/src/gpscontroller.cpp +++ b/zouba/src/gpscontroller.cpp @@ -1,58 +1,48 @@ #include "gpscontroller.h" +#include "gpscontroller_p.h" #include #include #include #include -QTM_USE_NAMESPACE - GpsController::GpsController() : - m_location( QGeoPositionInfoSource::createDefaultSource(this) ), - m_currentLocation(0), - m_useFakeLocation(false) + q( new GpsControllerPrivate() ) { - connect( - m_location, SIGNAL( positionUpdated( QGeoPositionInfo ) ), - this, SLOT( updateLocation( QGeoPositionInfo ) ) - ); - - m_location->startUpdates(); + q->init(); + q->startGps(); } -GpsController::~GpsController() +GpsController::GpsController( GpsControllerPrivate *gpsControllerPrivate ) : + q( gpsControllerPrivate ) { - delete m_location; - m_location = 0; - delete m_currentLocation; - m_currentLocation = 0; + q->init(); + q->startGps(); } -void GpsController::updateLocation( QGeoPositionInfo positionInfo ) +GpsController::~GpsController() { - delete m_currentLocation; - m_currentLocation = new Location( positionInfo ); + delete q; } void GpsController::getGps() { - if ( m_currentLocation != 0 ) { - emit locationChanged( m_currentLocation ); + if ( q->currentLocation() != 0 ) { + emit locationChanged( q->currentLocation() ); } } void GpsController::useLiveGps() { - m_location->startUpdates(); - m_useFakeLocation=false; - m_currentLocation=0; + q->setUseFakeLocation( false ); + q->setCurrentLocation(0); + q->startGps(); } void GpsController::useFakeGps( Location *fakeLocation ) { - m_location->stopUpdates(); - m_useFakeLocation=true; - delete m_currentLocation; - m_currentLocation = new Location( *fakeLocation ); - emit locationChanged( m_currentLocation ); + q->stopGps(); + q->setUseFakeLocation( true ); + q->setCurrentLocation( fakeLocation ); + emit locationChanged( q->currentLocation() ); }