# HG changeset patch # User Michiel Broek # Date 1697201241 -7200 # Node ID 61c114afb0eeadbde5321a8333d3a46d6a23f904 # Parent 0f15edebc66538ee9a157eccf7c5e951bfb20eeb Basic setup for iSpindel calibration. diff -r 0f15edebc665 -r 61c114afb0ee CMakeLists.txt --- a/CMakeLists.txt Thu Oct 12 17:03:50 2023 +0200 +++ b/CMakeLists.txt Fri Oct 13 14:47:21 2023 +0200 @@ -230,6 +230,7 @@ ${SRCDIR}/ChartCarbonate.cpp ${SRCDIR}/ChartFermenter.cpp ${SRCDIR}/ChartiSpindel.cpp + ${SRCDIR}/CalibrateiSpindel.cpp ${SRCDIR}/Webcam.cpp ${SRCDIR}/EditProduct.cpp ${SRCDIR}/ImportXML.cpp @@ -298,6 +299,7 @@ ${SRCDIR}/ChartCarbonate.h ${SRCDIR}/ChartFermenter.h ${SRCDIR}/ChartiSpindel.h + ${SRCDIR}/CalibrateiSpindel.h ${SRCDIR}/Webcam.h ${SRCDIR}/EditProduct.h ${SRCDIR}/ImportXML.h @@ -342,6 +344,7 @@ ${UIDIR}/DetailFermenter.ui ${UIDIR}/DetailCO2meter.ui ${UIDIR}/DetailiSpindel.ui + ${UIDIR}/CalibrateiSpindel.ui ${UIDIR}/ImportXML.ui ${UIDIR}/ImportBrew.ui ${UIDIR}/MainWindow.ui diff -r 0f15edebc665 -r 61c114afb0ee src/CalibrateiSpindel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CalibrateiSpindel.cpp Fri Oct 13 14:47:21 2023 +0200 @@ -0,0 +1,73 @@ +/** + * CalibrateiSpindel.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 "CalibrateiSpindel.h" +#include "../ui/ui_CalibrateiSpindel.h" +#include "global.h" +#include "Utils.h" +#include "MainWindow.h" + + + +CalibrateiSpindel::CalibrateiSpindel(int id, QWidget *parent) : QDialog(parent), ui(new Ui::CalibrateiSpindel) +{ + QSqlQuery query; + +#ifdef DEBUG_MONITOR + qDebug() << "CalibrateiSpindel record:" << id; +#endif + ui->setupUi(this); + this->recno = id; + setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); + setWindowTitle(tr("BMSapp - Calibrate iSpindel")); + + connect(parent, SIGNAL(updateiSpindel(QString)), this, SLOT(refreshiSpindel(QString))); + emit refreshTable(); +} + + +void CalibrateiSpindel::refreshTable() +{ + QSqlQuery query; + + query.prepare("SELECT node,alias,calibrate FROM mon_ispindels WHERE record = :recno"); + query.bindValue(":recno", this->recno); + query.exec(); + if (query.next()) { + + _node = query.value("node").toString(); + _alias = query.value("alias").toString(); + _data_old = query.value("calibrate").toString(); + _data_new = query.value("calibrate").toString(); + + } + +} + + +CalibrateiSpindel::~CalibrateiSpindel() +{ + delete ui; +} + + +void CalibrateiSpindel::on_quitButton_clicked() +{ + this->close(); + this->setResult(1); +} + + diff -r 0f15edebc665 -r 61c114afb0ee src/CalibrateiSpindel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CalibrateiSpindel.h Fri Oct 13 14:47:21 2023 +0200 @@ -0,0 +1,35 @@ +#ifndef _CALIBRATEISPINDEL_H +#define _CALIBRATEISPINDEL_H + +#include +#include +#include +#include +#include +#include +#include + + +namespace Ui { +class CalibrateiSpindel; +} + +class CalibrateiSpindel : public QDialog +{ + Q_OBJECT + +public: + explicit CalibrateiSpindel(int id, QWidget *parent = 0); + ~CalibrateiSpindel(); + +private slots: + void on_quitButton_clicked(); + void refreshTable(void); + +private: + Ui::CalibrateiSpindel *ui; + QString _node, _alias, _data_old, _data_new; + int recno; +}; + +#endif diff -r 0f15edebc665 -r 61c114afb0ee src/MoniSpindels.cpp --- a/src/MoniSpindels.cpp Thu Oct 12 17:03:50 2023 +0200 +++ b/src/MoniSpindels.cpp Fri Oct 13 14:47:21 2023 +0200 @@ -16,6 +16,7 @@ */ #include "MoniSpindels.h" #include "DetailiSpindel.h" +#include "CalibrateiSpindel.h" #include "MainWindow.h" #include "Utils.h" #include "config.h" @@ -75,16 +76,17 @@ QTableWidgetItem *item; QSqlQuery query("SELECT record,alias,node,online,mode,temperature,gravity,beercode,beername FROM mon_ispindels ORDER BY alias"); - const QStringList labels({tr("Unit"), tr("Node"), tr("Status"), tr("Beer"), tr("Temperature"), tr("SG"), tr("Details")}); + const QStringList labels({tr("Unit"), tr("Node"), tr("Status"), tr("Beer"), tr("Temperature"), tr("SG"), tr("Cal"), tr("Details")}); - this->tableiSpindels->setColumnCount(7); + this->tableiSpindels->setColumnCount(8); this->tableiSpindels->setColumnWidth(0, 150); /* Alias */ this->tableiSpindels->setColumnWidth(1, 120); /* Node */ this->tableiSpindels->setColumnWidth(2, 100); /* Status */ - this->tableiSpindels->setColumnWidth(3, 390); /* Beer */ + this->tableiSpindels->setColumnWidth(3, 330); /* Beer */ this->tableiSpindels->setColumnWidth(4, 90); /* Temperature */ this->tableiSpindels->setColumnWidth(5, 90); /* Gravity */ - this->tableiSpindels->setColumnWidth(6, 90); /* Edit button */ + this->tableiSpindels->setColumnWidth(6, 60); /* Calibrate */ + this->tableiSpindels->setColumnWidth(7, 90); /* Edit button */ this->tableiSpindels->setRowCount(query.size()); this->tableiSpindels->setHorizontalHeaderLabels(labels); this->tableiSpindels->verticalHeader()->hide(); @@ -124,7 +126,19 @@ this->tableiSpindels->setItem(i, 5, new QTableWidgetItem(QString(""))); } - /* Add the Edit button */ + /* Add the Calibrate button */ + QWidget* cWidget = new QWidget(); + QPushButton* btn_cal = new QPushButton(); + btn_cal->setObjectName(QString("%1").arg(query.value("record").toString())); /* Send record with the button */ + btn_cal->setText(tr("Cal")); + connect(btn_cal, SIGNAL(clicked()), this, SLOT(on_calButton_clicked())); + QHBoxLayout* cLayout = new QHBoxLayout(cWidget); + cLayout->addWidget(btn_cal); + cLayout->setContentsMargins(5, 0, 5, 0); + cWidget->setLayout(cLayout); + this->tableiSpindels->setCellWidget(i, 6, cWidget); + + /* Add the Details button */ QWidget* pWidget = new QWidget(); QPushButton* btn_edit = new QPushButton(); btn_edit->setObjectName(QString("%1").arg(query.value("record").toString())); /* Send record with the button */ @@ -134,7 +148,7 @@ pLayout->addWidget(btn_edit); pLayout->setContentsMargins(5, 0, 5, 0); pWidget->setLayout(pLayout); - this->tableiSpindels->setCellWidget(i, 6, pWidget); + this->tableiSpindels->setCellWidget(i, 7, pWidget); query.next(); } emit setStatus(QString(tr("Total items: %1")).arg(query.size())); @@ -167,3 +181,18 @@ } +void MoniSpindels::cal(int recno) +{ + CalibrateiSpindel dialog(recno, this); + dialog.setModal(true); + dialog.exec(); +} + + +void MoniSpindels::on_calButton_clicked() +{ + QPushButton *pb = qobject_cast(QObject::sender()); + int recno = pb->objectName().toInt(); + cal(recno); +} + diff -r 0f15edebc665 -r 61c114afb0ee src/MoniSpindels.h --- a/src/MoniSpindels.h Thu Oct 12 17:03:50 2023 +0200 +++ b/src/MoniSpindels.h Fri Oct 13 14:47:21 2023 +0200 @@ -27,6 +27,7 @@ private slots: void on_editButton_clicked(); + void on_calButton_clicked(); void refreshTable(void); public slots: @@ -40,6 +41,7 @@ QPushButton *quitButton; void edit(int recno); + void cal(int recno); }; #endif diff -r 0f15edebc665 -r 61c114afb0ee translations/bmsapp_en.ts --- a/translations/bmsapp_en.ts Thu Oct 12 17:03:50 2023 +0200 +++ b/translations/bmsapp_en.ts Fri Oct 13 14:47:21 2023 +0200 @@ -48,6 +48,24 @@ + CalibrateiSpindel + + + Dialog + + + + + Quit + + + + + BMSapp - Calibrate iSpindel + + + + ChartCarbonate @@ -1002,11 +1020,6 @@ - - Calibrate - - - BMSapp - Details iSpindel @@ -10107,48 +10120,54 @@ MoniSpindels - + Quit - + Unit - + Node - + Status - + Beer - + Temperature - + SG - - + + Details - + + + Cal + + + + Total items: %1 diff -r 0f15edebc665 -r 61c114afb0ee translations/bmsapp_nl.ts --- a/translations/bmsapp_nl.ts Thu Oct 12 17:03:50 2023 +0200 +++ b/translations/bmsapp_nl.ts Fri Oct 13 14:47:21 2023 +0200 @@ -78,6 +78,36 @@ + CalibrateiSpindel + + + Dialog + Dialog + + + Uuid: + Uuid: + + + System and unit: + Systeem en unit: + + + iSpindel overview + iSpindel overzicht + + + + Quit + Terug + + + + BMSapp - Calibrate iSpindel + + + + ChartCarbonate @@ -1037,11 +1067,6 @@ Toont de temperatuur - - Calibrate - - - Shows the air temperature Toont de lucht temperatuur @@ -11223,48 +11248,54 @@ MoniSpindels - + Quit Terug - + Unit Eenheid - + Node Systeem - + Status Status - + Beer Bier - + Temperature Temperatuur - + SG SG - - + + Details Details - + + + Cal + + + + Total items: %1 Totaal items: %1 diff -r 0f15edebc665 -r 61c114afb0ee ui/CalibrateiSpindel.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/CalibrateiSpindel.ui Fri Oct 13 14:47:21 2023 +0200 @@ -0,0 +1,63 @@ + + + CalibrateiSpindel + + + + 0 + 0 + 1024 + 560 + + + + Dialog + + + + + + + + 740 + 370 + 261 + 161 + + + + + + 90 + 120 + 80 + 23 + + + + + 0 + 0 + + + + Quit + + + + :icons/silk/door_out.png:icons/silk/door_out.png + + + + + + + + + quitButton + + + + + + diff -r 0f15edebc665 -r 61c114afb0ee ui/DetailiSpindel.ui --- a/ui/DetailiSpindel.ui Thu Oct 12 17:03:50 2023 +0200 +++ b/ui/DetailiSpindel.ui Fri Oct 13 14:47:21 2023 +0200 @@ -542,7 +542,7 @@ 740 130 261 - 231 + 281 @@ -708,16 +708,16 @@ 740 - 370 + 420 261 - 161 + 111 90 - 120 + 70 80 23 @@ -740,7 +740,7 @@ 90 - 70 + 20 80 23 @@ -753,23 +753,6 @@ :/icons/silk/chart_line.png:/icons/silk/chart_line.png - - - - 90 - 20 - 80 - 23 - - - - Calibrate - - - - :/icons/silk/wrench.png:/icons/silk/wrench.png - - @@ -801,7 +784,6 @@ tiltEdit sgEdit logButton - calButton