m_mapEngine->init();
m_ui->show();
- QSettings settings(DIRECTORY_NAME, FILE_NAME);
- QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
- QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
-
- // set features on / off based on settings
- changeAutoCenteringSetting(autoCenteringEnabled.toBool());
- enableGPS(gpsEnabled.toBool());
-
- // show messages at startup if features are enabled automatically
- if (gpsEnabled.toBool())
- m_ui->showMaemoInformationBox(tr("GPS enabled"));
- if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
- m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
+ initializeGpsAndAutocentering();
m_facebookAuthenticator->start();
}
m_ui->setUsername(m_facebookAuthenticator->loadUsername());
}
+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
+
+ 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";
+ }
+
+ 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";
+ }
+}
+
void SituareEngine::loginOk(bool freshLogin)
{
qDebug() << __PRETTY_FUNCTION__;