aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/gpslocation.cpp10
-rw-r--r--core/gpslocation.h1
2 files changed, 10 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");
diff --git a/core/gpslocation.h b/core/gpslocation.h
index 9922997f1..efb1b34df 100644
--- a/core/gpslocation.h
+++ b/core/gpslocation.h
@@ -33,6 +33,7 @@ public:
QString getUserid(QString user, QString passwd);
bool hasLocationsSource();
QString currentPosition();
+ void setGpsTimeThreshold(int seconds);
QMap<qint64, gpsTracker> currentGPSInfo() const;