summaryrefslogtreecommitdiff
path: root/libsowatch
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-12-09 02:26:31 +0100
committerJavier S. Pedro <maemo@javispedro.com>2011-12-09 02:26:31 +0100
commit140c6bfafe91007c7e24ebf59270c8ad8060e875 (patch)
tree59c23a95edb83736fb914ade8fc287c5490528fd /libsowatch
parentcbf8e3ad49917dc71e8c5f6413c55f266c1c4ad3 (diff)
downloadsowatch-140c6bfafe91007c7e24ebf59270c8ad8060e875.tar.gz
sowatch-140c6bfafe91007c7e24ebf59270c8ad8060e875.zip
Removing the entire grabButton/ungrab mechanism
Applications&server no longer have to grab/ungrab buttons. Also, LED button should now work everywhere in digital MetaWatch.
Diffstat (limited to 'libsowatch')
-rw-r--r--libsowatch/declarativewatchwrapper.cpp21
-rw-r--r--libsowatch/declarativewatchwrapper.h2
-rw-r--r--libsowatch/watch.h7
-rw-r--r--libsowatch/watchserver.cpp3
-rw-r--r--libsowatch/watchserver.h4
5 files changed, 4 insertions, 33 deletions
diff --git a/libsowatch/declarativewatchwrapper.cpp b/libsowatch/declarativewatchwrapper.cpp
index 122545f..ebf92b5 100644
--- a/libsowatch/declarativewatchwrapper.cpp
+++ b/libsowatch/declarativewatchwrapper.cpp
@@ -36,16 +36,6 @@ QList<QObject*> DeclarativeWatchWrapper::notifications() const
return ol;
}
-void DeclarativeWatchWrapper::useButton(int button)
-{
- if (!_usedButtons.contains(button)) {
- _usedButtons.insert(button);
- if (_active) {
- _watch->grabButton(button);
- }
- }
-}
-
void DeclarativeWatchWrapper::vibrate(int msecs)
{
if (_active) {
@@ -58,11 +48,6 @@ void DeclarativeWatchWrapper::activate()
if (!_active) {
_active = true;
- // Grab all of the buttons used by this watchlet
- foreach (int button, _usedButtons) {
- _watch->grabButton(button);
- }
-
// Forward the button signals
connect(_watch, SIGNAL(buttonPressed(int)), this, SIGNAL(buttonPressed(int)));
connect(_watch, SIGNAL(buttonReleased(int)), this, SIGNAL(buttonReleased(int)));
@@ -84,13 +69,7 @@ void DeclarativeWatchWrapper::deactivate()
// Stop forwarding button presses
disconnect(_watch, 0, this, 0);
- // Ungrab all the buttons used by this watchlet
- foreach (int button, _usedButtons) {
- _watch->ungrabButton(button);
- }
-
// Emit the deactivated signal
emit activeChanged();
}
}
-
diff --git a/libsowatch/declarativewatchwrapper.h b/libsowatch/declarativewatchwrapper.h
index 5a827ab..8d4fd7d 100644
--- a/libsowatch/declarativewatchwrapper.h
+++ b/libsowatch/declarativewatchwrapper.h
@@ -28,7 +28,6 @@ public:
QList<QObject*> notifications() const;
public slots:
- void useButton(int button);
void vibrate(int msecs);
signals:
@@ -42,7 +41,6 @@ private:
WatchServer *_server;
Watch* _watch;
bool _active;
- QSet<int> _usedButtons;
void activate();
void deactivate();
diff --git a/libsowatch/watch.h b/libsowatch/watch.h
index eb572eb..60a66bd 100644
--- a/libsowatch/watch.h
+++ b/libsowatch/watch.h
@@ -55,11 +55,6 @@ public:
virtual void queryCharging() = 0;
virtual bool charging() const = 0;
- /** Grabs a button from whatever is default function is for the current mode. */
- virtual void grabButton(int button) = 0;
- /** Restores a button to its default function. */
- virtual void ungrabButton(int button) = 0;
-
/** Tells the watch to update the unread notifications count, if visible. */
virtual void updateNotificationCount(Notification::Type type, int count) = 0;
@@ -71,7 +66,7 @@ public slots:
virtual void displayIdleScreen() = 0;
/** A standard notification; it's up to the watch when to stop showing it. */
virtual void displayNotification(Notification* notification) = 0;
- /** Enter application mode. */
+ /** Enter application mode; after this, server can draw on the QPaintDevice. */
virtual void displayApplication() = 0;
/** Vibrate for a while. The default implementation does nothing. */
diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp
index 9d7859d..acb54c3 100644
--- a/libsowatch/watchserver.cpp
+++ b/libsowatch/watchserver.cpp
@@ -141,9 +141,6 @@ uint WatchServer::getNotificationCount(Notification::Type type)
void WatchServer::goToIdle()
{
_watch->displayIdleScreen();
- if (_nextWatchletButton >= 0) {
- _watch->grabButton(_nextWatchletButton);
- }
}
void WatchServer::watchConnected()
diff --git a/libsowatch/watchserver.h b/libsowatch/watchserver.h
index f86d224..523efd5 100644
--- a/libsowatch/watchserver.h
+++ b/libsowatch/watchserver.h
@@ -77,11 +77,13 @@ private:
/** Used for periodic time syncing. */
QTimer* _syncTimeTimer;
+ /** Called by Watchlet constructor to register itself as a child. */
void registerWatchlet(Watchlet *watchlet);
- void reactivateCurrentWatchlet();
+ /** Counts all notifications from a given type. */
uint getNotificationCount(Notification::Type type);
+ void reactivateCurrentWatchlet();
void goToIdle();
private slots: