ignitionicon.cpp 559 Bytes
#include "ignitionicon.h"

#include "udphandler.h"

QPixmap *IgnitionIcon::icon = Q_NULLPTR;

IgnitionIcon::IgnitionIcon(QWidget *parent) : QLabel(parent)
{
    if (icon == Q_NULLPTR)
        icon = new QPixmap(":/images/symbol/inigited.png");

    connect(&timer, SIGNAL(timeout()), SLOT(check()));
    timer.start(1000);

    setPixmap(*icon);

    check();
}

void IgnitionIcon::check()
{
    UdpHandler *udp = UdpHandler::getInstance();
    if (udp->burnerState(1) || udp->burnerState(2) || udp->burnerState(3))
        show();
    else
        hide();
}