diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-09-16 20:51:27 +0200 |
---|---|---|
committer | Javier <javier@pcjavier.(none)> | 2011-09-16 20:51:27 +0200 |
commit | b6060852c4b317cd73043cdc82b652d187d952fd (patch) | |
tree | a5795eb33379e7172cd16962c131b8bac8db16da /declarativewatchwrapper.cpp | |
parent | aa1c0fd3146b4ed055d181c99d52463afa6bedbb (diff) | |
download | sowatch-b6060852c4b317cd73043cdc82b652d187d952fd.tar.gz sowatch-b6060852c4b317cd73043cdc82b652d187d952fd.zip |
Fixing some bugs in damage tracking on real N950
Diffstat (limited to 'declarativewatchwrapper.cpp')
-rw-r--r-- | declarativewatchwrapper.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/declarativewatchwrapper.cpp b/declarativewatchwrapper.cpp index 127b6d6..384a29d 100644 --- a/declarativewatchwrapper.cpp +++ b/declarativewatchwrapper.cpp @@ -5,7 +5,7 @@ using namespace sowatch; DeclarativeWatchWrapper::DeclarativeWatchWrapper(Watch* watch, QObject *parent) : - QObject(parent), _watch(watch) + QObject(parent), _watch(watch), _active(false) { } @@ -15,15 +15,28 @@ QString DeclarativeWatchWrapper::model() const return _watch->model(); } +bool DeclarativeWatchWrapper::active() const +{ + return _active; +} + void DeclarativeWatchWrapper::activate() { - connect(_watch, SIGNAL(buttonPressed(int)), this, SIGNAL(buttonPressed(int))); - connect(_watch, SIGNAL(buttonReleased(int)), this, SIGNAL(buttonReleased(int))); + if (!_active) { + connect(_watch, SIGNAL(buttonPressed(int)), this, SIGNAL(buttonPressed(int))); + connect(_watch, SIGNAL(buttonReleased(int)), this, SIGNAL(buttonReleased(int))); + _active = true; + emit activeChanged(); + } } void DeclarativeWatchWrapper::deactivate() { - disconnect(this, SIGNAL(buttonPressed(int))); - disconnect(this, SIGNAL(buttonReleased(int))); + if (_active) { + disconnect(this, SIGNAL(buttonPressed(int))); + disconnect(this, SIGNAL(buttonReleased(int))); + _active = false; + emit activeChanged(); + } } |