summaryrefslogtreecommitdiff
path: root/libsowatch/registry.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-04-26 01:36:20 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-04-26 01:36:20 +0200
commit93f3acd128d6b349efe14e97b12c2703ca4f81f3 (patch)
tree937f3de2307444f0c28d6d21f26f1580e789b074 /libsowatch/registry.h
parent1375a26b135547fdd8e07db62acf8116a8482560 (diff)
downloadsowatch-93f3acd128d6b349efe14e97b12c2703ca4f81f3.tar.gz
sowatch-93f3acd128d6b349efe14e97b12c2703ca4f81f3.zip
Moved the core framework to GConf & D-Bus
Diffstat (limited to 'libsowatch/registry.h')
-rw-r--r--libsowatch/registry.h52
1 files changed, 45 insertions, 7 deletions
diff --git a/libsowatch/registry.h b/libsowatch/registry.h
index ca7252a..74e9388 100644
--- a/libsowatch/registry.h
+++ b/libsowatch/registry.h
@@ -1,8 +1,10 @@
#ifndef SOWATCH_REGISTRY_H
#define SOWATCH_REGISTRY_H
+#include <QtCore/QPluginLoader>
#include <QtCore/QString>
#include <QtCore/QMap>
+#include <QtCore/QFileSystemWatcher>
#include "sowatch_global.h"
namespace sowatch
@@ -12,21 +14,35 @@ class WatchPluginInterface;
class NotificationPluginInterface;
class WatchletPluginInterface;
-class SOWATCH_EXPORT Registry
+class SOWATCH_EXPORT Registry : public QObject
{
+ Q_OBJECT
+
public:
static Registry* registry();
+ inline QList<WatchPluginInterface*> getWatchPlugins() {
+ return _drivers;
+ }
+
+ inline QList<NotificationPluginInterface*> getNotificationPlugins() {
+ return _providers;
+ }
+
+ inline QList<WatchletPluginInterface*> getWatchletPlugins() {
+ return _watchlets;
+ }
+
inline WatchPluginInterface* getWatchPlugin(const QString& id) {
- return _drivers.value(id, 0);
+ return _driverIds.value(id, 0);
}
inline NotificationPluginInterface* getNotificationPlugin(const QString& id) {
- return _providers.value(id, 0);
+ return _providerIds.value(id, 0);
}
inline WatchletPluginInterface* getWatchletPlugin(const QString& id) {
- return _watchlets.value(id, 0);
+ return _watchletIds.value(id, 0);
}
protected:
@@ -36,13 +52,35 @@ protected:
private:
static Registry* singleRegistry;
- QMap<QString, WatchPluginInterface*> _drivers;
- QMap<QString, NotificationPluginInterface*> _providers;
- QMap<QString, WatchletPluginInterface*> _watchlets;
+ QFileSystemWatcher* _watcher;
+
+ QList<WatchPluginInterface*> _drivers;
+ QList<NotificationPluginInterface*> _providers;
+ QList<WatchletPluginInterface*> _watchlets;
+
+ QMap<QString, QPluginLoader*> _driverFiles;
+ QMap<QString, QPluginLoader*> _providerFiles;
+ QMap<QString, QPluginLoader*> _watchletFiles;
+
+ QMap<QString, WatchPluginInterface*> _driverIds;
+ QMap<QString, NotificationPluginInterface*> _providerIds;
+ QMap<QString, WatchletPluginInterface*> _watchletIds;
void loadDrivers();
void loadNotificationProviders();
void loadWatchlets();
+
+ void loadDriver(const QString& file);
+ void loadNotificationProvider(const QString& file);
+ void loadWatchlet(const QString& file);
+
+ void unloadDriver(QPluginLoader* loader);
+ void unloadNotificationProvider(QPluginLoader* loader);
+ void unloadWatchlet(QPluginLoader* loader);
+
+private slots:
+ void handlePluginDirectoryChanged(const QString& path);
+ void handlePluginFileChanged(const QString& file);
};
}