aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/gpslocation.cpp10
-rw-r--r--core/gpslocation.h1
-rw-r--r--mobile-widgets/qmlmanager.cpp1
3 files changed, 11 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;
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index cc9b1356d..cb594a13d 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1307,6 +1307,7 @@ int QMLManager::timeThreshold() const
void QMLManager::setTimeThreshold(int time)
{
m_timeThreshold = time;
+ locationProvider->setGpsTimeThreshold(m_timeThreshold * 60);
emit timeThresholdChanged();
}