diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2019-01-03 12:32:28 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2019-01-14 12:43:15 +0000 |
commit | 17457ddb657ea94408ac581958b065dc2d8711ff (patch) | |
tree | 5f99cdaaf65ecefb15f55b823b10af73e2b4ea2d /src/plugins/position | |
parent | 3d525338d5cb21f57e46bbbea86647055455a46e (diff) | |
download | qtlocation-17457ddb657ea94408ac581958b065dc2d8711ff.tar.gz |
winrt: Smaller code cleanups
- Use override where applicable
- Use declaration initialization if possible
- Do not use temporary variables which are not used
Change-Id: I68311dfc090fa6a217814a7f801fef6764778cab
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/position')
-rw-r--r-- | src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp | 9 | ||||
-rw-r--r-- | src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h | 20 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp index ac841be7..0e3a4060 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp @@ -112,12 +112,12 @@ public: QTimer periodicTimer; QTimer singleUpdateTimer; QGeoPositionInfo lastPosition; - QGeoPositionInfoSource::Error positionError; + QGeoPositionInfoSource::Error positionError = QGeoPositionInfoSource::NoError; EventRegistrationToken statusToken; EventRegistrationToken positionToken; QMutex mutex; - bool updatesOngoing; - int minimumUpdateInterval; + bool updatesOngoing = false; + int minimumUpdateInterval = -1; PositionStatus positionStatus = PositionStatus_NotInitialized; }; @@ -231,8 +231,7 @@ void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInf PositionAccuracy::PositionAccuracy_High : PositionAccuracy::PositionAccuracy_Default; HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, acc]() { - HRESULT hr = d->locator->put_DesiredAccuracy(acc); - return hr; + return d->locator->put_DesiredAccuracy(acc); }); RETURN_VOID_IF_FAILED("Could not set positioning accuracy."); diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h index 61d0af95..dbfde0e9 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h @@ -77,17 +77,17 @@ class QGeoPositionInfoSourceWinRT : public QGeoPositionInfoSource Q_OBJECT public: QGeoPositionInfoSourceWinRT(QObject *parent = nullptr); - ~QGeoPositionInfoSourceWinRT(); + ~QGeoPositionInfoSourceWinRT() override; int init(); - QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const; - PositioningMethods supportedPositioningMethods() const; + QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override; + PositioningMethods supportedPositioningMethods() const override; - void setPreferredPositioningMethods(PositioningMethods methods); + void setPreferredPositioningMethods(PositioningMethods methods) override; - void setUpdateInterval(int msec); - int minimumUpdateInterval() const; - Error error() const; + void setUpdateInterval(int msec) override; + int minimumUpdateInterval() const override; + Error error() const override; HRESULT onPositionChanged(ABI::Windows::Devices::Geolocation::IGeolocator *locator, ABI::Windows::Devices::Geolocation::IPositionChangedEventArgs *args); @@ -98,10 +98,10 @@ public: Q_SIGNALS: void nativePositionUpdate(const QGeoPositionInfo); public slots: - void startUpdates(); - void stopUpdates(); + void startUpdates() override; + void stopUpdates() override; - void requestUpdate(int timeout = 0); + void requestUpdate(int timeout = 0) override; private slots: void stopHandler(); |