summaryrefslogtreecommitdiff
path: root/libsowatch/watchserver.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-27 04:51:30 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-27 04:51:30 +0200
commita644a7cc6749f8dd5ca20589ee6e59acc2892b3e (patch)
treeb995528dc14d1f58d9d7c958d1eaad855b2a2412 /libsowatch/watchserver.cpp
parent0822b88738e00625efd27ccca9119885272924d2 (diff)
downloadsowatch-a644a7cc6749f8dd5ca20589ee6e59acc2892b3e.tar.gz
sowatch-a644a7cc6749f8dd5ca20589ee6e59acc2892b3e.zip
new qmafw watchlet
Diffstat (limited to 'libsowatch/watchserver.cpp')
-rw-r--r--libsowatch/watchserver.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp
index c81d937..9f11795 100644
--- a/libsowatch/watchserver.cpp
+++ b/libsowatch/watchserver.cpp
@@ -49,7 +49,7 @@ void WatchServer::setNextWatchletButton(const QString& value)
void WatchServer::addProvider(NotificationProvider *provider)
{
provider->setParent(this);
- connect(provider, SIGNAL(incomingNotification(Notification*)), SLOT(notificationReceived(Notification*)));
+ connect(provider, SIGNAL(incomingNotification(Notification*)), SLOT(postNotification(Notification*)));
// And that's it, really.
}
@@ -80,7 +80,9 @@ void WatchServer::closeWatchlet()
void WatchServer::registerWatchlet(Watchlet *watchlet)
{
Q_ASSERT(watchlet->_server == this);
- _watchlets[watchlet->id()] = watchlet;
+ QString id = watchlet->id();
+ _watchlets[id] = watchlet;
+ _watchletIds.append(id);
}
void WatchServer::reactivateCurrentWatchlet()
@@ -92,13 +94,13 @@ void WatchServer::reactivateCurrentWatchlet()
void WatchServer::nextWatchlet()
{
- QStringList watchlets = _watchlets.keys();
+ qDebug() << "current watchlet index" << _currentWatchletIndex;
_currentWatchletIndex++;
- if (_currentWatchletIndex >= watchlets.size()) {
+ if (_currentWatchletIndex >= _watchletIds.size() || _currentWatchletIndex < 0) {
_currentWatchletIndex = -1;
closeWatchlet();
} else {
- QString watchlet = watchlets.at(_currentWatchletIndex);
+ QString watchlet = _watchletIds.at(_currentWatchletIndex);
runWatchlet(watchlet);
}
}
@@ -176,7 +178,7 @@ void WatchServer::watchButtonPress(int button)
}
}
-void WatchServer::notificationReceived(Notification *notification)
+void WatchServer::postNotification(Notification *notification)
{
const Notification::Type type = notification->type();
_notifications[type].append(notification);