Added protection against wrong dry yeast pitchrates.

Thu, 24 Feb 2022 13:42:54 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 24 Feb 2022 13:42:54 +0100
changeset 26
dfc4df8f9632
parent 25
a9da2744609e
child 27
94da58c66913

Added protection against wrong dry yeast pitchrates.

src/EditYeast.cpp file | annotate | diff | comparison | revisions
src/EditYeast.h file | annotate | diff | comparison | revisions
--- a/src/EditYeast.cpp	Mon Feb 21 21:17:33 2022 +0100
+++ b/src/EditYeast.cpp	Thu Feb 24 13:42:54 2022 +0100
@@ -139,10 +139,10 @@
     connect(ui->pitchtempEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::is_changed);
     connect(ui->pofEdit, &QCheckBox::stateChanged, this, &EditYeast::is_changed);
     connect(ui->yeastbankEdit, &QLineEdit::textChanged, this, &EditYeast::is_changed);
-    connect(ui->grhlloEdit, &QSpinBox::textChanged, this, &EditYeast::is_changed);
-    connect(ui->sgloEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::is_changed);
-    connect(ui->grhlhiEdit, &QSpinBox::textChanged, this, &EditYeast::is_changed);
-    connect(ui->sghiEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::is_changed);
+    connect(ui->grhlloEdit, &QSpinBox::textChanged, this, &EditYeast::grhllo_changed);
+    connect(ui->sgloEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::sglo_changed);
+    connect(ui->grhlhiEdit, &QSpinBox::textChanged, this, &EditYeast::grhlhi_changed);
+    connect(ui->sghiEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::sghi_changed);
 
     ui->saveButton->setEnabled(false);
     ui->deleteButton->setEnabled((ui->inventoryEdit->value() == 0 && id >= 0) ? true:false);
@@ -352,6 +352,38 @@
 }
 
 
+void EditYeast::grhllo_changed()
+{
+    if (ui->grhlloEdit->value() > (ui->grhlhiEdit->value() - 1))
+	ui->grhlhiEdit->setValue(ui->grhlloEdit->value() + 1);
+    is_changed();
+}
+
+
+void EditYeast::sglo_changed()
+{
+    if (ui->sgloEdit->value() > (ui->sghiEdit->value() - 0.010))
+	ui->sghiEdit->setValue(ui->sgloEdit->value() + 0.010);
+    is_changed();
+}
+
+
+void EditYeast::grhlhi_changed()
+{
+    if (ui->grhlhiEdit->value() < (ui->grhlloEdit->value() + 1))
+	ui->grhlloEdit->setValue(ui->grhlhiEdit->value() - 1);
+    is_changed();
+}
+
+
+void EditYeast::sghi_changed()
+{
+    if (ui->sghiEdit->value() < (ui->sgloEdit->value() + 0.010))
+	ui->sgloEdit->setValue(ui->sghiEdit->value() - 0.010);
+    is_changed();
+}
+
+
 void EditYeast::on_quitButton_clicked()
 {
     if (this->textIsChanged) {
--- a/src/EditYeast.h	Mon Feb 21 21:17:33 2022 +0100
+++ b/src/EditYeast.h	Thu Feb 24 13:42:54 2022 +0100
@@ -26,6 +26,10 @@
     void is_changed();
     void temp_lo_changed();
     void temp_hi_changed();
+    void grhllo_changed();
+    void sglo_changed();
+    void grhlhi_changed();
+    void sghi_changed();
 
 private:
     Ui::EditYeast *ui;

mercurial