From c53e123868aa50539e6a513836d9922b99ea8e9a Mon Sep 17 00:00:00 2001 From: Max Waterman Date: Mon, 22 Mar 2010 07:21:56 +0200 Subject: [PATCH] Changed gpscontroller to just record the most recent gps coords, and give those when a button is pressed. --- zouba/gpscontroller.cpp | 9 +-------- zouba/gpscontroller.h | 4 +--- zouba/main.cpp | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/zouba/gpscontroller.cpp b/zouba/gpscontroller.cpp index c8226ac..33ba7e6 100644 --- a/zouba/gpscontroller.cpp +++ b/zouba/gpscontroller.cpp @@ -11,8 +11,6 @@ GpsController::GpsController() : m_location( QGeoPositionInfoSource::createDefaultSource(this) ), currentLocation(0) { - m_location->setUpdateInterval( 1*60*1000 ); - connect( m_location, SIGNAL( positionUpdated( QGeoPositionInfo ) ), this, SLOT( updateLocation( QGeoPositionInfo ) ) @@ -31,16 +29,11 @@ GpsController::~GpsController() void GpsController::updateLocation( QGeoPositionInfo positionInfo ) { - qDebug() << "new GPS position"; - delete currentLocation; currentLocation = new Location( positionInfo ); - - qDebug() << "from location changed"; - emit locationChanged( currentLocation ); } -void GpsController::startGps() +void GpsController::getGps() { if ( currentLocation != 0 ) { emit locationChanged( currentLocation ); diff --git a/zouba/gpscontroller.h b/zouba/gpscontroller.h index f220ce1..336d85c 100644 --- a/zouba/gpscontroller.h +++ b/zouba/gpscontroller.h @@ -18,11 +18,9 @@ public: ~GpsController(); - void stopGps(); - public Q_SLOTS: void updateLocation( QGeoPositionInfo positionInfo ); - void startGps(); + void getGps(); Q_SIGNALS: void locationChanged( Location *newLocation ); diff --git a/zouba/main.cpp b/zouba/main.cpp index b9ca3e6..62402e9 100644 --- a/zouba/main.cpp +++ b/zouba/main.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[] ) QObject::connect( uiController, SIGNAL( buttonClicked() ), - gpsController, SLOT( startGps() ) + gpsController, SLOT( getGps() ) ); mainWindow->show(); -- 1.7.9.5