Settings: unify duplicated code
[lxde/liblxqt.git] / lxqtpowermanager.h
1 /* BEGIN_COMMON_COPYRIGHT_HEADER
2 * (c)LGPL2+
3 *
4 * LXQt - a lightweight, Qt based, desktop toolset
5 * http://razor-qt.org
6 *
7 * Copyright: 2010-2011 Razor team
8 * Authors:
9 * Petr Vanek <petr@scribus.info>
10 *
11 * This program or library is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20
21 * You should have received a copy of the GNU Lesser General
22 * Public License along with this library; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301 USA
25 *
26 * END_COMMON_COPYRIGHT_HEADER */
27
28 #ifndef LXQTPOWERMANAGER_H
29 #define LXQTPOWERMANAGER_H
30
31 #include <QObject>
32 #include <QAction>
33 #include "lxqtglobals.h"
34
35 namespace LXQt
36 {
37 class Power;
38
39 /*! QAction centric menu aware wrapper around lxqtpower
40 */
41 class LXQT_API PowerManager : public QObject
42 {
43 Q_OBJECT
44
45 public:
46 PowerManager(QObject * parent, bool skipWarning = false);
47 ~PowerManager();
48 QList<QAction*> availableActions();
49
50 public slots:
51 // power management
52 void suspend();
53 void hibernate();
54 void reboot();
55 void shutdown();
56 // lxqt session
57 void logout();
58
59 public:
60 bool skipWarning() const { return m_skipWarning; }
61
62 private:
63 LXQt::Power * m_power;
64 bool m_skipWarning;
65
66 private slots:
67 void hibernateFailed();
68 void suspendFailed();
69 };
70
71 } // namespace LXQt
72
73 #endif // LXQTPOWERMANAGER_H