mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
24404a401d
commit
76d0763527
7 changed files with 84 additions and 9 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue