Thermostat pour piloter jusqu'à 4 radiateurs avec fil pilote
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

78 lines
1.4 KiB

// SPDX-License-Identifier: GPL-3.0-or-later
/*
* Qt mutizone MQTT thermostat
*
* Copyright (C) 2019 Richard Genoud
*
*/
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
#include <QLocale>
#include <QLabel>
#include "zoneitem.h"
ZoneItem::ZoneItem(const QString &zoneName, QWidget *parent) :
QWidget(parent)
{
m_zoneNameBtn.setText(zoneName);
m_zoneNameBtn.setFlat(true);
m_temperatureBtn.setFlat(true);
m_hygroBtn.setFlat(true);
m_temperature_value = 0;
m_hygro_value = 0;
m_target_temperature = 0;
/*
* Layout for the left part of the window
*/
QVBoxLayout *topLayout = new QVBoxLayout;
topLayout->addWidget(&m_zoneNameBtn);
topLayout->addWidget(&m_temperatureBtn);
topLayout->addWidget(&m_hygroBtn);
this->setLayout(topLayout);
}
ZoneItem::~ZoneItem()
{
}
void ZoneItem::refresh(void)
{
QString text;
text += QString::number(m_temperature_value);
text += QString("°C / ");
text += QString::number(m_target_temperature);
text += QString("°C");
m_temperatureBtn.setText(text);
text = QString::number(m_hygro_value);
text += QString("%h");
m_hygroBtn.setText(text);
}
void ZoneItem::set_temperature_value(double val)
{
m_temperature_value = val;
refresh();
}
void ZoneItem::set_target_temperature(double val)
{
m_target_temperature = val;
refresh();
}
void ZoneItem::set_hygro_value(double val)
{
m_hygro_value = val;
refresh();
}
/* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */