From 0287bfee05840511c12100f06f9142e3e2b8f7d5 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Tue, 28 Feb 2012 13:05:02 +1000 Subject: New plugin API changes, centralized geoservice feature detection This change adapts geoservice plugins to use the new Qt5 plugin API, performing boolean feature detection all through the JSON blobs rather than methods on factories or managers. As a result of this centralisation, it was also necessary to rework the QML API for the Plugin element a little. Some additional changes were made to the declarative places plugin to prevent it crashing due to plugins becoming available later than they did previously. Task-number: QTBUG-24331 Change-Id: I26149987344b67091480449103ab1712c869b2a5 Reviewed-by: Aaron McCarthy --- .../nokia_places_jsondb/nokia_places_jsondb.pro | 3 +++ .../nokia_places_jsondb/nokia_plugin_jsondb.json | 14 ++++++++++++++ .../qgeoserviceproviderplugin_jsondb.cpp | 17 ----------------- .../qgeoserviceproviderplugin_jsondb.h | 10 ++++------ .../nokia_places_jsondb/qplacemanagerengine_jsondb.cpp | 9 --------- .../nokia_places_jsondb/qplacemanagerengine_jsondb.h | 1 - 6 files changed, 21 insertions(+), 33 deletions(-) create mode 100644 src/plugins/geoservices/nokia_places_jsondb/nokia_plugin_jsondb.json (limited to 'src/plugins/geoservices/nokia_places_jsondb') diff --git a/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro b/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro index 5e96bb36..6893f21f 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro +++ b/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro @@ -39,3 +39,6 @@ QT += jsondb target.path += $$[QT_INSTALL_PLUGINS]/geoservices INSTALLS += target + +OTHER_FILES += \ + nokia_plugin_jsondb.json diff --git a/src/plugins/geoservices/nokia_places_jsondb/nokia_plugin_jsondb.json b/src/plugins/geoservices/nokia_places_jsondb/nokia_plugin_jsondb.json new file mode 100644 index 00000000..90b89076 --- /dev/null +++ b/src/plugins/geoservices/nokia_places_jsondb/nokia_plugin_jsondb.json @@ -0,0 +1,14 @@ +{ + "Keys": ["nokia_places_jsondb"], + "Provider": "nokia_places_jsondb", + "Version": 100, + "Experimental": false, + "Features": [ + "OfflinePlacesFeature", + "SavePlaceFeature", + "RemovePlaceFeature", + "SaveCategoryFeature", + "RemoveCategoryFeature", + "PlaceMatchingFeature" + ] +} diff --git a/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.cpp b/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.cpp index 38252582..4c2bd548 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.cpp +++ b/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.cpp @@ -51,21 +51,6 @@ QGeoServiceProviderFactoryJsonDb::QGeoServiceProviderFactoryJsonDb() {} QGeoServiceProviderFactoryJsonDb::~QGeoServiceProviderFactoryJsonDb() {} -QString QGeoServiceProviderFactoryJsonDb::providerName() const -{ - return QLatin1String("nokia_places_jsondb"); -} - -QStringList QGeoServiceProviderFactoryJsonDb::keys() const -{ - return QStringList() << QLatin1String("nokia_places_jsondb"); -} - -int QGeoServiceProviderFactoryJsonDb::providerVersion() const -{ - return 1; -} - QGeocodingManagerEngine* QGeoServiceProviderFactoryJsonDb::createGeocodingManagerEngine(const QMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const @@ -106,6 +91,4 @@ QPlaceManagerEngine *QGeoServiceProviderFactoryJsonDb::createPlaceManagerEngine( return new QPlaceManagerEngineJsonDb(parameters, error, errorString); } -Q_EXPORT_PLUGIN2(qtgeoservices_nokia_places_jsondb, QGeoServiceProviderFactoryJsonDb) - QT_END_NAMESPACE diff --git a/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.h b/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.h index 3674fb6e..59a19abb 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.h +++ b/src/plugins/geoservices/nokia_places_jsondb/qgeoserviceproviderplugin_jsondb.h @@ -50,16 +50,14 @@ QT_BEGIN_NAMESPACE class QGeoServiceProviderFactoryJsonDb : public QObject, public QGeoServiceProviderFactory { Q_OBJECT - Q_INTERFACES(QGeoServiceProviderFactory:QFactoryInterface) + Q_INTERFACES(QGeoServiceProviderFactory) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0" + FILE "nokia_plugin_jsondb.json") + public: QGeoServiceProviderFactoryJsonDb(); ~QGeoServiceProviderFactoryJsonDb(); - QString providerName() const; - int providerVersion() const; - - QStringList keys() const; - QGeocodingManagerEngine* createGeocodingManagerEngine(const QMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const; diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp index 7a08b47c..cf257ff5 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp +++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.cpp @@ -307,15 +307,6 @@ QUrl QPlaceManagerEngineJsonDb::constructIconUrl(const QPlaceIcon &icon, const Q return QUrl(); } -QPlaceManager::ManagerFeatures QPlaceManagerEngineJsonDb::supportedFeatures() const -{ - return QPlaceManager::SavePlaceFeature | - QPlaceManager::RemovePlaceFeature | - QPlaceManager::SaveCategoryFeature | - QPlaceManager::RemoveCategoryFeature | - QPlaceManager::MatchingFeature; -} - QPlaceMatchReply * QPlaceManagerEngineJsonDb::matchingPlaces(const QPlaceMatchRequest &request) { MatchReply *reply = new MatchReply(this); diff --git a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h index 79863039..388aaa97 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h +++ b/src/plugins/geoservices/nokia_places_jsondb/qplacemanagerengine_jsondb.h @@ -103,7 +103,6 @@ public: QPlace compatiblePlace(const QPlace &original) const; QUrl constructIconUrl(const QPlaceIcon &icon, const QSize &size) const; - QPlaceManager::ManagerFeatures supportedFeatures() const; JsonDb *db() { return m_jsonDb;} QPlaceManager *manager() const { return QPlaceManagerEngine::manager(); } -- cgit v1.2.1