diff options
-rw-r--r-- | src/sensors/gestures/qsensorgesturemanagerprivate.cpp | 12 | ||||
-rw-r--r-- | src/sensors/gestures/qsensorgesturemanagerprivate_p.h | 3 | ||||
-rw-r--r-- | src/sensors/qsensorpluginloader.cpp | 12 | ||||
-rw-r--r-- | src/sensors/qsensorpluginloader_p.h | 3 |
4 files changed, 14 insertions, 16 deletions
diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp b/src/sensors/gestures/qsensorgesturemanagerprivate.cpp index 292248b..c8e7053 100644 --- a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp +++ b/src/sensors/gestures/qsensorgesturemanagerprivate.cpp @@ -50,20 +50,17 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QSensorGestureFactoryInterface_iid, QLatin1String("/sensorgestures"))) -#endif - QSensorGestureManagerPrivate::QSensorGestureManagerPrivate(QObject *parent) : QObject(parent) { + loader = new QFactoryLoader(QSensorGestureFactoryInterface_iid, QLatin1String("/sensorgestures")); loadPlugins(); } QSensorGestureManagerPrivate::~QSensorGestureManagerPrivate() { qDeleteAll(registeredSensorGestures); + delete loader; } @@ -92,10 +89,9 @@ QSensorGestureManagerPrivate::~QSensorGestureManagerPrivate() */ void QSensorGestureManagerPrivate::loadPlugins() { - QFactoryLoader *l = loader(); - foreach (const QString &key, l->keys()) { + foreach (const QString &key, loader->keys()) { - QObject *plugin = l->instance(key); + QObject *plugin = loader->instance(key); if (plugin) { initPlugin(plugin); } diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h b/src/sensors/gestures/qsensorgesturemanagerprivate_p.h index a166fac..1bf527a 100644 --- a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h +++ b/src/sensors/gestures/qsensorgesturemanagerprivate_p.h @@ -52,6 +52,8 @@ #include "qsensorgesture.h" #include "qsensorgesturerecognizer.h" +class QFactoryLoader; + class QSensorGestureManagerPrivate : public QObject { Q_OBJECT @@ -63,6 +65,7 @@ public: QList <QObject *> plugins; + QFactoryLoader *loader; void loadPlugins(); bool loadRecognizer(const QString &id); diff --git a/src/sensors/qsensorpluginloader.cpp b/src/sensors/qsensorpluginloader.cpp index 7c9ab71..f2c8a19 100644 --- a/src/sensors/qsensorpluginloader.cpp +++ b/src/sensors/qsensorpluginloader.cpp @@ -50,18 +50,15 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QSensorFactoryInterface_iid, QLatin1String("/sensors"))) -#endif - QSensorPluginLoader::QSensorPluginLoader() { + m_loader = new QFactoryLoader(QSensorFactoryInterface_iid, QLatin1String("/sensors")); load(); } QSensorPluginLoader::~QSensorPluginLoader() { + delete m_loader; } QList<QObject*> QSensorPluginLoader::plugins() const @@ -77,10 +74,9 @@ void QSensorPluginLoader::load() bool reportErrors = (qgetenv("QT_DEBUG_PLUGINS") == "1"); /* Now discover the dynamic plugins */ - QFactoryLoader *l = loader(); - foreach (const QString &key, l->keys()) { + foreach (const QString &key, m_loader->keys()) { - QObject *o = l->instance(key); + QObject *o = m_loader->instance(key); if (o != 0) { QSensorPluginInterface *p = qobject_cast<QSensorPluginInterface*>(o); if (p != 0) { diff --git a/src/sensors/qsensorpluginloader_p.h b/src/sensors/qsensorpluginloader_p.h index 552b326..634c498 100644 --- a/src/sensors/qsensorpluginloader_p.h +++ b/src/sensors/qsensorpluginloader_p.h @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE +class QFactoryLoader; + class QSensorPluginLoader { public: @@ -71,6 +73,7 @@ public: private: void load(); + QFactoryLoader *m_loader; QList<QObject*> m_plugins; }; |