diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 12:29:28 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 12:29:54 +0200 |
commit | 9be23eb946580519b2b0600cc854ec8050b90659 (patch) | |
tree | 63ccf0e565f346a0788d937b004e01d2ec029b5e /src/core/location_provider_qt.cpp | |
parent | 4f2e66f9d898e9c11a7ad6e552d0d47bb15d4051 (diff) | |
parent | 981e38d2dc82c047c6ad8ec19427d3ac7434dc3c (diff) |
Merge remote-tracking branch 'origin/5.6' into devwip/47-based
Change-Id: I0569b04ced3456a1d5d91e02e117963115fcf1b2
Diffstat (limited to 'src/core/location_provider_qt.cpp')
-rw-r--r-- | src/core/location_provider_qt.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index d17fc3d21..e3be01b36 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -60,7 +60,7 @@ public: QtPositioningHelper(LocationProviderQt *provider); ~QtPositioningHelper(); - bool start(bool highAccuracy); + void start(bool highAccuracy); void stop(); void refresh(); @@ -88,15 +88,20 @@ QtPositioningHelper::~QtPositioningHelper() m_locationProvider->m_positioningHelper = 0; } -bool QtPositioningHelper::start(bool highAccuracy) +void QtPositioningHelper::start(bool highAccuracy) { DCHECK_CURRENTLY_ON(BrowserThread::UI); Q_UNUSED(highAccuracy); // FIXME: go through availableSources until one supports QGeoPositionInfoSource::SatellitePositioningMethods // for the highAccuracy case. m_positionInfoSource = QGeoPositionInfoSource::createDefaultSource(this); - if (!m_positionInfoSource) - return false; + if (!m_positionInfoSource) { + qWarning("Failed to initialize location provider: The system either has no default " + "position source, no valid plugins could be found or the user does not have " + "the right permissions."); + error(QGeoPositionInfoSource::UnknownSourceError); + return; + } connect(m_positionInfoSource, &QGeoPositionInfoSource::positionUpdated, this, &QtPositioningHelper::updatePosition); // disambiguate the error getter and the signal in QGeoPositionInfoSource. @@ -105,7 +110,7 @@ bool QtPositioningHelper::start(bool highAccuracy) connect(m_positionInfoSource, &QGeoPositionInfoSource::updateTimeout, this, &QtPositioningHelper::timeout); m_positionInfoSource->startUpdates(); - return true; + return; } void QtPositioningHelper::stop() @@ -208,7 +213,7 @@ bool LocationProviderQt::StartProvider(bool highAccuracy) m_positioningHelper = new QtPositioningHelper(this); m_positioningHelper->moveToThread(guiThread); } - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(base::IgnoreResult(&QtPositioningHelper::start) + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&QtPositioningHelper::start , base::Unretained(m_positioningHelper), highAccuracy)); return true; } |