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.
 
 
 
 
 
 

81 lines
1.7 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 <QDateTime>
#include <QTime>
#include "settings.h"
#include "zoneitem.h"
ZoneItem::ZoneItem(const QString &zoneName, QWidget *parent) :
QWidget(parent)
{
m_name = zoneName;
m_zoneNameBtn.setText(zoneName);
m_zoneNameBtn.setFlat(true);
m_temperatureBtn.setFlat(true);
m_hygroBtn.setFlat(true);
m_temperature_value = FORCE_OFF;
m_hygro_value = FORCE_OFF;
m_target_temperature = FORCE_OFF;
m_available = false;
m_boost.temperature = 0;
m_boost.end_date = QDateTime();
/*
* 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;
if ((m_temperature_value == FORCE_OFF) || !m_available)
text += QString("-");
else
text += QString::number(m_temperature_value);
text += QString("°C / ");
if (m_target_temperature == FORCE_OFF) {
text += QString("-");
} else if (m_target_temperature == FORCE_ON) {
text += QString("+");
} else {
text += QString::number(m_target_temperature);
}
text += QString("°C");
m_temperatureBtn.setText(text);
if ((m_hygro_value == FORCE_OFF) || !m_available)
text = QString("-");
else
text = QString::number(m_hygro_value);
text += QString("%h");
m_hygroBtn.setText(text);
}
/* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */