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
{
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"));
}
}
}
}
+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__;
* @return QGraphicsScene
*/
QGraphicsScene* scene();
+ void setZoomLevel(const int newZoomLevel);
/**
* @brief Return tile path created from tile values.
*
* @param latLonCoordinate Latitude & longitude coordinates for location
*/
- void setViewLocation(QPointF latLonCoordinate);
+ void setViewLocation(QPointF latLonCoordinate);
/**
* @brief Slot for view resizing.