washwarnicon.cpp
644 Bytes
#include "washwarnicon.h"
#include "config.h"
#include "dirtylevel.h"
QPixmap *WashWarnIcon::icon = NULL;
WashWarnIcon::WashWarnIcon(QWidget *parent) : QLabel(parent)
{
if (icon == NULL)
icon = new QPixmap(":/images/symbol/wash.png");
connect(&timer, SIGNAL(timeout()), SLOT(check()));
timer.start(1000);
setPixmap(*icon);
check();
}
void WashWarnIcon::check()
{
Define::config_item item = Config::getInstance()->getConfigValue(Define::config_duty_wash);
if (item.d32 == 0)
hide();
else if (DirtyLevel::dirty() >= 4 || DirtyLevel::state() >= 4)
show();
else
hide();
}