diff options
| -rw-r--r-- | .cmake.conf | 2 | ||||
| -rw-r--r-- | .qmake.conf | 2 | ||||
| -rw-r--r-- | dependencies.yaml | 6 | ||||
| -rw-r--r-- | src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp | 48 | ||||
| -rw-r--r-- | tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp | 10 |
5 files changed, 19 insertions, 49 deletions
diff --git a/.cmake.conf b/.cmake.conf index 7733def2..0fcb9b1a 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1,2 +1,2 @@ -set(QT_REPO_MODULE_VERSION "6.2.12") +set(QT_REPO_MODULE_VERSION "6.2.13") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "") diff --git a/.qmake.conf b/.qmake.conf index 8e3d64e8..297621c6 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -3,4 +3,4 @@ CONFIG += warning_clean DEFINES += QT_NO_JAVA_STYLE_ITERATORS -MODULE_VERSION = 6.2.12 +MODULE_VERSION = 6.2.13 diff --git a/dependencies.yaml b/dependencies.yaml index 65893d89..bd4466eb 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,10 +1,10 @@ dependencies: ../tqtc-qtbase: - ref: 3a82051eade32b34c2f4f6f652a9d8ef0db96c71 + ref: a963a536e623499cc56b0231c35dc5790a4bbc29 required: true ../tqtc-qtdeclarative: - ref: a7c766a9863605eb81e8f0cdb4d2b93e087b5bde + ref: c6fdadd916a7568c1d71b750e054ca9aa2fd5dfc required: false ../tqtc-qtserialport: - ref: b19eb455a1f051084caaf8d0a9ecf09176f8fd4a + ref: b85ce486ea30d84e67af36cf43d1935b494d7176 required: false diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp index a8e9816f..29ec1214 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp @@ -40,9 +40,6 @@ #include <QtCore/private/qfunctions_winrt_p.h> #include <QtCore/qloggingcategory.h> #include <QtCore/qmutex.h> -#ifdef Q_OS_WINRT -#include <QtCore/private/qeventdispatcher_winrt_p.h> -#endif #include <functional> #include <windows.system.h> @@ -67,15 +64,6 @@ Q_DECLARE_METATYPE(QGeoPositionInfoSource::Error) QT_BEGIN_NAMESPACE -#ifndef Q_OS_WINRT -namespace QEventDispatcherWinRT { -HRESULT runOnXamlThread(const std::function<HRESULT ()> &delegate, bool waitForRun = true) -{ - Q_UNUSED(waitForRun); - return delegate(); -} -} - static inline HRESULT await(const ComPtr<IAsyncOperation<GeolocationAccessStatus>> &asyncOp, GeolocationAccessStatus *result) { @@ -104,7 +92,6 @@ static inline HRESULT await(const ComPtr<IAsyncOperation<GeolocationAccessStatus return asyncOp->GetResults(result); } -#endif // !Q_OS_WINRT enum class InitializationState { Uninitialized, @@ -166,7 +153,7 @@ int QGeoPositionInfoSourceWinRT::init() qWarning ("Location access failed."); return -1; } - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() { + HRESULT hr = [this, d]() { HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Devices_Geolocation_Geolocator).Get(), &d->locator); RETURN_HR_IF_FAILED("Could not initialize native location services."); @@ -182,7 +169,7 @@ int QGeoPositionInfoSourceWinRT::init() setUpdateInterval(d->updateInterval); return hr; - }); + }(); if (FAILED(hr)) { d->initState = InitializationState::Uninitialized; setError(QGeoPositionInfoSource::UnknownSourceError); @@ -239,9 +226,9 @@ void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInf PositionAccuracy acc = methods & PositioningMethod::SatellitePositioningMethods ? PositionAccuracy::PositionAccuracy_High : PositionAccuracy::PositionAccuracy_Default; - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, acc]() { + HRESULT hr = [d, acc]() { return d->locator->put_DesiredAccuracy(acc); - }); + }(); RETURN_VOID_IF_FAILED("Could not set positioning accuracy."); if (needsRestart) @@ -260,7 +247,7 @@ void QGeoPositionInfoSourceWinRT::setUpdateInterval(int msec) // 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()) + if (msec < minimumUpdateInterval()) msec = minimumUpdateInterval(); const bool needsRestart = d->positionToken.value != 0 || d->statusToken.value != 0; @@ -340,7 +327,7 @@ bool QGeoPositionInfoSourceWinRT::startHandler() return false; } - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() { + HRESULT hr = [this, d]() { HRESULT hr; // We need to call this at least once on Windows 10 Mobile. @@ -360,7 +347,7 @@ bool QGeoPositionInfoSourceWinRT::startHandler() &d->statusToken); RETURN_HR_IF_FAILED("Could not add status handler"); return hr; - }); + }(); if (FAILED(hr)) { setError(QGeoPositionInfoSource::UnknownSourceError); return false; @@ -376,11 +363,8 @@ void QGeoPositionInfoSourceWinRT::stopHandler() if (!d->positionToken.value) return; - QEventDispatcherWinRT::runOnXamlThread([d]() { - d->locator->remove_PositionChanged(d->positionToken); - d->locator->remove_StatusChanged(d->statusToken); - return S_OK; - }); + d->locator->remove_PositionChanged(d->positionToken); + d->locator->remove_StatusChanged(d->statusToken); d->positionToken.value = 0; d->statusToken.value = 0; } @@ -403,8 +387,8 @@ void QGeoPositionInfoSourceWinRT::requestUpdate(int timeout) if (timeout == 0) timeout = 2*60*1000; // Maximum time for cold start (see Android) - startHandler(); - d->singleUpdateTimer.start(timeout); + if (startHandler()) + d->singleUpdateTimer.start(timeout); } void QGeoPositionInfoSourceWinRT::virtualPositionUpdate() @@ -646,8 +630,7 @@ bool QGeoPositionInfoSourceWinRT::requestAccess() const GeolocationAccessStatus accessStatus; ComPtr<IAsyncOperation<GeolocationAccessStatus>> op; - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([&op, d]() { + HRESULT hr = [&op, d]() { HRESULT hr; if (!d->statics) { hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Geolocation_Geolocator).Get(), @@ -657,18 +640,13 @@ bool QGeoPositionInfoSourceWinRT::requestAccess() const hr = d->statics->RequestAccessAsync(&op); return hr; - }); + }(); if (FAILED(hr)) { qCDebug(lcPositioningWinRT) << __FUNCTION__ << "Requesting access from Xaml thread failed"; return false; } - // 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; } diff --git a/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp b/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp index 8e7aa93c..5abab938 100644 --- a/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp +++ b/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp @@ -122,15 +122,7 @@ static char *printPosition(const QDeclarativePosition *position) { // For this test we need to print only coordinate, so that we get a nice // error message if the below test fails. - QString str; - QDebug dbg(&str); - dbg << position->coordinate(); - const auto dataArray = str.toLatin1(); - const auto msgSize = dataArray.size() + 1; - char *msg = new char[msgSize]; - memset(msg, 0, msgSize); - qsnprintf(msg, msgSize, "%s", dataArray.constData()); - return msg; + return qstrdup(QDebug::toString(position->coordinate()).toLatin1().constData()); } void tst_DeclarativePositionSource::positionBinding() |
