summaryrefslogtreecommitdiffstats
path: root/core/gpslocation.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-17 22:47:53 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-17 22:59:12 -0700
commitc0b44e25b730ffb839b019fa9e84a75a1b14aa12 (patch)
treeb330da761c14ef26e033ab27409d6debea570814 /core/gpslocation.cpp
parentb00306f50e489be144c8acec6944c2d4ac0b861c (diff)
downloadsubsurface-c0b44e25b730ffb839b019fa9e84a75a1b14aa12.tar.gz
GPS provider: change haveGPS status if GPS source returns error
If the GPS source returns an error that could be an indication that the user hasn't given us permission to use it, so switch our status to NOGPS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/gpslocation.cpp')
-rw-r--r--core/gpslocation.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index 3866fdc8a..29a8827af 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -66,6 +66,7 @@ QGeoPositionInfoSource *GpsLocation::getGpsSource()
status(QString("Created position source %1").arg(m_GpsSource->sourceName()));
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
} else {
#ifdef SUBSURFACE_MOBILE
@@ -154,6 +155,13 @@ void GpsLocation::updateTimeout()
status("request to get new position timed out");
}
+void GpsLocation::positionSourceError(QGeoPositionInfoSource::Error)
+{
+ status("error receiving a GPS location");
+ haveSource = NOGPS;
+ emit haveSourceChanged();
+}
+
void GpsLocation::status(QString msg)
{
qDebug() << msg;