diff options
author | Liang Qi <liang.qi@qt.io> | 2018-12-10 15:55:26 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-12-10 15:55:26 +0100 |
commit | f364284e2a7e52bf31eb6ed7fbaff1e7c43ebee6 (patch) | |
tree | 431c875c7b59dfe00996d8f7099d3b34ef1df3be /src/plugins | |
parent | 41e1fb33ab89a2b00927677cfec09ba6cf22e29d (diff) | |
parent | b4966afc91fa82315f0ae9b11f54f52f20183e9b (diff) | |
download | qtlocation-f364284e2a7e52bf31eb6ed7fbaff1e7c43ebee6.tar.gz |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
.qmake.conf
Change-Id: I00453b819d65460dabf771617e6181275461cc78
Diffstat (limited to 'src/plugins')
8 files changed, 170 insertions, 95 deletions
diff --git a/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp b/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp index a79af1cb..b2f2f043 100644 --- a/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp +++ b/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp @@ -188,19 +188,18 @@ void QPlaceSearchReplyMapbox::onReplyFinished() if (!categories.isEmpty()) { const QList<QPlaceCategory> placeCategories = placeResult.place().categories(); + bool categoryMatch = false; if (!placeCategories.isEmpty()) { - bool categoryMatch = false; for (const QPlaceCategory &placeCategory : placeCategories) { if (categories.contains(placeCategory)) { categoryMatch = true; break; } } - if (!categoryMatch) - continue; } + if (!categoryMatch) + continue; } - placeResult.setDistance(searchCenter.distanceTo(placeResult.place().location().coordinate())); results.append(placeResult); } diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp index ab575463..5094b72e 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp @@ -52,6 +52,7 @@ #include <QtCore/QJsonArray> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> +#include <QtCore/QRegularExpression> #include <QtCore/QStandardPaths> #include <QtCore/QUrlQuery> #include <QtNetwork/QNetworkProxy> @@ -690,13 +691,14 @@ QPlaceIcon QPlaceManagerEngineNokiaV2::icon(const QString &remotePath, QPlaceIcon icon; QVariantMap params; - QRegExp rx("(.*)(/icons/categories/.*)"); + QRegularExpression rx("(.*)(/icons/categories/.*)"); + QRegularExpressionMatch match = rx.match(remotePath); QString iconPrefix; QString nokiaIcon; - if (rx.indexIn(remotePath) != -1 && !rx.cap(1).isEmpty() && !rx.cap(2).isEmpty()) { - iconPrefix = rx.cap(1); - nokiaIcon = rx.cap(2); + if (match.hasMatch() && !match.capturedRef(1).isEmpty() && !match.capturedRef(2).isEmpty()) { + iconPrefix = match.captured(1); + nokiaIcon = match.captured(2); if (QFile::exists(m_localDataPath + nokiaIcon)) iconPrefix = QString::fromLatin1("file://") + m_localDataPath; diff --git a/src/plugins/position/android/src/qgeopositioninfosource_android.cpp b/src/plugins/position/android/src/qgeopositioninfosource_android.cpp index 7b4706d8..59b8beab 100644 --- a/src/plugins/position/android/src/qgeopositioninfosource_android.cpp +++ b/src/plugins/position/android/src/qgeopositioninfosource_android.cpp @@ -223,7 +223,7 @@ void QGeoPositionInfoSourceAndroid::requestTimeout() const QGeoPositionInfo info = queuedSingleUpdates[i]; //anything newer by 20s is always better - const int timeDelta = best.timestamp().secsTo(info.timestamp()); + const qint64 timeDelta = best.timestamp().secsTo(info.timestamp()); if (abs(timeDelta) > 20) { if (timeDelta > 0) best = info; @@ -232,7 +232,7 @@ void QGeoPositionInfoSourceAndroid::requestTimeout() //compare accuracy if (info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy) && - info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) + best.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) { best = info.attribute(QGeoPositionInfo::HorizontalAccuracy) < best.attribute(QGeoPositionInfo::HorizontalAccuracy) ? info : best; diff --git a/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp b/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp index cd514d30..10484e3b 100644 --- a/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp +++ b/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp @@ -264,7 +264,7 @@ void QGeoPositionInfoSourceGeoclue2::createClient() setError(AccessError); delete m_client; } else { - connect(m_client, &OrgFreedesktopGeoClue2ClientInterface::LocationUpdated, + connect(m_client.data(), &OrgFreedesktopGeoClue2ClientInterface::LocationUpdated, this, &QGeoPositionInfoSourceGeoclue2::handleNewLocation); if (configureClient()) diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp index 046d862e..139a6b3d 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp @@ -36,11 +36,12 @@ #include "qgeopositioninfosource_winrt_p.h" -#include <QCoreApplication> -#include <QMutex> -#include <qfunctions_winrt.h> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qfunctions_winrt.h> +#include <QtCore/qloggingcategory.h> +#include <QtCore/qmutex.h> #ifdef Q_OS_WINRT -#include <private/qeventdispatcher_winrt_p.h> +#include <QtCore/private/qeventdispatcher_winrt_p.h> #endif #include <functional> @@ -56,10 +57,11 @@ using namespace ABI::Windows::Foundation; using namespace ABI::Windows::Foundation::Collections; typedef ITypedEventHandler<Geolocator *, PositionChangedEventArgs *> GeoLocatorPositionHandler; -typedef ITypedEventHandler<Geolocator *, StatusChangedEventArgs *> GeoLocatorStatusHandler; typedef IAsyncOperationCompletedHandler<Geoposition*> PositionHandler; typedef IAsyncOperationCompletedHandler<GeolocationAccessStatus> AccessHandler; +Q_DECLARE_LOGGING_CATEGORY(lcPositioningWinRT) + QT_BEGIN_NAMESPACE #ifndef Q_OS_WINRT @@ -70,7 +72,36 @@ HRESULT runOnXamlThread(const std::function<HRESULT ()> &delegate, bool waitForR return delegate(); } } -#endif + +static inline HRESULT await(const ComPtr<IAsyncOperation<GeolocationAccessStatus>> &asyncOp, + GeolocationAccessStatus *result) +{ + ComPtr<IAsyncInfo> asyncInfo; + HRESULT hr = asyncOp.As(&asyncInfo); + if (FAILED(hr)) + return hr; + + AsyncStatus status; + while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) + QThread::yieldCurrentThread(); + + if (FAILED(hr) || status != AsyncStatus::Completed) { + HRESULT ec; + hr = asyncInfo->get_ErrorCode(&ec); + if (FAILED(hr)) + return hr; + hr = asyncInfo->Close(); + if (FAILED(hr)) + return hr; + return ec; + } + + if (FAILED(hr)) + return hr; + + return asyncOp->GetResults(result); +} +#endif // !Q_OS_WINRT class QGeoPositionInfoSourceWinRTPrivate { public: @@ -83,13 +114,37 @@ public: EventRegistrationToken positionToken; QMutex mutex; bool updatesOngoing; + int minimumUpdateInterval; + + PositionStatus nativeStatus() const; }; +PositionStatus QGeoPositionInfoSourceWinRTPrivate::nativeStatus() const +{ +#ifdef Q_OS_WINRT + qCDebug(lcPositioningWinRT) << __FUNCTION__; + + PositionStatus status; + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, &status]() { + return locator->get_LocationStatus(&status); + }); + if (FAILED(hr)) { + qErrnoWarning(hr, "Could not query status"); + return PositionStatus_NotAvailable; + } + return status; +#else + return PositionStatus_Ready; +#endif +} + QGeoPositionInfoSourceWinRT::QGeoPositionInfoSourceWinRT(QObject *parent) : QGeoPositionInfoSource(parent) , d_ptr(new QGeoPositionInfoSourceWinRTPrivate) { + qCDebug(lcPositioningWinRT) << __FUNCTION__; + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); Q_D(QGeoPositionInfoSourceWinRT); d->positionError = QGeoPositionInfoSource::NoError; d->updatesOngoing = false; @@ -97,10 +152,13 @@ QGeoPositionInfoSourceWinRT::QGeoPositionInfoSourceWinRT(QObject *parent) QGeoPositionInfoSourceWinRT::~QGeoPositionInfoSourceWinRT() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; + CoUninitialize(); } int QGeoPositionInfoSourceWinRT::init() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); if (!requestAccess()) { qWarning ("Location access failed."); @@ -111,13 +169,11 @@ int QGeoPositionInfoSourceWinRT::init() &d->locator); RETURN_HR_IF_FAILED("Could not initialize native location services."); - hr = d->locator->add_StatusChanged(Callback<GeoLocatorStatusHandler>(this, - &QGeoPositionInfoSourceWinRT::onStatusChanged).Get(), - &d->statusToken); - RETURN_HR_IF_FAILED("Could not add status callback."); - - hr = d->locator->put_ReportInterval(1000); - RETURN_HR_IF_FAILED("Could not initialize report interval."); + UINT32 interval; + hr = d->locator->get_ReportInterval(&interval); + RETURN_HR_IF_FAILED("Could not retrieve report interval."); + d->minimumUpdateInterval = static_cast<int>(interval); + setUpdateInterval(d->minimumUpdateInterval); return hr; }); @@ -137,7 +193,6 @@ int QGeoPositionInfoSourceWinRT::init() d->positionToken.value = 0; d->periodicTimer.setSingleShot(true); - d->periodicTimer.setInterval(minimumUpdateInterval()); connect(&d->periodicTimer, &QTimer::timeout, this, &QGeoPositionInfoSourceWinRT::virtualPositionUpdate); d->singleUpdateTimer.setSingleShot(true); @@ -151,6 +206,7 @@ int QGeoPositionInfoSourceWinRT::init() QGeoPositionInfo QGeoPositionInfoSourceWinRT::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(const QGeoPositionInfoSourceWinRT); Q_UNUSED(fromSatellitePositioningMethodsOnly) return d->lastPosition; @@ -160,13 +216,8 @@ QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceWinRT::supporte { Q_D(const QGeoPositionInfoSourceWinRT); - PositionStatus status; - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, &status]() { - HRESULT hr = d->locator->get_LocationStatus(&status); - return hr; - }); - if (FAILED(hr)) - return QGeoPositionInfoSource::NoPositioningMethods; + PositionStatus status = d->nativeStatus(); + qCDebug(lcPositioningWinRT) << __FUNCTION__ << status; switch (status) { case PositionStatus::PositionStatus_NoData: @@ -180,6 +231,7 @@ QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceWinRT::supporte void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInfoSource::PositioningMethods methods) { + qCDebug(lcPositioningWinRT) << __FUNCTION__ << methods; Q_D(QGeoPositionInfoSourceWinRT); PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods(); @@ -187,7 +239,7 @@ void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInf if (previousPreferredPositioningMethods == preferredPositioningMethods()) return; - bool needsRestart = d->positionToken.value != 0; + const bool needsRestart = d->positionToken.value != 0; if (needsRestart) stopHandler(); @@ -207,19 +259,20 @@ void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInf void QGeoPositionInfoSourceWinRT::setUpdateInterval(int msec) { + qCDebug(lcPositioningWinRT) << __FUNCTION__ << msec; Q_D(QGeoPositionInfoSourceWinRT); - // Windows Phone 8.1 and Windows 10 do not support 0 interval -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) - if (msec == 0) - msec = minimumUpdateInterval(); -#endif - - // If msec is 0 we send updates as data becomes available, otherwise we force msec to be equal - // to or larger than the minimum update interval. + // minimumUpdateInterval is initialized to the lowest possible update interval in init(). + // Passing 0 will cause an error on Windows 10. + // See https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation.geolocator.reportinterval if (msec != 0 && msec < minimumUpdateInterval()) msec = minimumUpdateInterval(); - HRESULT hr = d->locator->put_ReportInterval(msec); + const bool needsRestart = d->positionToken.value != 0; + + if (needsRestart) + stopHandler(); + + HRESULT hr = d->locator->put_ReportInterval(static_cast<UINT32>(msec)); if (FAILED(hr)) { setError(QGeoPositionInfoSource::UnknownSourceError); qErrnoWarning(hr, "Failed to set update interval"); @@ -229,17 +282,20 @@ void QGeoPositionInfoSourceWinRT::setUpdateInterval(int msec) d->periodicTimer.setInterval(qMax(msec, minimumUpdateInterval())); QGeoPositionInfoSource::setUpdateInterval(msec); + + if (needsRestart) + startHandler(); } int QGeoPositionInfoSourceWinRT::minimumUpdateInterval() const { - // We use one second to reduce potential timer events - // in case the platform itself stops reporting - return 1000; + Q_D(const QGeoPositionInfoSourceWinRT); + return d->minimumUpdateInterval; } void QGeoPositionInfoSourceWinRT::startUpdates() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); if (d->updatesOngoing) @@ -253,6 +309,7 @@ void QGeoPositionInfoSourceWinRT::startUpdates() void QGeoPositionInfoSourceWinRT::stopUpdates() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); stopHandler(); @@ -262,6 +319,7 @@ void QGeoPositionInfoSourceWinRT::stopUpdates() bool QGeoPositionInfoSourceWinRT::startHandler() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); // Check if already attached @@ -301,6 +359,7 @@ bool QGeoPositionInfoSourceWinRT::startHandler() void QGeoPositionInfoSourceWinRT::stopHandler() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); if (!d->positionToken.value) @@ -314,6 +373,7 @@ void QGeoPositionInfoSourceWinRT::stopHandler() void QGeoPositionInfoSourceWinRT::requestUpdate(int timeout) { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); if (timeout != 0 && timeout < minimumUpdateInterval()) { @@ -330,6 +390,7 @@ void QGeoPositionInfoSourceWinRT::requestUpdate(int timeout) void QGeoPositionInfoSourceWinRT::virtualPositionUpdate() { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_D(QGeoPositionInfoSourceWinRT); QMutexLocker locker(&d->mutex); @@ -367,6 +428,7 @@ void QGeoPositionInfoSourceWinRT::singleUpdateTimeOut() void QGeoPositionInfoSourceWinRT::updateSynchronized(QGeoPositionInfo currentInfo) { + qCDebug(lcPositioningWinRT) << __FUNCTION__ << currentInfo; Q_D(QGeoPositionInfoSourceWinRT); QMutexLocker locker(&d->mutex); @@ -388,11 +450,13 @@ void QGeoPositionInfoSourceWinRT::updateSynchronized(QGeoPositionInfo currentInf QGeoPositionInfoSource::Error QGeoPositionInfoSourceWinRT::error() const { Q_D(const QGeoPositionInfoSourceWinRT); + qCDebug(lcPositioningWinRT) << __FUNCTION__ << d->positionError; return d->positionError; } void QGeoPositionInfoSourceWinRT::setError(QGeoPositionInfoSource::Error positionError) { + qCDebug(lcPositioningWinRT) << __FUNCTION__ << positionError; Q_D(QGeoPositionInfoSourceWinRT); if (positionError == d->positionError) @@ -404,14 +468,9 @@ void QGeoPositionInfoSourceWinRT::setError(QGeoPositionInfoSource::Error positio bool QGeoPositionInfoSourceWinRT::checkNativeState() { Q_D(QGeoPositionInfoSourceWinRT); + qCDebug(lcPositioningWinRT) << __FUNCTION__; - PositionStatus status; - HRESULT hr = d->locator->get_LocationStatus(&status); - if (FAILED(hr)) { - setError(QGeoPositionInfoSource::UnknownSourceError); - qErrnoWarning(hr, "Could not query status"); - return false; - } + PositionStatus status = d->nativeStatus(); bool result = false; switch (status) { @@ -432,41 +491,53 @@ bool QGeoPositionInfoSourceWinRT::checkNativeState() HRESULT QGeoPositionInfoSourceWinRT::onPositionChanged(IGeolocator *locator, IPositionChangedEventArgs *args) { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_UNUSED(locator); HRESULT hr; - ComPtr<IGeoposition> pos; - hr = args->get_Position(&pos); + ComPtr<IGeoposition> position; + hr = args->get_Position(&position); RETURN_HR_IF_FAILED("Could not access position object."); QGeoPositionInfo currentInfo; ComPtr<IGeocoordinate> coord; - hr = pos->get_Coordinate(&coord); + hr = position->get_Coordinate(&coord); if (FAILED(hr)) qErrnoWarning(hr, "Could not access coordinate"); - DOUBLE lat; - hr = coord->get_Latitude(&lat); + ComPtr<IGeocoordinateWithPoint> pointCoordinate; + hr = coord.As(&pointCoordinate); if (FAILED(hr)) - qErrnoWarning(hr, "Could not access latitude"); + qErrnoWarning(hr, "Could not cast coordinate."); - DOUBLE lon; - hr = coord->get_Longitude(&lon); + ComPtr<IGeopoint> point; + hr = pointCoordinate->get_Point(&point); if (FAILED(hr)) - qErrnoWarning(hr, "Could not access longitude"); - - // Depending on data source altitude can - // be identified or not - IReference<double> *alt; - hr = coord->get_Altitude(&alt); - if (SUCCEEDED(hr) && alt) { - double altd; - hr = alt->get_Value(&altd); - currentInfo.setCoordinate(QGeoCoordinate(lat, lon, altd)); - } else { - currentInfo.setCoordinate(QGeoCoordinate(lat, lon)); + qErrnoWarning(hr, "Could not obtain coordinate's point."); + + BasicGeoposition pos; + hr = point->get_Position(&pos); + if (FAILED(hr)) + qErrnoWarning(hr, "Could not obtain point's position."); + + DOUBLE lat = pos.Latitude; + DOUBLE lon = pos.Longitude; + DOUBLE alt = pos.Altitude; + + bool altitudeAvailable = false; + ComPtr<IGeoshape> shape; + hr = point.As(&shape); + if (SUCCEEDED(hr) && shape) { + AltitudeReferenceSystem altitudeSystem; + hr = shape->get_AltitudeReferenceSystem(&altitudeSystem); + if (SUCCEEDED(hr) && altitudeSystem == AltitudeReferenceSystem_Geoid) + altitudeAvailable = true; } + if (altitudeAvailable) + currentInfo.setCoordinate(QGeoCoordinate(lat, lon, alt)); + else + currentInfo.setCoordinate(QGeoCoordinate(lat, lon)); DOUBLE accuracy; hr = coord->get_Accuracy(&accuracy); @@ -477,7 +548,7 @@ HRESULT QGeoPositionInfoSourceWinRT::onPositionChanged(IGeolocator *locator, IPo hr = coord->get_AltitudeAccuracy(&altAccuracy); if (SUCCEEDED(hr) && altAccuracy) { double value; - hr = alt->get_Value(&value); + hr = altAccuracy->get_Value(&value); currentInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, value); } @@ -525,16 +596,9 @@ HRESULT QGeoPositionInfoSourceWinRT::onPositionChanged(IGeolocator *locator, IPo return S_OK; } -HRESULT QGeoPositionInfoSourceWinRT::onStatusChanged(IGeolocator*, IStatusChangedEventArgs *args) -{ - PositionStatus st; - args->get_Status(&st); - return S_OK; -} - bool QGeoPositionInfoSourceWinRT::requestAccess() const { -#ifdef Q_OS_WINRT + qCDebug(lcPositioningWinRT) << __FUNCTION__; static GeolocationAccessStatus accessStatus = GeolocationAccessStatus_Unspecified; static ComPtr<IGeolocatorStatics> statics; @@ -557,11 +621,12 @@ bool QGeoPositionInfoSourceWinRT::requestAccess() const Q_ASSERT_SUCCEEDED(hr); // We cannot wait inside the XamlThread as that would deadlock +#ifdef Q_OS_WINRT QWinRTFunctions::await(op, &accessStatus); +#else + await(op, &accessStatus); +#endif return accessStatus == GeolocationAccessStatus_Allowed; -#else // Q_OS_WINRT - return true; -#endif // Q_OS_WINRT } QT_END_NAMESPACE diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h index 9f3a1c7f..4319ccae 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h @@ -51,7 +51,7 @@ #include "qgeopositioninfosource.h" #include "qgeopositioninfo.h" -#include <QTimer> +#include <QtCore/qtimer.h> #include <EventToken.h> #include <wrl.h> @@ -62,7 +62,6 @@ namespace ABI { namespace Geolocation{ struct IGeolocator; struct IPositionChangedEventArgs; - struct IStatusChangedEventArgs; } } } @@ -76,7 +75,7 @@ class QGeoPositionInfoSourceWinRT : public QGeoPositionInfoSource { Q_OBJECT public: - QGeoPositionInfoSourceWinRT(QObject *parent = 0); + QGeoPositionInfoSourceWinRT(QObject *parent = nullptr); ~QGeoPositionInfoSourceWinRT(); int init(); @@ -92,9 +91,6 @@ public: HRESULT onPositionChanged(ABI::Windows::Devices::Geolocation::IGeolocator *locator, ABI::Windows::Devices::Geolocation::IPositionChangedEventArgs *args); - HRESULT onStatusChanged(ABI::Windows::Devices::Geolocation::IGeolocator*, - ABI::Windows::Devices::Geolocation::IStatusChangedEventArgs *args); - bool requestAccess() const; Q_SIGNALS: void nativePositionUpdate(const QGeoPositionInfo); diff --git a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp index e58744a0..b1ec6fb3 100644 --- a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp +++ b/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp @@ -37,24 +37,37 @@ #include "qgeopositioninfosourcefactory_winrt.h" #include "qgeopositioninfosource_winrt_p.h" +#include <QtCore/qloggingcategory.h> + +Q_LOGGING_CATEGORY(lcPositioningWinRT, "qt.positioning.winrt") + +QT_BEGIN_NAMESPACE + QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryWinRT::positionInfoSource(QObject *parent) { + qCDebug(lcPositioningWinRT) << __FUNCTION__; QGeoPositionInfoSourceWinRT *src = new QGeoPositionInfoSourceWinRT(parent); if (src->init() < 0) { + qCDebug(lcPositioningWinRT) << __FUNCTION__ << "Source initialization failed."; delete src; - src = 0; + return nullptr; } + qCDebug(lcPositioningWinRT) << __FUNCTION__ << "Created position info source."; return src; } QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryWinRT::satelliteInfoSource(QObject *parent) { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_UNUSED(parent); - return 0; + return nullptr; } QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryWinRT::areaMonitor(QObject *parent) { + qCDebug(lcPositioningWinRT) << __FUNCTION__; Q_UNUSED(parent); - return 0; + return nullptr; } + +QT_END_NAMESPACE diff --git a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h b/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h index 46cd3853..d09ddb64 100644 --- a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h +++ b/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h @@ -37,8 +37,8 @@ #ifndef QGEOPOSITIONINFOSOURCEFACTORY_WINRT_H #define QGEOPOSITIONINFOSOURCEFACTORY_WINRT_H -#include <QObject> -#include <QGeoPositionInfoSourceFactory> +#include <QtCore/qobject.h> +#include <QtPositioning/qgeopositioninfosourcefactory.h> QT_BEGIN_NAMESPACE |