Reviewed by: Sami Rämö.
m_automaticUpdateIntervalTimer = new QTimer(this);
connect(m_automaticUpdateIntervalTimer, SIGNAL(timeout()),
- this, SLOT(automaticUpdateIntervalTimerTimeout()));
+ this, SLOT(startAutomaticUpdate()));
// signals connected, now it's time to show the main window
// but init the MapEngine before so starting location is set
initializeGpsAndAutocentering();
m_mce = new MCE(this);
- connect(m_mce, SIGNAL(displayOn(bool)), this, SLOT(displayOn(bool)));
+ connect(m_mce, SIGNAL(displayStateChanged(bool)), this, SLOT(displayStateChanged(bool)));
}
SituareEngine::~SituareEngine()
settings.setValue(SETTINGS_AUTO_CENTERING_ENABLED, m_autoCenteringEnabled);
}
-void SituareEngine::automaticUpdateIntervalTimerTimeout()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_gps->requestUpdate();
- m_automaticUpdateRequest = true;
-}
-
void SituareEngine::changeAutoCenteringSetting(bool enabled)
{
qDebug() << __PRETTY_FUNCTION__;
m_ui->buildInformationBox(tr("Auto centering disabled"));
}
-void SituareEngine::displayOn(bool on)
+void SituareEngine::displayStateChanged(bool enabled)
{
qDebug() << __PRETTY_FUNCTION__;
- m_gps->enablePowerSave(!on);
+ m_gps->enablePowerSave(!enabled);
if (m_autoCenteringEnabled)
- enableAutoCentering(on);
+ enableAutoCentering(enabled);
}
void SituareEngine::enableAutoCentering(bool enabled)
m_ui, SIGNAL(clearUpdateLocationDialogData()));
}
+void SituareEngine::startAutomaticUpdate()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_gps->requestUpdate();
+ m_automaticUpdateRequest = true;
+}
+
void SituareEngine::updateWasSuccessful()
{
qDebug() << __PRETTY_FUNCTION__;
private slots:
/**
- * @brief Automatic update interval timer timeout.
- *
- * Requests update location if user has moved.
- */
- void automaticUpdateIntervalTimerTimeout();
-
- /**
* @brief Set auto centering feature enabled / disabled
*
* @param enabled true if enabled, false otherwise
void disableAutoCentering();
/**
+ * @brief Slot for display state changed.
+ *
+ * @param enabled true if enabled, false otherwise
+ */
+ void displayStateChanged(bool enabled);
+
+ /**
* @brief Slot for auto centering enabling.
*
* Calls gps to send last known position
void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs = 0);
/**
- * @brief Slot for display on.
+ * @brief Requests automatic update.
*
- * @param on true if on, false otherwise
+ * Makes automatic location update request if user has moved enough.
+ *
+ * @param position geo coordinates
*/
- void displayOn(bool on);
+ void requestAutomaticUpdateIfMoved(QPointF position);
/**
* @brief Sets zoom level to default when first GPS location is received if autocentering
void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
/**
- * @brief Requests automatic update.
- *
- * Makes automatic location update request if user has moved enough.
+ * @brief Automatic update interval timer timeout.
*
- * @param position geo coordinates
+ * Requests update location if user has moved.
*/
- void requestAutomaticUpdateIfMoved(QPointF position);
+ void startAutomaticUpdate();
/*******************************************************************************
* SIGNALS
{
qDebug() << __PRETTY_FUNCTION__;
- m_gpsPositionPrivate->enablePowerSave(enabled);
+ m_gpsPositionPrivate->setPowerSave(enabled);
}
bool GPSPosition::isInitialized()
m_parent = static_cast<GPSPosition*>(parent);
}
-void GPSPositionPrivate::enablePowerSave(bool enabled)
+void GPSPositionPrivate::setPowerSave(bool enabled)
{
qDebug() << __PRETTY_FUNCTION__;
}
******************************************************************************/
public:
/**
- * @brief Enables power save mode.
- *
- * Starts GPS for position update and then stops it.
- */
- void enablePowerSave(bool enabled);
-
- /**
* @brief Returns is GPS initialized.
*
* @return true if initialized, false otherwise
void setMode(GPSPosition::Mode mode, const QString &filePath = 0);
/**
+ * @brief Sets power save mode.
+ *
+ * Starts GPS for position update and then stops it.
+ */
+ void setPowerSave(bool enabled);
+
+ /**
* @brief Set GPS update interval
*
* @return interval interval in milliseconds
m_liblocationWrapper->stopUpdates();
}
-void GPSPositionPrivate::enablePowerSave(bool enabled)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if (isRunning()) {
- if (enabled) {
- m_delayedPowerSaveTimer->start();
- } else {
- m_powerSave = false;
- m_delayedPowerSaveTimer->stop();
- m_liblocationWrapper->startUpdates();
- }
- }
- else {
- m_powerSave = false;
- }
-}
-
bool GPSPositionPrivate::isInitialized()
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void GPSPositionPrivate::setPowerSave(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (isRunning()) {
+ if (enabled) {
+ m_delayedPowerSaveTimer->start();
+ } else {
+ m_powerSave = false;
+ m_delayedPowerSaveTimer->stop();
+ m_liblocationWrapper->startUpdates();
+ }
+ }
+ else {
+ m_powerSave = false;
+ }
+}
+
void GPSPositionPrivate::start()
{
qDebug() << __PRETTY_FUNCTION__;
******************************************************************************/
public:
/**
- * @brief Enables power save mode.
- *
- * Starts GPS for position update and then stops it.
- */
- void enablePowerSave(bool enabled);
-
- /**
* @brief Returns is GPS initialized.
*
* @return true if initialized, false otherwise
void setMode(GPSPosition::Mode mode, const QString &filePath = 0);
/**
+ * @brief Sets power save mode.
+ *
+ * Starts GPS for position update and then stops it.
+ */
+ void setPowerSave(bool enabled);
+
+ /**
* @brief Set GPS update interval
*
* @return interval interval in milliseconds
qreal accuracy(const GeoPositionInfo &positionInfo);
private slots:
+ /**
+ * @brief Start power save.
+ */
void delayedPowerSaveStart();
/**