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 () |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static KIdleTime * | instance () |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.