redesigned battery data structures and added icon merge
[qbat.git] / powermanager.h
blob156b5a9cf17adc03377537871a225f661189751a
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 int m_DataTimer;
27 bool m_ACPlug;
28 bool m_CriticalHandled;
29 // QDir m_SysfsDir;
31 Settings m_Settings;
32 QSettings m_SettingsFile;
34 QMenu m_ContextMenu;
36 QHash<QString, CBatteryIcon *> m_BatteryIcons;
37 CBatteryIcon * m_DefaultIcon;
39 inline void readSettings();
40 inline void writeSettings();
42 void timerEvent(QTimerEvent * event);
43 public:
44 CPowerManager(QObject * parent = 0);
45 ~CPowerManager();
46 private:
47 /* void updateMerged(QStringList & powerSupplies, bool & acPlug, int & relativeCapacity);
48 void updateSeparated(QStringList & powerSupplies, bool & acPlug, int & relativeCapacity);*/
49 void updateSupplies();
50 void updateMergedData();
51 void checkCritical();
52 private slots:
53 void updateBatteryData();
54 // void updateData();
55 void restartTimer();
56 public slots:
57 void showSettings();
58 void showAbout();
62 #endif