summaryrefslogtreecommitdiffstats
path: root/examples/sensors
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2012-03-14 16:33:19 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-16 08:02:30 +0100
commit8d25a4a58c47431c589d8cbbc82e442360cf7e63 (patch)
tree14d4c0f123e602e8528298346f72df5debd2936c /examples/sensors
parentb6d87d1b5141987452bc30e8b1d4115998ba6fd9 (diff)
Use the new plugin mechanism for Sensors and SensorGestures
Plugins no longer use QFactoryInterface or Q_EXPORT_PLUGIN. Instead, Q_PLUGIN_METADATA is used. Meta-data is provided through a .json file that is embedded into the plugin by moc. For now, this meta-data is not actually used because both sensors and gestures use a dynamic registration mechanism. Change-Id: Ic82657e2ba5768127e13f7411ca51f60772781d8 Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'examples/sensors')
-rw-r--r--examples/sensors/grue/plugin/main.cpp6
-rw-r--r--examples/sensors/grue/plugin/plugin.json1
-rw-r--r--examples/sensors/grue/plugin/plugin.pro3
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/plugin.json1
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/plugin.pro3
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp3
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h3
7 files changed, 12 insertions, 8 deletions
diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp
index 713b12ec..36aec298 100644
--- a/examples/sensors/grue/plugin/main.cpp
+++ b/examples/sensors/grue/plugin/main.cpp
@@ -48,7 +48,8 @@
class GrueSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorChangesInterface, public QSensorBackendFactory
{
Q_OBJECT
- Q_INTERFACES(QSensorPluginInterface:QFactoryInterface QSensorChangesInterface)
+ Q_PLUGIN_METADATA(IID "com.nokia.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
+ Q_INTERFACES(QSensorPluginInterface QSensorChangesInterface)
public:
void registerSensors()
{
@@ -74,10 +75,7 @@ public:
return 0;
}
- QStringList keys() const { return QStringList() << "grue";}
};
-Q_EXPORT_PLUGIN2(libsensors_grueplugin, GrueSensorPlugin)
-
#include "main.moc"
diff --git a/examples/sensors/grue/plugin/plugin.json b/examples/sensors/grue/plugin/plugin.json
new file mode 100644
index 00000000..8a55b3ae
--- /dev/null
+++ b/examples/sensors/grue/plugin/plugin.json
@@ -0,0 +1 @@
+{ "Keys": [ "notused" ] }
diff --git a/examples/sensors/grue/plugin/plugin.pro b/examples/sensors/grue/plugin/plugin.pro
index 90d7a01a..489a1cec 100644
--- a/examples/sensors/grue/plugin/plugin.pro
+++ b/examples/sensors/grue/plugin/plugin.pro
@@ -16,3 +16,6 @@ SOURCES += gruesensorimpl.cpp\
target.path=$$[QT_INSTALL_PLUGINS]/sensors
INSTALLS += target
+OTHER_FILES += \
+ plugin.json
+
diff --git a/examples/sensors/qmlsensorgestures/plugin/plugin.json b/examples/sensors/qmlsensorgestures/plugin/plugin.json
new file mode 100644
index 00000000..8a55b3ae
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/plugin/plugin.json
@@ -0,0 +1 @@
+{ "Keys": [ "notused" ] }
diff --git a/examples/sensors/qmlsensorgestures/plugin/plugin.pro b/examples/sensors/qmlsensorgestures/plugin/plugin.pro
index 0e9cb1aa..2003e910 100644
--- a/examples/sensors/qmlsensorgestures/plugin/plugin.pro
+++ b/examples/sensors/qmlsensorgestures/plugin/plugin.pro
@@ -16,3 +16,6 @@ SOURCES += \
target.path += $$[QT_INSTALL_PLUGINS]/sensorgestures
INSTALLS += target
+OTHER_FILES += \
+ plugin.json
+
diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp
index 0d3f2c56..1fda1879 100644
--- a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp
+++ b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp
@@ -73,6 +73,3 @@ QList <QSensorGestureRecognizer *> QCounterGesturePlugin::createRecognizers()
return recognizers;
}
-
-Q_EXPORT_PLUGIN2(QCounterGestureRecognizer, QCounterGesturePlugin)
-
diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h
index 9b73969f..4755f96e 100644
--- a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h
+++ b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h
@@ -49,7 +49,8 @@
class QCounterGesturePlugin : public QObject, public QSensorGesturePluginInterface
{
Q_OBJECT
- Q_INTERFACES(QSensorGesturePluginInterface:QFactoryInterface)
+ Q_PLUGIN_METADATA(IID "com.Nokia.QSensorGesturePluginInterface" FILE "plugin.json")
+ Q_INTERFACES(QSensorGesturePluginInterface)
public:
explicit QCounterGesturePlugin();