ignitionicon.cpp
1.13 KB
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
#include "ignitionicon.h"
#include "udphandler.h"
#include "config.h"
QPixmap *IgnitionIcon::icon = Q_NULLPTR;
IgnitionIcon::IgnitionIcon(QWidget *parent) : QLabel(parent)
{
connect(&timer, SIGNAL(timeout()), SLOT(check()));
timer.start(1000);
setPixmap(QPixmap(":/images/symbol/ignited.png"));
check();
}
void IgnitionIcon::check()
{
bool ignition = false;
UdpHandler *udp = UdpHandler::getInstance();
switch (Config::getInstance()->getConfigValue(Define::config_model).d32)
{
case Define::model_electric_10:
case Define::model_electric_20:
case Define::model_electric_24:
case Define::model_electric_40:
ignition = udp->heater();
break;
case Define::model_gas_lpg_10:
case Define::model_gas_lpg_20:
case Define::model_gas_lpg_24:
case Define::model_gas_lpg_40:
case Define::model_gas_lng_10:
case Define::model_gas_lng_20:
case Define::model_gas_lng_24:
case Define::model_gas_lng_40:
ignition = udp->burnerState(1) || udp->burnerState(2) || udp->burnerState(3);
break;
}
if (ignition)
show();
else
hide();
}