diff options
author | Alex Wilson <alex.wilson@nokia.com> | 2012-02-28 13:05:02 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-05 04:22:24 +0100 |
commit | 0287bfee05840511c12100f06f9142e3e2b8f7d5 (patch) | |
tree | f5386e27a4b012877d37ab0b99dfc1d5a08705c5 /src/plugins/geoservices/nokia_places_jsondb | |
parent | c1d56bdae90f79d466769aa7a357d78a4f2ca6c7 (diff) | |
download | qtlocation-0287bfee05840511c12100f06f9142e3e2b8f7d5.tar.gz |
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 <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/plugins/geoservices/nokia_places_jsondb')
6 files changed, 21 insertions, 33 deletions
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<QString, QVariant> ¶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<QString, QVariant> ¶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(); } |