summaryrefslogtreecommitdiff
path: root/sowatchd/daemon.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-25 01:36:10 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-25 01:36:10 +0200
commit2b4e878938215ac743bdc36deace4c2a4cb0c7a2 (patch)
treeb2b8341615898e5cbf5cdb08ee34a629df093897 /sowatchd/daemon.cpp
parent5153fb9a2b5d8a7af069a75b75bdc7bee591d0a9 (diff)
downloadsowatch-2b4e878938215ac743bdc36deace4c2a4cb0c7a2.tar.gz
sowatch-2b4e878938215ac743bdc36deace4c2a4cb0c7a2.zip
preparing for watchlet support
Diffstat (limited to 'sowatchd/daemon.cpp')
-rw-r--r--sowatchd/daemon.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/sowatchd/daemon.cpp b/sowatchd/daemon.cpp
index 645ecf6..26cbad0 100644
--- a/sowatchd/daemon.cpp
+++ b/sowatchd/daemon.cpp
@@ -3,6 +3,7 @@
#include <QtCore/QSettings>
#include <QtCore/QDir>
#include <sowatch.h>
+#include <testwatchlet.h>
#include "daemon.h"
using namespace sowatch;
@@ -108,6 +109,9 @@ void Daemon::initWatch(Watch* watch, QSettings& settings)
WatchServer* server = new WatchServer(watch, this);
_servers.append(server);
+ // Configure the server
+ server->setNextWatchletButton(settings.value("nextWatchletButton").toString());
+
// Initialize providers
size = settings.beginReadArray("notifications");
for (int i = 0; i < size; i++) {
@@ -120,25 +124,40 @@ void Daemon::initWatch(Watch* watch, QSettings& settings)
}
}
+ // Initialize test watchlets
+ new TestWatchlet(server);
+
settings.endArray();
}
void Daemon::loadWatchlets()
{
-#if 0
QDir dir(SOWATCH_WATCHLETS_DIR);
foreach (QString file, dir.entryList(QDir::Files)) {
+#if defined(Q_OS_UNIX)
+ // Temporary workaround for QtC deploy plugin issues
+ if (!file.endsWith(".so")) continue;
+#endif
QPluginLoader loader(dir.absoluteFilePath(file));
QObject *pluginObj = loader.instance();
if (pluginObj) {
- WatchPluginInterface *plugin = qobject_cast<WatchPluginInterface*>(pluginObj);
+#if 0
+ WatchletPluginInterface *plugin = qobject_cast<WatchletPluginInterface*>(pluginObj);
if (plugin) {
- QStringList drivers = plugin->drivers();
- foreach (const QString& driver, drivers) {
- _drivers[driver] = plugin;
+ QStringList providers = plugin->providers();
+ foreach (const QString& provider, providers) {
+ _providers[provider] = plugin;
}
+ } else {
+ qWarning() << "Invalid plugin" << file;
+ loader.unload();
}
+#endif
+ } else {
+ qWarning() << "Invalid plugin" << file << loader.errorString();
+ loader.unload();
}
}
-#endif
+
+ qDebug() << "loaded watchlets";
}