mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
With patched Qt 5.6 for iOS correctly handle disabled GPS source
Qt 5.6.0 is broken when it comes to using CoreLocationService on iOS. It doesn't even check if the location service is enabled. My patches fix that and make Qt set an error code right after service creation. Having the service creation fail is actually the wrong thing to do because then Qt switches over to GeoClue and that really isn't helpful for our needs here. Additionally, Qt 5.6.0 without my patches doesn't follow the REQUIRED flow of using the location service as it does not check the access permissions before accessing the GPS service - without doing so the GPS service will not run in the background. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c0b44e25b7
commit
4ac6f34b16
1 changed files with 13 additions and 0 deletions
|
@ -58,6 +58,19 @@ QGeoPositionInfoSource *GpsLocation::getGpsSource()
|
|||
if (!m_GpsSource) {
|
||||
m_GpsSource = QGeoPositionInfoSource::createDefaultSource(this);
|
||||
if (m_GpsSource != 0) {
|
||||
#if defined(Q_OS_IOS)
|
||||
// at least Qt 5.6.0 isn't doing things right on iOS - it MUST check for permission before
|
||||
// accessing the position source
|
||||
// I have a hacked version of Qt 5.6.0 that I will build the iOS binaries with for now;
|
||||
// this test below righ after creating the source checks if the location service is disabled
|
||||
// and set's an error right when the position source is created to indicate this
|
||||
if (m_GpsSource->error() == QGeoPositionInfoSource::AccessError) {
|
||||
haveSource = NOGPS;
|
||||
emit haveSourceChanged();
|
||||
m_GpsSource = NULL;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
haveSource = (m_GpsSource->supportedPositioningMethods() & QGeoPositionInfoSource::SatellitePositioningMethods) ? HAVEGPS : NOGPS;
|
||||
emit haveSourceChanged();
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
|
|
Loading…
Add table
Reference in a new issue