ktimetracker
idletimedetector.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KARM_IDLE_TIME_DETECTOR_H
00024 #define KARM_IDLE_TIME_DETECTOR_H
00025
00026 #include "ktimetrackerutility.h"
00027 #include <QDateTime>
00028 #include <QObject>
00029 #include <config-karm.h>
00030
00031 class QTimer;
00032
00033 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
00034 #include <X11/Xlib.h>
00035 #include <X11/Xutil.h>
00036 #include <X11/extensions/scrnsaver.h>
00037 #include <fixx11h.h>
00038 #endif // HAVE_LIBXSS
00039
00040
00041 const int testInterval= secsPerMinute * 1000;
00042
00047 class IdleTimeDetector :public QObject
00048 {
00049 Q_OBJECT
00050
00051 public:
00056 IdleTimeDetector(int maxIdle);
00057
00063 bool isIdleDetectionPossible();
00064
00065 Q_SIGNALS:
00072 void extractTime(int minutes);
00073
00077 void stopAllTimers(QDateTime time);
00078
00079 public Q_SLOTS:
00080 void revert();
00081
00086 void setMaxIdle(int maxIdle);
00087
00091 void startIdleDetection();
00092
00096 void stopIdleDetection();
00097
00103 void toggleOverAllIdleDetection(bool on);
00104
00105
00106 protected:
00107 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
00108 void informOverrun();
00109 #endif // HAVE_LIBXSS
00110
00111 protected Q_SLOTS:
00112 void check();
00113
00114 private:
00115 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
00116 XScreenSaverInfo *_mit_info;
00117 #endif
00118 bool _idleDetectionPossible;
00119 bool _overAllIdleDetect;
00120 int _maxIdle;
00121 QTimer *_timer;
00122 QDateTime start;
00123 QDateTime idlestart;
00124 int idleminutes;
00125 };
00126
00127 #endif // KARM_IDLE_TIME_DETECTOR_H