# HG changeset patch # User Michiel Broek # Date 1676034407 -3600 # Node ID 76f3a96e82b54653e7f04a929e9421bbe1fdb322 # Parent b67fb2e5bb416cd23ec1d5697df822f4985d6d52 Monitor CO2 meters: better display and hide of values and widgets. Minor adjustments of the window layout. When offline, the status background will be red. diff -r b67fb2e5bb41 -r 76f3a96e82b5 src/DetailCO2meter.cpp --- a/src/DetailCO2meter.cpp Fri Feb 10 10:09:37 2023 +0100 +++ b/src/DetailCO2meter.cpp Fri Feb 10 14:06:47 2023 +0100 @@ -55,7 +55,6 @@ } connect(ui->codePick, QOverload::of(&QComboBox::currentIndexChanged), this, &DetailCO2meter::code_changed); - connect(ui->logButton, SIGNAL(clicked()), this, SLOT(on_ChartButton_clicked())); connect(parent, SIGNAL(updateCO2meter(QString)), this, SLOT(refreshCO2meter(QString))); emit refreshTable(); } @@ -66,7 +65,7 @@ QSqlQuery query, query2; QString sql = ""; - qDebug() << "refreshTable co2meter rec:" << this->recno; +// qDebug() << "refreshTable co2meter rec:" << this->recno; query.prepare("SELECT * FROM mon_co2meters WHERE record = :recno"); query.bindValue(":recno", this->recno); @@ -108,41 +107,55 @@ ui->minBar->setValue(barmin); ui->maxBar->setValue(barmax); ui->thisBar->setValue(barthis); - qDebug() << " beerdata" << TSec << carbtemp << barmin << barmax << barthis; +// qDebug() << " beerdata" << TSec << carbtemp << barmin << barmax << barthis; ui->barMeter->setNominal(barmin); ui->barMeter->setCritical(barmax); } + bool alarm = (query.value("alarm").toInt() != 0) ? true:false; + bool online = (query.value("online").toInt() != 0) ? true:false; + bool mode = (query.value("mode").toString() == "ON") ? true:false; + ui->uuidEdit->setText(_uuid); ui->systemEdit->setText(_node+"/"+_alias); ui->codePick->setItemText(0, _alias.toUpper()+" - "+_alias); + ui->alarmLED->setChecked(alarm); - if (query.value("online").toInt()) { + if (online) { ui->statusEdit->setText(tr("Online")); + ui->statusEdit->setStyleSheet(""); ui->codeEdit->setText(_beercode+" - "+_beername); ui->modeEdit->setText(query.value("mode").toString()); ui->modeEdit->show(); - if (query.value("mode").toString() == "OFF") { - ui->powerLED->setChecked(false); + ui->powerLED->setChecked(mode); + if (mode) + ui->codePick->hide(); + else ui->codePick->show(); + + if (query.value("temperature_address").toString().length() == 16) { + ui->thermoBox->show(); + ui->logButton->show(); + if (! alarm && query.value("temperature_state").toString() == "OK") { + ui->thermoMeter->setValue(query.value("temperature").toDouble()); + } else { + ui->thermoMeter->setValue(NAN); + } + if (! alarm && query.value("pressure_state").toString() == "OK") { + ui->barMeter->setValue(query.value("pressure_bar").toDouble()); + } else { + ui->barMeter->setValue(NAN); + } } else { - ui->powerLED->setChecked(true); - ui->codePick->hide(); + ui->thermoBox->hide(); + ui->logButton->hide(); } - ui->alarmLED->setChecked((query.value("alarm").toInt() != 0) ? true:false); - - ui->thermoBox->show(); - if (query.value("temperature_state").toString() == "OK") { - ui->thermoMeter->setValue(query.value("temperature").toDouble()); - } - if (query.value("pressure_state").toString() == "OK") { - ui->barMeter->setValue(query.value("pressure_bar").toDouble()); - } } else { /* Offline */ ui->statusEdit->setText(tr("Offline")); + ui->statusEdit->setStyleSheet("background-color: red"); ui->powerLED->setChecked(false); ui->alarmLED->setChecked(true); ui->codePick->hide(); @@ -174,7 +187,7 @@ } -void DetailCO2meter::on_ChartButton_clicked() +void DetailCO2meter::on_logButton_clicked() { ChartCarbonate dialog(_beercode, _beername, this); } diff -r b67fb2e5bb41 -r 76f3a96e82b5 src/DetailCO2meter.h --- a/src/DetailCO2meter.h Fri Feb 10 10:09:37 2023 +0100 +++ b/src/DetailCO2meter.h Fri Feb 10 14:06:47 2023 +0100 @@ -29,7 +29,7 @@ void on_quitButton_clicked(); void refreshTable(void); void code_changed(int val); - void on_ChartButton_clicked(); + void on_logButton_clicked(); public slots: void refreshCO2meter(QString); diff -r b67fb2e5bb41 -r 76f3a96e82b5 translations/bmsapp_en.ts --- a/translations/bmsapp_en.ts Fri Feb 10 10:09:37 2023 +0100 +++ b/translations/bmsapp_en.ts Fri Feb 10 14:06:47 2023 +0100 @@ -115,47 +115,47 @@ - + Beer - + Chiller - + Date - + Temp °C - + Power % - + Save Image - + Image (*.png) - + Save File - + No image file selected. @@ -354,72 +354,77 @@ - + The minimum calculated pressure in Bar for this beerstyle - + Bar - + The maximum volumes CO2 for this beerstyle - + Vol CO2 - + Maximum: - + The minimum volumes CO2 for this beerstyle - + The maximum calculated pressure in Bar for this beerstyle - + Minimum: - + Style limits - + The expected calculated pressure in Bar for this beer - + This beer: - + The desired volumes CO2 for this beer - + + Expected + + + + Quit - + Log @@ -429,12 +434,12 @@ - + Online - + Offline diff -r b67fb2e5bb41 -r 76f3a96e82b5 translations/bmsapp_nl.ts --- a/translations/bmsapp_nl.ts Fri Feb 10 10:09:37 2023 +0100 +++ b/translations/bmsapp_nl.ts Fri Feb 10 14:06:47 2023 +0100 @@ -145,47 +145,47 @@ Lucht - + Beer Bier - + Chiller Koeler - + Date Datum - + Temp °C Temp °C - + Power % Power % - + Save Image Opslaan plaatje - + Image (*.png) Plaatje (*.png) - + Save File Bestand opslaan - + No image file selected. Geen plaatjes bestand gekozen. @@ -403,61 +403,66 @@ Toont de temperatuur - + The minimum calculated pressure in Bar for this beerstyle De minimum berekende druk in Bar voor deze bierstijl - + Bar Bar - + The maximum volumes CO2 for this beerstyle De maximum volumes CO2 voor deze bierstijl - + Vol CO2 Vol CO2 - + Maximum: Maximum: - + The minimum volumes CO2 for this beerstyle De minimum volumes CO2 voor deze bierstijl - + The maximum calculated pressure in Bar for this beerstyle De maximum berekende druk in Bar voor deze bierstijl - + Minimum: Minimum: - + The expected calculated pressure in Bar for this beer De berekende verwachte druk in Bar voor dit bier - + This beer: Dit bier: - + The desired volumes CO2 for this beer De gewenste volumes CO2 voor dit bier + + Expected + Verwacht + + Maximum Maximum @@ -466,7 +471,7 @@ Minimum - + Style limits Stijl limieten @@ -487,12 +492,12 @@ Toont de lucht temperatuur - + Quit Terug - + Log Log @@ -502,12 +507,12 @@ BMSapp - Details carbonatie - + Online Online - + Offline Offline diff -r b67fb2e5bb41 -r 76f3a96e82b5 ui/DetailCO2meter.ui --- a/ui/DetailCO2meter.ui Fri Feb 10 10:09:37 2023 +0100 +++ b/ui/DetailCO2meter.ui Fri Feb 10 14:06:47 2023 +0100 @@ -22,7 +22,7 @@ 740 0 261 - 231 + 151 @@ -109,7 +109,7 @@ 0 0 721 - 231 + 201 @@ -310,16 +310,16 @@ 0 - 240 + 210 721 - 291 + 321 140 - 260 + 280 111 20 @@ -335,7 +335,7 @@ 470 - 260 + 280 111 20 @@ -351,7 +351,7 @@ 400 - 10 + 20 251 251 @@ -377,7 +377,7 @@ 70 - 10 + 20 251 251 @@ -396,6 +396,9 @@ 14 + false + false + true @@ -407,9 +410,9 @@ 740 - 240 + 160 261 - 181 + 251 @@ -623,7 +626,7 @@ - 12 + 11 75 true @@ -639,7 +642,7 @@ 180 - 140 + 200 71 24 @@ -673,7 +676,7 @@ 10 - 140 + 200 81 20 @@ -689,7 +692,7 @@ 100 - 140 + 200 71 24 @@ -719,21 +722,44 @@ 1.000000000000000 + + + + 10 + 160 + 241 + 25 + + + + + 11 + 75 + true + + + + Expected + + + Qt::AlignCenter + + 740 - 430 + 420 261 - 101 + 111 90 - 60 + 70 80 23