idletimedetector.h
00001
#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
#endif // HAVE_LIBXSS
00014
00015
00016
const int secsPerMinute = 60;
00017
00018
00019
const int testInterval= secsPerMinute * 1000;
00020
00025 class IdleTimeDetector :
public QObject
00026 {
00027 Q_OBJECT
00028
00029
public:
00034
IdleTimeDetector(
int maxIdle);
00035
00041
bool isIdleDetectionPossible();
00042
00043 signals:
00050
void extractTime(
int minutes);
00051
00055
void stopAllTimers();
00056
00057
public slots:
00062
void setMaxIdle(
int maxIdle);
00063
00067
void startIdleDetection();
00068
00072
void stopIdleDetection();
00073
00079
void toggleOverAllIdleDetection(
bool);
00080
00081
00082
protected:
00083
#ifdef HAVE_LIBXSS
00084
void informOverrun(
int idle);
00085
#endif // HAVE_LIBXSS
00086
00087
protected slots:
00088
void check();
00089
00090
private:
00091
#ifdef HAVE_LIBXSS
00092
XScreenSaverInfo *_mit_info;
00093
#endif
00094
bool _idleDetectionPossible;
00095
bool _overAllIdleDetect;
00096
int _maxIdle;
00097 QTimer *_timer;
00098 };
00099
00100
#endif // KARM_IDLE_TIME_DETECTOR_H
This file is part of the documentation for karm Library Version 3.2.2.