diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-05-07 15:40:34 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2021-05-25 16:40:56 +0200 |
commit | 7bfc8458499897842caf2aa6b2e333e18a02ed21 (patch) | |
tree | b3d4af30ae31bb3c758b43f2111734f6b3857257 /src | |
parent | 9167c802f9a05394f72e0ba0dfb744b415686f46 (diff) |
Adapt to new QtPositioning API
Use QGeoPositionInfoSource::errorOccurred after:
ced55681 QtPositioning: rename signal error() to errorOccurred()
Remove usage of QGeoPositionInfoSource::updateTimeout after:
37ff0744 QtPositioning: remove QGeoPositionInfoSource::updateTimeout signal
Change-Id: I7a32173c017571e56ff9d58bf9398106b66f4feb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/location_provider_qt.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index 71f95157b..b5d0f21f2 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -71,7 +71,6 @@ public: private Q_SLOTS: void updatePosition(const QGeoPositionInfo &); void error(QGeoPositionInfoSource::Error positioningError); - void timeout(); private: LocationProviderQt *m_locationProvider; @@ -133,9 +132,8 @@ void QtPositioningHelper::start(bool highAccuracy) connect(m_positionInfoSource, &QGeoPositionInfoSource::positionUpdated, this, &QtPositioningHelper::updatePosition); // disambiguate the error getter and the signal in QGeoPositionInfoSource. - connect(m_positionInfoSource, static_cast<void (QGeoPositionInfoSource::*)(QGeoPositionInfoSource::Error)>(&QGeoPositionInfoSource::error) + connect(m_positionInfoSource, static_cast<void (QGeoPositionInfoSource::*)(QGeoPositionInfoSource::Error)>(&QGeoPositionInfoSource::errorOccurred) , this, &QtPositioningHelper::error); - connect(m_positionInfoSource, &QGeoPositionInfoSource::updateTimeout, this, &QtPositioningHelper::timeout); m_positionInfoSource->startUpdates(); return; @@ -201,6 +199,12 @@ void QtPositioningHelper::error(QGeoPositionInfoSource::Error positioningError) case QGeoPositionInfoSource::AccessError: newPos.error_code = device::mojom::Geoposition::ErrorCode::PERMISSION_DENIED; break; + case QGeoPositionInfoSource::UpdateTimeoutError: + // content::Geoposition::ERROR_CODE_TIMEOUT is not handled properly in the renderer process, and the timeout + // argument used in JS never comes all the way to the browser process. + // Let's just treat it like any other error where the position is unavailable. + newPos.error_code = device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE; + break; case QGeoPositionInfoSource::ClosedError: case QGeoPositionInfoSource::UnknownSourceError: // position unavailable is as good as it gets in Geoposition default: @@ -211,17 +215,6 @@ void QtPositioningHelper::error(QGeoPositionInfoSource::Error positioningError) postToLocationProvider(base::Bind(&LocationProviderQt::updatePosition, m_locationProviderFactory.GetWeakPtr(), newPos)); } -void QtPositioningHelper::timeout() -{ - device::mojom::Geoposition newPos; - // content::Geoposition::ERROR_CODE_TIMEOUT is not handled properly in the renderer process, and the timeout - // argument used in JS never comes all the way to the browser process. - // Let's just treat it like any other error where the position is unavailable. - newPos.error_code = device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE; - if (m_locationProvider) - postToLocationProvider(base::Bind(&LocationProviderQt::updatePosition, m_locationProviderFactory.GetWeakPtr(), newPos)); -} - inline void QtPositioningHelper::postToLocationProvider(const base::Closure &task) { static_cast<device::GeolocationProviderImpl*>(device::GeolocationProvider::GetInstance())->task_runner()->PostTask(FROM_HERE, task); |