fixed gentoo support
[qbat.git] / common.h
blobd8845b607141dc44573eb9099d25d04a86366d14
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 <QString>
12 #include <QColor>
13 #include "constants.h"
15 #define BUF_SIZE 256
17 namespace qbat {
18 struct Settings {
19 quint16 pollingRate;
20 bool handleCritical;
21 quint8 criticalCapacity;
22 bool executeCommand;
23 QString criticalCommand;
24 bool confirmCommand;
25 bool confirmWithTimeout;
26 quint16 timeoutValue;
27 QRgb colors[UI_COUNT_COLORS];
28 bool showBalloon;
29 bool mergeBatteries;
32 bool readStringFromFile(char * buffer, const char * fileName);
33 int readIntSysFile(const char * fileName);
34 int toStatusInt(const char * status);
36 inline qint8 calcRelativeDef(int value, int border, qint8 defValue = -1) {
37 return border ? (qint8)(100.0 * value / border) : defValue;
41 #endif