critical handler cleanup and fix
[qbat.git] / powermanager.h
blob00c7c170ee3ae2083a820a3d0ec959dbcaac7a7e
1 //
2 // C++ Interface: powermanager
3 //
4 // Author: Oliver Groß <z.o.gross@gmx.de>, (C) 2008
5 //
6 // Copyright: See COPYING file that comes with this distribution
7 //
8 #ifndef QBAT_POWERMANAGER_H
9 #define QBAT_POWERMANAGER_H
11 #include <QHash>
12 #include <QDir>
13 #include <QMenu>
14 #include <QSettings>
15 #include <QSystemTrayIcon>
16 #include "common.h"
18 namespace qbat {
19 class CBatteryIcon;
21 class CPowerManager : public QObject {
22 Q_OBJECT
23 private:
24 int m_Timer;
25 bool m_CriticalHandled;
26 QDir m_SysfsDir;
28 Settings m_Settings;
29 QSettings m_SettingsFile;
31 QMenu m_ContextMenu;
33 QHash<QString, CBatteryIcon *> m_BatteryIcons;
34 QSystemTrayIcon m_DefaultTrayIcon;
36 inline void readSettings();
37 inline void writeSettings();
39 void timerEvent(QTimerEvent * event);
40 public:
41 CPowerManager(QObject * parent = 0);
42 ~CPowerManager();
43 private slots:
44 void updateData();
45 void restartTimer();
46 public slots:
47 void showSettings();
48 void showAbout();
52 #endif