diff options
Diffstat (limited to 'src/location/labs/qdeclarativenavigator_p.h')
-rw-r--r-- | src/location/labs/qdeclarativenavigator_p.h | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/src/location/labs/qdeclarativenavigator_p.h b/src/location/labs/qdeclarativenavigator_p.h index 13884c41..e12d6ba4 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 @@ -59,12 +60,16 @@ class QDeclarativeGeoServiceProvider; class QDeclarativeGeoMap; class QNavigationManager; class QDeclarativeGeoRoute; +class QDeclarativeGeoRouteLeg; class QDeclarativePositionSource; class QDeclarativeGeoWaypoint; class QGeoRoute; +class QGeoRouteLeg; class QGeoRouteSegment; class QDeclarativeNavigatorPrivate; class QDeclarativeGeoRouteSegment; +class QDeclarativeNavigationBasicDirections; +class QAbstractNavigator; class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableObject, public QQmlParserStatus { @@ -76,11 +81,28 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableO Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool navigatorReady READ navigatorReady NOTIFY navigatorReadyChanged) Q_PROPERTY(bool trackPositionSource READ trackPositionSource WRITE setTrackPositionSource NOTIFY trackPositionSourceChanged) - Q_PROPERTY(QDeclarativeGeoRoute *currentRoute READ currentRoute NOTIFY currentRouteChanged) - Q_PROPERTY(int currentSegment READ currentSegment NOTIFY currentSegmentChanged) + Q_PROPERTY(QDeclarativeNavigationBasicDirections *directions READ directions CONSTANT) + Q_PROPERTY(NavigationError error READ error NOTIFY errorChanged) + Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) + Q_PROPERTY(QAbstractNavigator *engineHandle READ abstractNavigator CONSTANT) + 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(); @@ -112,36 +134,34 @@ public: void setTrackPositionSource(bool trackPositionSource); bool trackPositionSource() const; - QDeclarativeGeoRoute *currentRoute() const; - int currentSegment() const; + QDeclarativeNavigationBasicDirections *directions() const; + QAbstractNavigator *abstractNavigator() const; + + NavigationError error() const; + QString errorString() const; signals: void navigatorReadyChanged(bool ready); void trackPositionSourceChanged(bool trackPositionSource); void activeChanged(bool active); - void waypointReached(const QDeclarativeGeoWaypoint *pos); - void destinationReached(); void pluginChanged(); void mapChanged(); void routeChanged(); void positionSourceChanged(); - void currentRouteChanged(); - void currentSegmentChanged(); + void errorChanged(); -private: +protected: void pluginReady(); bool ensureEngine(); void updateReadyState(); - -private slots: - void onCurrentRouteChanged(const QGeoRoute &route); - void onCurrentSegmentChanged(int segment); + void setError(NavigationError error, const QString &errorString); private: QScopedPointer<QDeclarativeNavigatorPrivate> d_ptr; friend class QDeclarativeNavigatorPrivate; + friend class QDeclarativeNavigationBasicDirections; }; QT_END_NAMESPACE |