diff options
Diffstat (limited to 'SwifTools/Idle/IdleDetector.h')
| -rw-r--r-- | SwifTools/Idle/IdleDetector.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/SwifTools/Idle/IdleDetector.h b/SwifTools/Idle/IdleDetector.h index 1fb3d69..bd7175d 100644 --- a/SwifTools/Idle/IdleDetector.h +++ b/SwifTools/Idle/IdleDetector.h @@ -1,24 +1,38 @@ #pragma once #include <boost/signals.hpp> #include <boost/shared_ptr.hpp> namespace Swift { class IdleDetector { public: + IdleDetector() : idle(false) {} virtual ~IdleDetector(); void setIdleTimeSeconds(int time) { idleTimeSeconds = time; } int getIdleTimeSeconds() const { return idleTimeSeconds; } + virtual bool isIdle() const { + return idle; + } + boost::signal<void (bool /* isIdle */)> onIdleChanged; + protected: + void setIdle(bool b) { + if (b != idle) { + idle = b; + onIdleChanged(b); + } + } + private: int idleTimeSeconds; + bool idle; }; } |
Swift