mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:03:23 +00:00
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>
This commit is contained in:
parent
adb4b66a05
commit
fd03621a4b
3 changed files with 11 additions and 1 deletions
|
@ -56,6 +56,14 @@ GpsLocation::~GpsLocation()
|
||||||
m_Instance = NULL;
|
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()
|
QGeoPositionInfoSource *GpsLocation::getGpsSource()
|
||||||
{
|
{
|
||||||
if (haveSource == NOGPS)
|
if (haveSource == NOGPS)
|
||||||
|
@ -86,7 +94,7 @@ QGeoPositionInfoSource *GpsLocation::getGpsSource()
|
||||||
connect(m_GpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(newPosition(QGeoPositionInfo)));
|
connect(m_GpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(newPosition(QGeoPositionInfo)));
|
||||||
connect(m_GpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
|
connect(m_GpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
|
||||||
connect(m_GpsSource, SIGNAL(error(QGeoPositionInfoSource::Error)), this, SLOT(positionSourceError(QGeoPositionInfoSource::Error)));
|
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 {
|
} else {
|
||||||
#ifdef SUBSURFACE_MOBILE
|
#ifdef SUBSURFACE_MOBILE
|
||||||
status("don't have GPS source");
|
status("don't have GPS source");
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
QString getUserid(QString user, QString passwd);
|
QString getUserid(QString user, QString passwd);
|
||||||
bool hasLocationsSource();
|
bool hasLocationsSource();
|
||||||
QString currentPosition();
|
QString currentPosition();
|
||||||
|
void setGpsTimeThreshold(int seconds);
|
||||||
|
|
||||||
QMap<qint64, gpsTracker> currentGPSInfo() const;
|
QMap<qint64, gpsTracker> currentGPSInfo() const;
|
||||||
|
|
||||||
|
|
|
@ -1307,6 +1307,7 @@ int QMLManager::timeThreshold() const
|
||||||
void QMLManager::setTimeThreshold(int time)
|
void QMLManager::setTimeThreshold(int time)
|
||||||
{
|
{
|
||||||
m_timeThreshold = time;
|
m_timeThreshold = time;
|
||||||
|
locationProvider->setGpsTimeThreshold(m_timeThreshold * 60);
|
||||||
emit timeThresholdChanged();
|
emit timeThresholdChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue