diff options
author | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2012-03-14 15:59:49 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-16 08:02:10 +0100 |
commit | 1530ebcc019bf6c630e75ac3078586b70c6056e3 (patch) | |
tree | 4bb9cfc7f1be172dcc89b2c210434413debece57 | |
parent | afefdd5df374d8cfeca4614f4d25397fa6c997fe (diff) | |
download | qtsensors-1530ebcc019bf6c630e75ac3078586b70c6056e3.tar.gz |
Remove REGISTER_STATIC_PLUGIN
This API was never particularly reliable. It is somewhat incompatible
with the new-style Qt plugins.
Change-Id: Iaaa0e6282404ce5477abcc8b905b14b1fb58644c
Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
-rw-r--r-- | src/sensors/qsensormanager.cpp | 30 | ||||
-rw-r--r-- | src/sensors/qsensormanager.h | 20 | ||||
-rw-r--r-- | tests/auto/qsensor/test_sensorplugin.cpp | 13 | ||||
-rw-r--r-- | tests/auto/qsensor/tst_qsensor.cpp | 3 |
4 files changed, 0 insertions, 66 deletions
diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp index 053e62e..401eeaa 100644 --- a/src/sensors/qsensormanager.cpp +++ b/src/sensors/qsensormanager.cpp @@ -76,8 +76,6 @@ public: PluginLoadingState pluginLoadingState; void loadPlugins(); - QList<CreatePluginFunc> staticRegistrations; - // Holds a mapping from type to available identifiers (and from there to the factory) BackendIdentifiersForTypeMap backendsByType; @@ -182,13 +180,6 @@ void QSensorManagerPrivate::loadPlugins() if (d->pluginLoadingState != QSensorManagerPrivate::NotLoaded) return; d->pluginLoadingState = QSensorManagerPrivate::Loading; - SENSORLOG() << "initializing legacy static plugins"; - // Legacy static plugins - Q_FOREACH (CreatePluginFunc func, d->staticRegistrations) { - QSensorPluginInterface *plugin = func(); - plugin->registerSensors(); - } - SENSORLOG() << "initializing static plugins"; // Qt-style static plugins Q_FOREACH (QObject *plugin, QPluginLoader::staticInstances()) { @@ -303,15 +294,6 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray } /*! - \internal -*/ -void QSensorManager::registerStaticPlugin(CreatePluginFunc func) -{ - QSensorManagerPrivate *d = sensorManagerPrivate(); - d->staticRegistrations.append(func); -} - -/*! Create a backend for \a sensor. Returns null if no suitable backend exists. */ QSensorBackend *QSensorManager::createBackend(QSensor *sensor) @@ -532,18 +514,6 @@ void QSensor::registerInstance() If the factory cannot create a backend it should return 0. */ -/*! - \macro REGISTER_STATIC_PLUGIN(pluginname) - \relates QSensorManager - - Registers a static plugin, \a pluginname. - - Note that this macro relies on static initialization so it may not be appropriate - for use in a library and may not work on all platforms. - - \sa {Creating a sensor plugin} -*/ - QT_END_NAMESPACE #include "qsensormanager.moc" diff --git a/src/sensors/qsensormanager.h b/src/sensors/qsensormanager.h index f23f9e7..1a1306a 100644 --- a/src/sensors/qsensormanager.h +++ b/src/sensors/qsensormanager.h @@ -51,8 +51,6 @@ class QSensorBackend; class QSensorBackendFactory; class QSensorPluginInterface; -typedef QSensorPluginInterface *(*CreatePluginFunc)(); - class Q_SENSORS_EXPORT QSensorManager { public: @@ -65,9 +63,6 @@ public: // Create a backend (uses the type and identifier set in the sensor) static QSensorBackend *createBackend(QSensor *sensor); - // For static plugins - static void registerStaticPlugin(CreatePluginFunc func); - static void setDefaultBackend(const QByteArray &type, const QByteArray &identifier); }; @@ -79,21 +74,6 @@ protected: ~QSensorBackendFactory() {} }; -// Static plugins have their own registration methods. -// They can only register types. They cannot use the changes interface. -#define REGISTER_STATIC_PLUGIN(pluginname) \ - static QSensorPluginInterface *create_static_plugin_ ## pluginname()\ - {\ - return new pluginname;\ - }\ - static bool side_effect_sensor_backend_ ## pluginname ()\ - {\ - QSensorManager::registerStaticPlugin(create_static_plugin_ ## pluginname);\ - return false;\ - }\ - /* This assignment calls the function above */\ - static bool dummy_sensor_backend_ ## pluginname = side_effect_sensor_backend_ ## pluginname(); - QT_END_NAMESPACE QT_END_HEADER diff --git a/tests/auto/qsensor/test_sensorplugin.cpp b/tests/auto/qsensor/test_sensorplugin.cpp index 6633bf8..08d6cd3 100644 --- a/tests/auto/qsensor/test_sensorplugin.cpp +++ b/tests/auto/qsensor/test_sensorplugin.cpp @@ -120,17 +120,4 @@ public: REGISTER_STATIC_PLUGIN_V2(TestSensorPlugin) -class LegacySensorPlugin : public QSensorPluginInterface -{ -public: - void registerSensors() - { - qWarning() << "Loaded the LegacySensorPlugin"; - } - QStringList keys() const { return QStringList() << "legacy";} - -}; - -REGISTER_STATIC_PLUGIN(LegacySensorPlugin) - #include "test_sensorplugin.moc" diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp index 45b2ab3..5a697ee 100644 --- a/tests/auto/qsensor/tst_qsensor.cpp +++ b/tests/auto/qsensor/tst_qsensor.cpp @@ -140,9 +140,6 @@ private slots: { TestSensor sensor; - // This confirms that legacy static plugins can still be registered - QTest::ignoreMessage(QtWarningMsg, "Loaded the LegacySensorPlugin "); - // The logic for the test is in test_sensorplugin.cpp (which warns and aborts if the test fails) (void)QSensor::sensorTypes(); |