KVIrc  4.9.2
DeveloperAPIs
Idle.h
Go to the documentation of this file.
1 #ifndef _IDLE_H_
2 #define _IDLE_H_
3 /*
4  * Idle.h - detect desktop idle time
5  * Copyright (C) 2003 Justin Karneges
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "kvi_settings.h"
24 
25 #include <QObject>
26 #include <QCursor>
27 #include <QDateTime>
28 #include <QTimer>
29 
30 class IdlePlatform;
31 
32 class Idle : public QObject
33 {
34  Q_OBJECT
35 public:
36  Idle();
37  ~Idle();
38 
39  bool isActive() const;
40  bool usingPlatform() const;
41  void start();
42  void stop();
43  int secondsIdle();
44 
45 signals:
46  void secondsIdle(int);
47 
48 private slots:
49  void doCheck();
50 
51 private:
52  class Private;
53  Private * d;
54 };
55 
57 {
58 public:
59  IdlePlatform();
60  ~IdlePlatform();
61 
62  bool init() const;
63  int secondsIdle() const;
64 
65 private:
66  class Private;
67  Private * d;
68 };
69 
71 {
72 public:
73  Private() {}
74 
75  QPoint lastMousePos;
76  QDateTime idleSince;
77 
78  bool active;
79  int idleTime;
80  QDateTime startTime;
81  QTimer checkTimer;
82 };
83 
84 #endif
Definition: Idle.h:70
Idle()
Definition: Idle.cpp:30
Private * d
Definition: Idle.h:52
Private()
Definition: Idle.h:73
int secondsIdle()
Definition: Idle.cpp:95
QPoint lastMousePos
Definition: Idle.h:75
int secondsIdle() const
Definition: Idle_x11.cpp:29
~Idle()
Definition: Idle.cpp:51
void doCheck()
Definition: Idle.cpp:135
Private * d
Definition: Idle.h:66
bool init() const
Definition: Idle_x11.cpp:28
bool usingPlatform() const
Definition: Idle.cpp:70
bool isActive() const
Definition: Idle.cpp:65
bool active
Definition: Idle.h:78
IdlePlatform()
Definition: Idle_x11.cpp:26
QDateTime idleSince
Definition: Idle.h:76
void start()
Definition: Idle.cpp:75
~IdlePlatform()
Definition: Idle_x11.cpp:27
Definition: Idle.h:56
QDateTime startTime
Definition: Idle.h:80
void stop()
Definition: Idle.cpp:90
int idleTime
Definition: Idle.h:79
This file contains compile time settings.
QTimer checkTimer
Definition: Idle.h:81
Definition: Idle.h:32