backup
authorVille Tiensuu <ville.tiensuu@ixonos.com>
Tue, 25 May 2010 09:31:57 +0000 (12:31 +0300)
committerVille Tiensuu <ville.tiensuu@ixonos.com>
Tue, 25 May 2010 09:31:57 +0000 (12:31 +0300)
src/common.h
src/engine/engine.cpp
src/map/mapengine.cpp
src/map/mapengine.h

index 9c295f1..9ba88cb 100644 (file)
@@ -34,4 +34,6 @@ const QColor COLOR_GRAY = QColor(152, 152, 152);                           ///<
 const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal);    ///< Normal font
 const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal);     ///< Small font
 
+const int DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE = 12; ///< Default zoom level when GPS available
+
 #endif // COMMON_H
index cc24ab5..bff6d27 100644 (file)
@@ -159,31 +159,27 @@ void SituareEngine::initializeGpsAndAutocentering()
 {
     QSettings settings(DIRECTORY_NAME, FILE_NAME);
     QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
-    QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
-
-    qWarning() << "State of GPS: " << gpsEnabled.toString() << "boolina: " << gpsEnabled.toBool();
-
-     // set features on / off based on settings
+    QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);     
 
     if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
         changeAutoCenteringSetting(true);
         enableGPS(true);
+
         m_ui->showMaemoInformationBox(tr("GPS enabled"));
         m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
-        //settings.setValue(SETTINGS_GPS_ENABLED, true);
-        //settings.setValue(SETTINGS_AUTO_CENTERING_ENABLED, true);
-        //set zoom level
-        qWarning() << "first start";
+
+        m_mapEngine->setZoomLevel(DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE);
     }
 
     else { // Normal start
         changeAutoCenteringSetting(autoCenteringEnabled.toBool());
         enableGPS(gpsEnabled.toBool());
+
         if (gpsEnabled.toBool())
             m_ui->showMaemoInformationBox(tr("GPS enabled"));
+
         if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
-            m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
-        qWarning() << "normal start";
+            m_ui->showMaemoInformationBox(tr("Auto centering enabled"));        
     } 
 }
 
index ca2e42d..c30f263 100644 (file)
@@ -343,6 +343,17 @@ void MapEngine::setLocation(QPoint sceneCoordinate)
     }
 }
 
+void MapEngine::setZoomLevel(int newZoomLevel)
+{
+    if (newZoomLevel >= MIN_MAP_ZOOM_LEVEL && newZoomLevel <= MAX_MAP_ZOOM_LEVEL) {
+        while (newZoomLevel > m_zoomLevel)
+            zoomIn();
+
+        while (newZoomLevel < m_zoomLevel)
+            zoomOut();
+    }
+}
+
 void MapEngine::setViewLocation(QPointF latLonCoordinate)
 {
     qDebug() << __PRETTY_FUNCTION__;
index e80061a..131a9fc 100644 (file)
@@ -126,6 +126,7 @@ public:
     * @return QGraphicsScene
     */
     QGraphicsScene* scene();
+    void setZoomLevel(const int newZoomLevel);
 
     /**
     * @brief Return tile path created from tile values.
@@ -175,7 +176,7 @@ public slots:
     *
     * @param latLonCoordinate Latitude & longitude coordinates for location
     */
-    void setViewLocation(QPointF latLonCoordinate);
+    void setViewLocation(QPointF latLonCoordinate);    
 
     /**
     * @brief Slot for view resizing.