karm
idletimedetector.h00001 #ifndef KARM_IDLE_TIME_DETECTOR_H
00002 #define KARM_IDLE_TIME_DETECTOR_H
00003
00004 #include <qobject.h>
00005 #include "config.h"
00006
00007 class QTimer;
00008
00009 #ifdef HAVE_LIBXSS
00010 #include <X11/Xlib.h>
00011 #include <X11/Xutil.h>
00012 #include <X11/extensions/scrnsaver.h>
00013 #include <fixx11h.h>
00014 #endif // HAVE_LIBXSS
00015
00016
00017 const int secsPerMinute = 60;
00018
00019
00020 const int testInterval= secsPerMinute * 1000;
00021
00026 class IdleTimeDetector :public QObject
00027 {
00028 Q_OBJECT
00029
00030 public:
00035 IdleTimeDetector(int maxIdle);
00036
00042 bool isIdleDetectionPossible();
00043
00044 signals:
00051 void extractTime(int minutes);
00052
00056 void stopAllTimers();
00057
00058 public slots:
00063 void setMaxIdle(int maxIdle);
00064
00068 void startIdleDetection();
00069
00073 void stopIdleDetection();
00074
00080 void toggleOverAllIdleDetection(bool on);
00081
00082
00083 protected:
00084 #ifdef HAVE_LIBXSS
00085 void informOverrun(int idle);
00086 #endif // HAVE_LIBXSS
00087
00088 protected slots:
00089 void check();
00090
00091 private:
00092 #ifdef HAVE_LIBXSS
00093 XScreenSaverInfo *_mit_info;
00094 #endif
00095 bool _idleDetectionPossible;
00096 bool _overAllIdleDetect;
00097 int _maxIdle;
00098 QTimer *_timer;
00099 };
00100
00101 #endif // KARM_IDLE_TIME_DETECTOR_H
|