summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/location/maps/qgeoserviceprovider.cpp14
-rw-r--r--src/location/maps/qgeoserviceprovider_p.h2
-rw-r--r--src/location/maps/qgeoserviceproviderfactory.cpp27
-rw-r--r--src/location/maps/qgeoserviceproviderfactory.h16
4 files changed, 51 insertions, 8 deletions
diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp
index fef4a826..79e27ff0 100644
--- a/src/location/maps/qgeoserviceprovider.cpp
+++ b/src/location/maps/qgeoserviceprovider.cpp
@@ -360,7 +360,9 @@ template <> QPlaceManagerEngine *createEngine<QPlaceManagerEngine>(QGeoServicePr
}
template <> QNavigationManagerEngine *createEngine<QNavigationManagerEngine>(QGeoServiceProviderPrivate *d_ptr)
{
- return d_ptr->factory->createNavigationManagerEngine(d_ptr->cleanedParameterMap, &(d_ptr->placeError), &(d_ptr->placeErrorString));
+ if (!d_ptr->factoryV2)
+ return nullptr;
+ return d_ptr->factoryV2->createNavigationManagerEngine(d_ptr->cleanedParameterMap, &(d_ptr->placeError), &(d_ptr->placeErrorString));
}
/* Template for generating the code for each of the geocodingManager(),
@@ -656,7 +658,7 @@ void QGeoServiceProviderPrivate::unload()
delete navigationManager;
navigationManager = nullptr;
- factory = 0;
+ factory = factoryV2 = nullptr;
error = QGeoServiceProvider::NoError;
errorString = QLatin1String("");
metaData = QJsonObject();
@@ -686,7 +688,7 @@ void QGeoServiceProviderPrivate::filterParameterMap()
void QGeoServiceProviderPrivate::loadMeta()
{
- factory = 0;
+ factory = factoryV2 = nullptr;
metaData = QJsonObject();
metaData.insert(QStringLiteral("index"), -1);
error = QGeoServiceProvider::NotSupportedError;
@@ -727,7 +729,7 @@ void QGeoServiceProviderPrivate::loadPlugin(const QVariantMap &parameters)
if (int(metaData.value(QStringLiteral("index")).toDouble()) < 0) {
error = QGeoServiceProvider::NotSupportedError;
errorString = QString(QLatin1String("The geoservices provider is not supported."));
- factory = 0;
+ factory = factoryV2 = nullptr;
return;
}
@@ -737,7 +739,9 @@ void QGeoServiceProviderPrivate::loadPlugin(const QVariantMap &parameters)
int idx = int(metaData.value(QStringLiteral("index")).toDouble());
// load the actual plugin
- factory = qobject_cast<QGeoServiceProviderFactory *>(loader()->instance(idx));
+ QObject *instance = loader()->instance(idx);
+ factory = qobject_cast<QGeoServiceProviderFactory *>(instance);
+ factoryV2 = qobject_cast<QGeoServiceProviderFactoryV2 *>(instance);
}
QHash<QString, QJsonObject> QGeoServiceProviderPrivate::plugins(bool reload)
diff --git a/src/location/maps/qgeoserviceprovider_p.h b/src/location/maps/qgeoserviceprovider_p.h
index 1aaa498c..11b86bad 100644
--- a/src/location/maps/qgeoserviceprovider_p.h
+++ b/src/location/maps/qgeoserviceprovider_p.h
@@ -62,6 +62,7 @@ class QGeoRoutingManager;
class QGeoMappingManager;
class QGeoServiceProviderFactory;
+class QGeoServiceProviderFactoryV2;
class QGeoServiceProviderPrivate
{
@@ -82,6 +83,7 @@ public:
Flags features(const char *enumName);
QGeoServiceProviderFactory *factory;
+ QGeoServiceProviderFactoryV2 *factoryV2 = nullptr;
QJsonObject metaData;
QVariantMap parameterMap;
diff --git a/src/location/maps/qgeoserviceproviderfactory.cpp b/src/location/maps/qgeoserviceproviderfactory.cpp
index c8192a32..44ed3535 100644
--- a/src/location/maps/qgeoserviceproviderfactory.cpp
+++ b/src/location/maps/qgeoserviceproviderfactory.cpp
@@ -43,6 +43,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-impl
\since 5.6
+ \deprecated
\brief The QGeoServiceProviderFactory class is a factory class used as the
plugin interface for services related to geographical information.
@@ -52,6 +53,8 @@ QT_BEGIN_NAMESPACE
The other functions should be overridden if the plugin supports the
associated set of functionality.
+
+ \sa QGeoServiceProviderFactoryV2
*/
/*!
@@ -161,6 +164,28 @@ QPlaceManagerEngine *QGeoServiceProviderFactory::createPlaceManagerEngine(const
}
/*!
+ \class QGeoServiceProviderFactoryV2
+ \inmodule QtLocation
+ \ingroup QtLocation-impl
+ \since 5.11
+
+ \brief The QGeoServiceProviderFactoryV2 class is a factory class used as the
+ plugin interface for services related to geographical information.
+
+ Implementers must provide a unique combination of providerName() and
+ providerVersion() per plugin.
+
+ The other functions should be overridden if the plugin supports the
+ associated set of functionality.
+*/
+
+/*!
+\fn QGeoServiceProviderFactoryV2::~QGeoServiceProviderFactoryV2()
+
+Destroys this QGeoServiceProviderFactoryV2 instance.
+*/
+
+/*!
Returns a new QNavigationManagerEngine instance, initialized with \a
parameters, which implements navigation functionality.
@@ -173,7 +198,7 @@ QPlaceManagerEngine *QGeoServiceProviderFactory::createPlaceManagerEngine(const
The default implementation returns nullptr, which causes a
QGeoServiceProvider::NotSupportedError in QGeoServiceProvider.
*/
-QNavigationManagerEngine *QGeoServiceProviderFactory::createNavigationManagerEngine(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
+QNavigationManagerEngine *QGeoServiceProviderFactoryV2::createNavigationManagerEngine(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
{
Q_UNUSED(parameters)
Q_UNUSED(error)
diff --git a/src/location/maps/qgeoserviceproviderfactory.h b/src/location/maps/qgeoserviceproviderfactory.h
index e1164189..1eb93a18 100644
--- a/src/location/maps/qgeoserviceproviderfactory.h
+++ b/src/location/maps/qgeoserviceproviderfactory.h
@@ -62,13 +62,25 @@ public:
virtual QPlaceManagerEngine *createPlaceManagerEngine(const QVariantMap &parameters,
QGeoServiceProvider::Error *error,
QString *errorString) const;
+};
+
+Q_DECLARE_INTERFACE(QGeoServiceProviderFactory,
+ "org.qt-project.qt.geoservice.serviceproviderfactory/5.0")
+
+class Q_LOCATION_EXPORT QGeoServiceProviderFactoryV2 : public QGeoServiceProviderFactory
+{
+public:
+ virtual ~QGeoServiceProviderFactoryV2() {}
+
virtual QNavigationManagerEngine *createNavigationManagerEngine(const QVariantMap &parameters,
QGeoServiceProvider::Error *error,
QString *errorString) const;
};
-Q_DECLARE_INTERFACE(QGeoServiceProviderFactory,
- "org.qt-project.qt.geoservice.serviceproviderfactory/5.0")
+// Although not actually used for constructing a specialized loader, this is required for
+// casting a QObject * into QGeoServiceProviderFactoryV2 *
+Q_DECLARE_INTERFACE(QGeoServiceProviderFactoryV2,
+ "org.qt-project.qt.geoservice.serviceproviderfactoryV2/5.0")
QT_END_NAMESPACE