13#include <kidletime_export.h>
16#if __has_include(<chrono>)
20class KIdleTimePrivate;
100#if __has_include(<chrono>)
105 int addIdleTimeout(std::chrono::milliseconds msec)
107 return addIdleTimeout(
int(msec.count()));
168#if KIDLETIME_ENABLE_DEPRECATED_SINCE(5, 76)
182 KIDLETIME_DEPRECATED_VERSION(5, 76,
"Use only timeoutReached(int identifier, int msec)")
183 void timeoutReached(
int identifier);
204 std::unique_ptr<KIdleTimePrivate>
const d_ptr;
KIdleTime is a singleton reporting information on idle time.
Definition kidletime.h:37
void catchNextResumeEvent()
Catches the next resume from idle event.
int addIdleTimeout(int msec)
Adds a new timeout to catch.
int idleTime() const
Retrieves the idle time of the system, in milliseconds.
void timeoutReached(int identifier, int msec)
Triggered when the system has been idle for x milliseconds, identified by the previously set timeout.
void resumingFromIdle()
Triggered, if KIdleTime is catching resume events, when the system resumes from an idle state.
~KIdleTime() override
The destructor.
void simulateUserActivity()
Attempts to simulate user activity.
void stopCatchingResumeEvent()
Stops listening for resume event.
void removeIdleTimeout(int identifier)
Stops catching the idle timeout identified by the token identifier, if it was registered earlier with...
void removeAllIdleTimeouts()
Stops catching every set timeout (if any).
static KIdleTime * instance()
Returns the singleton instance.
QHash< int, int > idleTimeouts() const
Returns the list of timeout identifiers associated with their duration, in milliseconds,...