{
qDebug() << __PRETTY_FUNCTION__;
- m_ui->setGPSButtonEnabled(enabled);
- m_mapEngine->setGPSEnabled(enabled);
+ if (m_gps->isInitialized()) {
+ m_ui->setGPSButtonEnabled(enabled);
+ m_mapEngine->setGPSEnabled(enabled);
- if (enabled && !m_gps->isRunning()) {
- m_gps->start();
- enableAutoCentering(m_autoCenteringEnabled);
- m_gps->requestLastPosition();
+ if (enabled && !m_gps->isRunning()) {
+ m_gps->start();
+ enableAutoCentering(m_autoCenteringEnabled);
+ m_gps->requestLastPosition();
- if (!m_automaticUpdateEnabled && m_loggedIn)
- m_ui->requestAutomaticLocationUpdateSettings();
+ if (!m_automaticUpdateEnabled && m_loggedIn)
+ m_ui->requestAutomaticLocationUpdateSettings();
+ }
+ else if (!enabled && m_gps->isRunning()) {
+ m_gps->stop();
+ enableAutoCentering(false);
+ enableAutomaticLocationUpdate(false);
+ }
}
- else if (!enabled && m_gps->isRunning()) {
- m_gps->stop();
- enableAutoCentering(false);
- enableAutomaticLocationUpdate(false);
+ else {
+ if (enabled)
+ m_ui->buildInformationBox(tr("Unable to start GPS"));
+ m_ui->setGPSButtonEnabled(false);
+ m_mapEngine->setGPSEnabled(false);
}
}
QSettings settings(DIRECTORY_NAME, FILE_NAME);
QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
- QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
-
- if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
+ QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
- connect(m_gps, SIGNAL(position(QPointF,qreal)),
- this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+ if (m_gps->isInitialized()) {
- changeAutoCenteringSetting(true);
- enableGPS(true);
+ if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
- m_ui->buildInformationBox(tr("GPS enabled"));
- m_ui->buildInformationBox(tr("Auto centering enabled"));
+ connect(m_gps, SIGNAL(position(QPointF,qreal)),
+ this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
- } else { // Normal start
- changeAutoCenteringSetting(autoCenteringEnabled.toBool());
- enableGPS(gpsEnabled.toBool());
+ changeAutoCenteringSetting(true);
+ enableGPS(true);
- if (gpsEnabled.toBool())
m_ui->buildInformationBox(tr("GPS enabled"));
-
- if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
m_ui->buildInformationBox(tr("Auto centering enabled"));
+
+ } else { // Normal start
+ changeAutoCenteringSetting(autoCenteringEnabled.toBool());
+ enableGPS(gpsEnabled.toBool());
+
+ if (gpsEnabled.toBool())
+ m_ui->buildInformationBox(tr("GPS enabled"));
+
+ if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
+ m_ui->buildInformationBox(tr("Auto centering enabled"));
+ }
+ } else {
+ enableGPS(false);
}
}