Modified MainWindow auto centering toggling.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Tue, 11 May 2010 12:27:56 +0000 (15:27 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Tue, 11 May 2010 12:27:56 +0000 (15:27 +0300)
src/gps/gpsposition.cpp
src/gps/gpsposition.h
src/ui/mainwindow.cpp

index 3c992ca..f650101 100644 (file)
@@ -105,3 +105,11 @@ void GPSPosition::updateTimeout()
 
     emit timeout();
 }
+
+void GPSPosition::setUpdateInterval(int interval)
+{
+    if (m_updateInterval != interval) {
+        m_updateInterval = interval;
+        m_gpsSource->setUpdateInterval(m_updateInterval);
+    }
+}
index 15aa158..d433fa7 100644 (file)
@@ -38,9 +38,15 @@ class GPSPosition : public QObject
 
 public:
     /**
-    * @brief Start GPS.
+    * @brief Constructor creates GPS source.
+    *
+    * @param parent QObject
     */
     GPSPosition(QObject *parent = 0);
+
+    /**
+    * @brief Destructor stops GPS.
+    */
     ~GPSPosition();
 
 /******************************************************************************
@@ -55,6 +61,13 @@ public:
     bool isRunning();
 
     /**
+    * @brief Set GPS update interval
+    *
+    * @return interval interval in milliseconds
+    */
+    void setUpdateInterval(int interval);
+
+    /**
     * @brief Start GPS.
     */
     void start();
@@ -64,11 +77,6 @@ public:
     */
     void stop();
 
-    /**
-    * @brief Request GPS update.
-    */
-    void update();
-
 private slots:
 
     /**
@@ -79,6 +87,11 @@ private slots:
     void positionUpdated(QGeoPositionInfo positionInfo);
 
     /**
+    * @brief Slot for GPS update request.
+    */
+    void update();
+
+    /**
     * @brief Slot for update timeout.
     *
     * Called when request timeout occurs.
index 0982eb2..3722f68 100644 (file)
@@ -189,15 +189,13 @@ void MainWindow::gpsActionToggled(bool checked)
         emit enableGPS(true);
         m_gpsToggleAct->setText(tr("GPS enabled"));
         showMaemoInformationBox(tr("GPS enabled"));
-        m_autoCenteringAct->setEnabled(true);
-        autoCenteringToggled(true);
+        m_autoCenteringAct->setVisible(true);
     }
     else {
         emit enableGPS(false);
         m_gpsToggleAct->setText(tr("GPS disabled"));
         showMaemoInformationBox(tr("GPS disabled"));
-        m_autoCenteringAct->setEnabled(false);
-        autoCenteringToggled(false);
+        m_autoCenteringAct->setVisible(false);
 
     }
 }