-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatterywatch.h
96 lines (70 loc) · 1.7 KB
/
batterywatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef BATTERYWATCH_H
#define BATTERYWATCH_H
#include <QSystemTrayIcon>
#include <QDialog>
#include <QTimer>
#define OFF (0)
#define ON (1)
#define QOS 1
#define TIMEOUT (10 * 1000L)
#define TIME_CHECKING_FOR_BATTERY_LEVEL (1 * 60 * 1000)
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
QT_END_NAMESPACE
namespace Ui {
class BatteryWatch;
}
class BatteryWatch : public QDialog
{
Q_OBJECT
public:
BatteryWatch(QWidget *parent = 0);
~BatteryWatch();
Ui::BatteryWatch *ui;
private:
QTimer timerCheckBattery;
void setCharger( int turnOnCharger );
int batLvlMax;
int batLvlMin;
bool isMqttEnabled;
bool isWemoEnabled;
bool isExecutablesEnabled;
bool isDisplaySystemNotifications;
QString wemoHost;
QString mqttHost;
QString mqttUsername;
QString mqttPassword;
QString mqttTopic;
QString mqttClient;
QString mqttTurnOff;
QString mqttTurnOn;
QString executableWhenAboveMax;
QString executableWhenBelowMin;
QString executableArgsWhenAboveMax;
QString executableArgsWhenBelowMin;
QString linuxFileBatteryLevel;
private slots:
void setIcon();
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void showMessage(QString msgTitle, QString msgBody, int iconType);
void editPreferences();
void sendMQTT( char * topic, char * payload );
public slots:
int checkBatteryLevel();
void about();
void quitApp();
protected:
void changeEvent(QEvent *e);
void readSettings();
private:
void createMessageGroupBox();
void createActions();
void createTrayIcon();
QAction *quitAction;
QAction *aboutAction;
QAction *configAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
};
#endif // BATTERYWATCH_H