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