Debian Codegraph @

online-accounts-service/src/inactivity-timer.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2013 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This file is part of lomiri-online-accounts-service
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef OAU_INACTIVITY_TIMER_H
22 #define OAU_INACTIVITY_TIMER_H
23
24 #include <QList>
25 #include <QObject>
26 #include <QTimer>
27 #include <QVariant>
28
29 namespace OnlineAccountsUi {
30
31 class InactivityTimer: public QObject
32 {
33 Q_OBJECT
34
35 public:
36 InactivityTimer(int interval, QObject *parent = 0);
37 ~InactivityTimer() {}
38
39 void watchObject(QObject *object);
40
41 Q_SIGNALS:
42 void timeout();
43
44 private Q_SLOTS:
45 void onIdleChanged();
46 void onTimeout();
47
48 private:
49 bool allObjectsAreIdle() const;
50
51 private:
52 QList<QObject*> m_watchedObjects;
53 QTimer m_timer;
54 int m_interval;
55 };
56
57 } // namespace
58
59 #endif // OAU_INACTIVITY_TIMER_H