summaryrefslogtreecommitdiffstats
path: root/qt-mobile/gpslocation.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-14 09:10:06 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-14 09:10:06 -0800
commit76d07635270bb3068b7d9a559b481d3c094f0d7b (patch)
treecd507fe34e03b8c5cc2c10e9d991a50f44635d9e /qt-mobile/gpslocation.cpp
parent24404a401d5a21134b153000fffc74bd429a0631 (diff)
downloadsubsurface-76d07635270bb3068b7d9a559b481d3c094f0d7b.tar.gz
Location service: make distance and time threshold configurable
Right now the distance is always in meters, the mobile app doesn't deal with units at all, anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/gpslocation.cpp')
-rw-r--r--qt-mobile/gpslocation.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/qt-mobile/gpslocation.cpp b/qt-mobile/gpslocation.cpp
index fc9767c65..02b211631 100644
--- a/qt-mobile/gpslocation.cpp
+++ b/qt-mobile/gpslocation.cpp
@@ -43,10 +43,6 @@ void GpsLocation::serviceEnable(bool toggle)
}
}
-// these two need to become configurable
-#define MINTIME 600
-#define MINDIST 200
-
void GpsLocation::newPosition(QGeoPositionInfo pos)
{
time_t lastTime;
@@ -61,7 +57,9 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
}
// if we have no record stored or if at least the configured minimum
// time has passed or we moved at least the configured minimum distance
- if (!nr || pos.timestamp().toTime_t() > lastTime + MINTIME || lastCoord.distanceTo(pos.coordinate()) > MINDIST) {
+ if (!nr ||
+ pos.timestamp().toTime_t() > lastTime + prefs.time_threshold ||
+ lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
geoSettings->setValue("count", nr + 1);
geoSettings->setValue(QString("gpsFix%1_time").arg(nr), pos.timestamp().toTime_t());
geoSettings->setValue(QString("gpsFix%1_lat").arg(nr), rint(pos.coordinate().latitude() * 1000000));