KUtils
#include <kidletime.h>
Public Slots | |
int | addIdleTimeout (int msec) |
void | catchNextResumeEvent () |
void | removeAllIdleTimeouts () |
void | removeIdleTimeout (int identifier) |
void | stopCatchingResumeEvent () |
Signals | |
void | resumingFromIdle () |
void | timeoutReached (int identifier) |
void | timeoutReached (int identifier, int msec) |
Public Member Functions | |
virtual | ~KIdleTime () |
int | idleTime () const |
QHash< int, int > | idleTimeouts () const |
void | simulateUserActivity () |
Static Public Member Functions | |
static KIdleTime * | instance () |
Detailed Description
KIdleTime is a singleton reporting information on idle time.
It is useful not only for finding out about the current idle time of the PC, but also for getting notified upon idle time events, such as custom timeouts, or user activity.
- Note
- All the intervals and times in this library are in milliseconds, unless specified otherwise
- Since
- 4.4
Definition at line 39 of file kidletime.h.
Constructor & Destructor Documentation
|
virtual |
The destructor.
Definition at line 99 of file kidletime.cpp.
Member Function Documentation
|
slot |
Adds a new timeout to catch.
When calling this method, after the system will be idle for msec
milliseconds, the signal timeoutReached
will be triggered. Please note that until you will call removeIdleTimeout
or removeAllIdleTimeouts
, the signal will be triggered every time the system will be idle for msec
milliseconds. This function also returns an unique token for the timeout just added to allow easier identification.
- Parameters
-
msec the time, in milliseconds, after which the signal will be triggered
- Returns
- an unique identifier for the timeout being added, that will be streamed by timeoutReached
Definition at line 126 of file kidletime.cpp.
|
slot |
Catches the next resume from idle event.
This means that whenever user activity will be registered, or is called, the signal resumingFromIdle will be triggered. Please note that this method will trigger the signal just for the very first resume event after the call: this means you explicitly have to request to track every single resume event you are interested in.
- Note
- This behavior is due to the fact that a resume event happens whenever the user sends an input to the system. This would lead to a massive amount of signals being delivered when the PC is being used. Moreover, you are usually interested in catching just significant resume events, such as the ones after a significant period of inactivity. For tracking user input, you can use the more efficient methods provided by Qt. The purpose of this library is just monitoring the activity of the user.
- See also
- resumingFromIdle
- simulateUserActivity
Definition at line 106 of file kidletime.cpp.
int KIdleTime::idleTime | ( | ) | const |
Retrieves the idle time of the system, in milliseconds.
- Returns
- the idle time of the system
Definition at line 255 of file kidletime.cpp.
QHash< int, int > KIdleTime::idleTimeouts | ( | ) | const |
Returns the list of timeout identifiers associated with their duration, in milliseconds, the library is currently listening to.
Definition at line 262 of file kidletime.cpp.
|
static |
Returns the singleton instance.
Use this method to access KIdleTime
- Returns
- the instance of KIdleTime
Definition at line 55 of file kidletime.cpp.
|
slot |
Stops catching every set timeout (if any).
This means that after calling this method, the signal won't be called again until you will add another timeout timeoutReached addIdleTimeout
Definition at line 155 of file kidletime.cpp.
|
slot |
Stops catching the idle timeout identified by the token identifier
, if it was registered earlier with addIdleTimeout.
Otherwise does nothing.
- Parameters
-
identifier the token returned from addIdleTimeout of the timeout you want to stop listening to
Definition at line 138 of file kidletime.cpp.
|
signal |
Triggered, if KIdleTime is catching resume events, when the system resumes from an idle state.
This means that either was called or the user sent an input to the system. catchNextResumeEvent
void KIdleTime::simulateUserActivity | ( | ) |
Attempts to simulate user activity.
This implies that after calling this method, the idle time of the system will become 0 and eventually will be triggered resumingFromIdle
Definition at line 248 of file kidletime.cpp.
|
slot |
Stops listening for resume event.
This function serves for canceling catchNextResumeEvent
, as it will have effect just when catchNextResumeEvent
has been called and resumingFromIdle
not yet triggered
- See also
- resumingFromIdle
- catchNextResumeEvent
Definition at line 116 of file kidletime.cpp.
|
signal |
Triggered when the system has been idle for x milliseconds, identified by the previously set timeout.
This signal is triggered whenever each timeout previously registered with is reached. identifier the identifier of the timeout the system has reached addIdleTimeout removeIdleTimeout
|
signal |
Overload.
Streams the duration as well. It is guaranteed that msec
will exactly correspond to the timeout registered with msec the time, in milliseconds, the system has been idle for addIdleTimeout removeIdleTimeout
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.