fixed relative battery charge and added caching of battery states
[qbat.git] / powermanager.h
blobff4f8514fad0b6e3d57d4d594d53141c55c6d0a6
1 //
2 // C++ Interface: cpowermanager
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 void timerEvent(QTimerEvent * event);
38 inline void readSettings();
39 inline void writeSettings();
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