diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-05-11 20:15:36 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-05-11 20:15:36 +0200 |
commit | ac182bd9bf076b4d03d4812e85b989edae32d756 (patch) | |
tree | 7d05a80a2e6e44e3fe0dbd3384bf6c18321fa2b8 /libsowatch/watchserver.cpp | |
parent | 505f7b1cf62c6934f5246c5e62eccb0a26cb1ce2 (diff) | |
download | sowatch-ac182bd9bf076b4d03d4812e85b989edae32d756.tar.gz sowatch-ac182bd9bf076b4d03d4812e85b989edae32d756.zip |
able to navigate watchlets in liveview
Diffstat (limited to 'libsowatch/watchserver.cpp')
-rw-r--r-- | libsowatch/watchserver.cpp | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp index c82c3ee..06a8189 100644 --- a/libsowatch/watchserver.cpp +++ b/libsowatch/watchserver.cpp @@ -11,7 +11,6 @@ using namespace sowatch; WatchServer::WatchServer(Watch* watch, QObject* parent) : QObject(parent), _watch(watch), - _nextWatchletButton(-1), _oldNotificationThreshold(300), _idleWatchlet(0), _notificationWatchlet(0), _watchlets(new WatchletsModel(this)), @@ -22,9 +21,10 @@ WatchServer::WatchServer(Watch* watch, QObject* parent) : connect(_watch, SIGNAL(connected()), SLOT(handleWatchConnected())); connect(_watch, SIGNAL(disconnected()), SLOT(handleWatchDisconnected())); connect(_watch, SIGNAL(idling()), SLOT(handleWatchIdling())); - connect(_watch, SIGNAL(buttonPressed(int)), SLOT(handleWatchButtonPress(int))); + connect(_watch, SIGNAL(nextWatchletRequested()), SLOT(handleNextWatchletRequested())); connect(_watch, SIGNAL(watchletRequested(QString)), SLOT(handleWatchletRequested(QString))); + connect(_watch, SIGNAL(closeWatchledRequested()), SLOT(handleCloseWatchletRequested())); connect(_syncTimeTimer, SIGNAL(timeout()), SLOT(syncTime())); _syncTimeTimer->setSingleShot(true); @@ -43,27 +43,6 @@ const Watch* WatchServer::watch() const return _watch; } -QString WatchServer::nextWatchletButton() const -{ - if (_nextWatchletButton >= 0) { - return _watch->buttons().at(_nextWatchletButton); - } else { - return QString(); - } -} - -void WatchServer::setNextWatchletButton(const QString& value) -{ - if (value.isEmpty()) { - _nextWatchletButton = -1; - return; - } - _nextWatchletButton = _watch->buttons().indexOf(value); - if (_nextWatchletButton < 0) { - qWarning() << "Invalid watch button" << value; - } -} - Watchlet * WatchServer::idleWatchlet() { return _idleWatchlet; @@ -392,18 +371,16 @@ void WatchServer::handleWatchIdling() } } -void WatchServer::handleWatchButtonPress(int button) +void WatchServer::handleNextWatchletRequested() { - if (button == _nextWatchletButton) { - qDebug() << "next watchlet button pressed"; - if (_pendingNotifications.empty()) { - // No notifications: either app or idle mode. - nextWatchlet(); - } else { - // Skip to next notification if any - _pendingNotifications.dequeue(); - nextNotification(); - } + qDebug() << "next watchlet button pressed"; + if (_pendingNotifications.empty()) { + // No notifications: either app or idle mode. + nextWatchlet(); + } else { + // Skip to next notification if any + _pendingNotifications.dequeue(); + nextNotification(); } } @@ -412,6 +389,11 @@ void WatchServer::handleWatchletRequested(const QString &id) openWatchlet(id); } +void WatchServer::handleCloseWatchletRequested() +{ + closeWatchlet(); +} + void WatchServer::handleNotificationChanged() { QObject *obj = sender(); |