redesigned battery data structures and added icon merge
[qbat.git] / common.h
blobd61529c77334d00b676f6aec7ff9cf7c963d7684
1 //
2 // C++ Interface: common
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_COMMON_H
9 #define QBAT_COMMON_H
11 // #include <string>
12 #include <QString>
13 #include <QColor>
14 #include "constants.h"
16 #define BUF_SIZE 256
18 namespace qbat {
19 struct Settings {
20 quint16 pollingRate;
21 bool handleCritical;
22 quint8 criticalCapacity;
23 bool executeCommand;
24 QString criticalCommand;
25 bool confirmCommand;
26 bool confirmWithTimeout;
27 quint16 timeoutValue;
28 QRgb colors[UI_COUNT_COLORS];
29 bool showBalloon;
30 bool mergeBatteries;
31 /* QRgb textColor;
32 QRgb mainEmptyColor;
33 QRgb mainChargedColor;
34 QRgb poleColor;
35 QRgb textFullColor;
36 QRgb mainFullColor;
37 QRgb poleFullColor;*/
40 QString readStringSysFile(const char * fileName);
41 bool readStringFromFile(char * buffer, const char * fileName);
42 int readIntSysFile(const char * fileName);
43 int toStatusInt(QString status);
44 int toStatusInt(const char * status);
46 inline qint8 calcRelativeDef(int value, int border, qint8 defValue = -1) {
47 return border ? (qint8)(100.0 * value / border) : defValue;
51 #endif