diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-12-03 11:22:43 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-01-14 11:29:25 +0000 |
commit | 3ee61f7918cad8ff8ecc834b4fa85380c57afef6 (patch) | |
tree | 5e7a3a69094e067075fc9ef774e017a55c2ff332 /src/location/labs/qdeclarativenavigator_p.h | |
parent | d73f9d59e352b096af242ebe69c645def30f5672 (diff) | |
download | qtlocation-3ee61f7918cad8ff8ecc834b4fa85380c57afef6.tar.gz |
Expose manager-specific errors from QGeoServiceProvider
So that there's no risk to mix failures when creating multiple
managers.
Task-number: QTBUG-72180
Change-Id: I5c3b18ba17094e1480b2376e37b58d47029ca8f4
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/labs/qdeclarativenavigator_p.h')
-rw-r--r-- | src/location/labs/qdeclarativenavigator_p.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/location/labs/qdeclarativenavigator_p.h b/src/location/labs/qdeclarativenavigator_p.h index 2a425e70..b9949431 100644 --- a/src/location/labs/qdeclarativenavigator_p.h +++ b/src/location/labs/qdeclarativenavigator_p.h @@ -52,6 +52,7 @@ #include <QtQml/qqml.h> #include <QSharedPointer> #include <QtLocation/private/qparameterizableobject_p.h> +#include <QtLocation/qgeoserviceprovider.h> QT_BEGIN_NAMESPACE @@ -81,9 +82,25 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableO Q_PROPERTY(QDeclarativeGeoRoute *currentRoute READ currentRoute NOTIFY currentRouteChanged) Q_PROPERTY(QDeclarativeGeoRouteLeg *currentRouteLeg READ currentRouteLeg NOTIFY currentRouteChanged) Q_PROPERTY(int currentSegment READ currentSegment NOTIFY currentSegmentChanged) + Q_PROPERTY(NavigationError error READ error NOTIFY errorChanged) + Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) Q_INTERFACES(QQmlParserStatus) public: + enum NavigationError { + //QGeoServiceProvider related errors start here + NoError = QGeoServiceProvider::NoError, + NotSupportedError = QGeoServiceProvider::NotSupportedError, //TODO Qt6 consider merge with NotSupportedError + ConnectionError = QGeoServiceProvider::ConnectionError, //TODO Qt6 merge with Map's ConnectionError + LoaderError = QGeoServiceProvider::LoaderError, + UnknownParameterError = QGeoServiceProvider::UnknownParameterError, //TODO Qt6 consider rename UnsupportedOperationError + MissingRequiredParameterError = QGeoServiceProvider::MissingRequiredParameterError, + //we leave gap for future QGeoCodeReply errors + + // Navigation-specific error should start at 100 + UnknownError = 100 + }; + explicit QDeclarativeNavigator(QObject *parent = nullptr); ~QDeclarativeNavigator(); @@ -119,6 +136,9 @@ public: QDeclarativeGeoRouteLeg *currentRouteLeg() const; int currentSegment() const; + NavigationError error() const; + QString errorString() const; + signals: void navigatorReadyChanged(bool ready); void trackPositionSourceChanged(bool trackPositionSource); @@ -133,13 +153,15 @@ signals: void currentRouteChanged(); void currentRouteLegChanged(); void currentSegmentChanged(); + void errorChanged(); -private: +protected: void pluginReady(); bool ensureEngine(); void updateReadyState(); + void setError(NavigationError error, const QString &errorString); -private slots: +protected slots: void onCurrentRouteChanged(const QGeoRoute &route); void onCurrentRouteLegChanged(const QGeoRouteLeg &routeLeg); void onCurrentSegmentChanged(int segment); |