KIdleTime

widgetbasedpoller.h
1 /* This file is part of the KDE libraries
2  * SPDX-FileCopyrightText: 2009 Dario Freddi <drf at kde.org>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-only
5  */
6 
7 #ifndef WIDGETBASEDPOLLER_H
8 #define WIDGETBASEDPOLLER_H
9 
10 #include <kidletime_export.h>
11 
12 #include "abstractsystempoller.h"
13 
14 class QTimer;
15 class QEvent;
16 class QWindow;
17 
18 class KIDLETIME_EXPORT WidgetBasedPoller : public AbstractSystemPoller
19 {
20  Q_OBJECT
21 
22 public:
23  explicit WidgetBasedPoller(QObject *parent = nullptr);
24  ~WidgetBasedPoller() override;
25 
26  bool isAvailable() override;
27  bool setUpPoller() override;
28  void unloadPoller() override;
29 
30 protected:
31  bool eventFilter(QObject *object, QEvent *event) override;
32 
33 public Q_SLOTS:
34  void addTimeout(int nextTimeout) override;
35  void removeTimeout(int nextTimeout) override;
36  QList<int> timeouts() const override;
37  int forcePollRequest() override;
38  void catchIdleEvent() override;
39  void stopCatchingIdleEvents() override;
40 
41 private Q_SLOTS:
42  int poll();
43  virtual int getIdleTime() = 0;
44  void detectedActivity();
45  void waitForActivity();
46  void releaseInputLock();
47 
48 private:
49  virtual bool additionalSetUp() = 0;
50 
51 private:
52  QTimer *m_pollTimer;
53  QWindow *m_grabber;
54  QList<int> m_timeouts;
55 };
56 
57 #endif /* WIDGETBASEDPOLLER_H */
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 10 2020 22:52:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.