summaryrefslogtreecommitdiffstats
path: root/core/gpslocation.cpp
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-07-25 11:44:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-25 22:12:19 +0900
commitfd03621a4b1e82c218dddbc7e833838ef3fdf7be (patch)
treeba33425f62edc73f738e4f4c832560ce28b273b6 /core/gpslocation.cpp
parentadb4b66a055ca809b0a78c08f37d7feefe44e947 (diff)
downloadsubsurface-fd03621a4b1e82c218dddbc7e833838ef3fdf7be.tar.gz
Mobile: honour location service time threshold
Independ of the settings, the threshold to reset the GPS data was hard coded to 5 minutes. Now, honour the entered (and updated during a session) time to refresh the GPS data in the location service. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core/gpslocation.cpp')
-rw-r--r--core/gpslocation.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index 30b101419..a823a9124 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -56,6 +56,14 @@ GpsLocation::~GpsLocation()
m_Instance = NULL;
}
+void GpsLocation::setGpsTimeThreshold(int seconds)
+{
+ if (m_GpsSource) {
+ m_GpsSource->setUpdateInterval(seconds * 1000);
+ status(QString("Set GPS service update interval to %1").arg(m_GpsSource->updateInterval()));
+ }
+}
+
QGeoPositionInfoSource *GpsLocation::getGpsSource()
{
if (haveSource == NOGPS)
@@ -86,7 +94,7 @@ QGeoPositionInfoSource *GpsLocation::getGpsSource()
connect(m_GpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(newPosition(QGeoPositionInfo)));
connect(m_GpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
connect(m_GpsSource, SIGNAL(error(QGeoPositionInfoSource::Error)), this, SLOT(positionSourceError(QGeoPositionInfoSource::Error)));
- m_GpsSource->setUpdateInterval(5 * 60 * 1000); // 5 minutes so the device doesn't drain the battery
+ setGpsTimeThreshold(prefs.time_threshold);
} else {
#ifdef SUBSURFACE_MOBILE
status("don't have GPS source");