# HG changeset patch # User Michiel Broek # Date 1656533979 -7200 # Node ID f78827503fb01feaabde51860c126455cc1e30f6 # Parent dcd472be9ae85d5fb49bed86e918da1b239ce3db Added DetailFermenter screen diff -r dcd472be9ae8 -r f78827503fb0 src/DetailFermenter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/DetailFermenter.cpp Wed Jun 29 22:19:39 2022 +0200 @@ -0,0 +1,101 @@ +/** + * DetailFermenter.cpp is part of bmsapp. + * + * bmsapp is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * bmsapp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "DetailFermenter.h" +#include "../ui/ui_DetailFermenter.h" +#include "MainWindow.h" + + +DetailFermenter::DetailFermenter(int id, QWidget *parent) : QDialog(parent), ui(new Ui::DetailFermenter) +{ + qDebug() << "DetailFermenter record:" << id; + ui->setupUi(this); + this->recno = id; + + WindowTitle(); + +// connect(ui->nameEdit, &QLineEdit::textChanged, this, &DetailFermenter::is_changed); +// connect(ui->unlimitedEdit, &QCheckBox::stateChanged, this, &DetailFermenter::is_changed); +// connect(ui->caEdit, &QDoubleSpinBox::textChanged, this, &DetailFermenter::water_changed); + + emit refreshTable(); +} + + +void DetailFermenter::refreshTable() +{ + QSqlQuery query; + + qDebug() << "refreshTable fermenter" << this->recno; + + query.prepare("SELECT * FROM mon_fermenters WHERE record = :recno"); + query.bindValue(":recno", this->recno); + query.exec(); + if (query.next()) { + + if (query.value("online").toInt()) { + if (query.value("mode").toString() == "OFF") { + ui->powerLED->setChecked(false); + // disable dropdowns select beer. + } else { + ui->powerLED->setChecked(true); + // enable beerslect + } + ui->alarmLED->setChecked((query.value("alarm").toInt() != 0) ? true:false); + + if (query.value("air_state").toString() == "OK") { + ui->airThermo->setValue(query.value("air_temperature").toDouble()); + } + if (query.value("beer_state").toString() == "OK") { + ui->beerThermo->setValue(query.value("beer_temperature").toDouble()); + } + + } else { + /* Offline */ + ui->powerLED->setChecked(false); + ui->alarmLED->setChecked(true); + + } + } + +} + + +DetailFermenter::~DetailFermenter() +{ + qDebug() << "DetailFermenter done"; + delete ui; + emit entry_changed(); +} + + +/* + * Window header, mark any change with '**' + */ +void DetailFermenter::WindowTitle() +{ + QString txt; + + txt = QString(tr("BMSapp - Edit brewing water %1").arg(this->recno)); + setWindowTitle(txt); +} + + +void DetailFermenter::on_quitButton_clicked() +{ + this->close(); + this->setResult(1); +} diff -r dcd472be9ae8 -r f78827503fb0 src/DetailFermenter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/DetailFermenter.h Wed Jun 29 22:19:39 2022 +0200 @@ -0,0 +1,33 @@ +#ifndef _DETAILFERMENTER_H +#define _DETAILFERMENTER_H + +#include + + +namespace Ui { +class DetailFermenter; +} + +class DetailFermenter : public QDialog +{ + Q_OBJECT + +signals: + void entry_changed(); + +public: + explicit DetailFermenter(int id, QWidget *parent = 0); + ~DetailFermenter(); + +private slots: + void on_quitButton_clicked(); + void refreshTable(void); + +private: + Ui::DetailFermenter *ui; + int recno; + + void WindowTitle(); +}; + +#endif diff -r dcd472be9ae8 -r f78827503fb0 ui/DetailFermenter.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/DetailFermenter.ui Wed Jun 29 22:19:39 2022 +0200 @@ -0,0 +1,792 @@ + + + DetailFermenter + + + + 0 + 0 + 1024 + 560 + + + + Dialog + + + + + + + + 720 + 10 + 261 + 111 + + + + + + 190 + 70 + 61 + 20 + + + + Power + + + Qt::AlignCenter + + + + + + 130 + 70 + 61 + 20 + + + + Alarm + + + Qt::AlignCenter + + + + + + 70 + 70 + 61 + 20 + + + + Light + + + Qt::AlignCenter + + + + + + 10 + 70 + 61 + 20 + + + + Door + + + Qt::AlignCenter + + + + + + 210 + 40 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + 28 + 113 + 216 + + + + + + + 150 + 40 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + + + 90 + 40 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + 245 + 194 + 17 + + + + + + + 30 + 40 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + 245 + 194 + 17 + + + + + + + + 20 + 10 + 681 + 231 + + + + + + 10 + 40 + 121 + 20 + + + + Uuid: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 10 + 70 + 121 + 20 + + + + System: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 10 + 100 + 121 + 20 + + + + Code and beer: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 10 + 130 + 121 + 20 + + + + Mode: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 10 + 160 + 121 + 20 + + + + Stage: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 10 + 190 + 121 + 20 + + + + Fermentation profile: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 15 + 10 + 651 + 25 + + + + + 12 + 75 + true + + + + Climate Controller overview + + + Qt::AlignCenter + + + + + + 140 + 40 + 221 + 23 + + + + true + + + + + + 140 + 70 + 151 + 23 + + + + true + + + + + + 550 + 70 + 101 + 23 + + + + + + + 140 + 100 + 381 + 23 + + + + + + + 550 + 100 + 101 + 23 + + + + + + + 140 + 130 + 121 + 23 + + + + + + + 140 + 160 + 121 + 23 + + + + + + + 140 + 190 + 221 + 23 + + + + + + + 550 + 190 + 101 + 23 + + + + + + + 440 + 130 + 80 + 23 + + + + PushButton + + + + + + 550 + 130 + 80 + 23 + + + + PushButton + + + + + + + 20 + 250 + 681 + 271 + + + + + + 290 + 10 + 101 + 20 + + + + Chiller + + + Qt::AlignCenter + + + + + + 80 + 240 + 101 + 20 + + + + Air + + + Qt::AlignCenter + + + + + + 500 + 240 + 101 + 20 + + + + Beer + + + Qt::AlignCenter + + + + + true + + + + 290 + 30 + 100 + 100 + + + + Shows the pressure + + + The bar meter widget displays the pressure attached to it + + + -15.000000000000000 + + + 25.000000000000000 + + + 0.000000000000000 + + + 15.000000000000000 + + + + + + 450 + 30 + 201 + 201 + + + + Shows the pressure + + + The bar meter widget displays the pressure attached to it + + + 45.000000000000000 + + + 15.000000000000000 + + + 20.000000000000000 + + + + + + 30 + 30 + 201 + 201 + + + + Shows the pressure + + + The bar meter widget displays the pressure attached to it + + + true + + + 45.000000000000000 + + + 15.000000000000000 + + + 20.000000000000000 + + + -100.000000000000000 + + + 105.000000000000000 + + + + + + + 720 + 140 + 261 + 101 + + + + + + 40 + 30 + 71 + 24 + + + + + + + 150 + 30 + 71 + 24 + + + + + + + 40 + 60 + 71 + 20 + + + + °C low + + + + + + 150 + 60 + 71 + 20 + + + + °C high + + + + + + + 720 + 250 + 261 + 121 + + + + + + 40 + 20 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + 0 + 200 + 0 + + + + + + + 120 + 20 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + 0 + 200 + 0 + + + + + + + 200 + 20 + 20 + 20 + + + + Color Led component + + + Led indicator + + + false + + + + 0 + 200 + 0 + + + + + + + + 720 + 390 + 261 + 131 + + + + GroupBox + + + + + 90 + 90 + 80 + 23 + + + + + 0 + 0 + + + + Quit + + + + :icons/silk/door_out.png:icons/silk/door_out.png + + + + + + + + + + Led + QWidget +
analog/led.h
+
+ + ManoMeter + QWidget +
analog/manometer.h
+
+
+ + quitButton + + + + + +