Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.

Wed, 18 May 2022 08:59:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 18 May 2022 08:59:54 +0200
changeset 218
725da10db56c
parent 217
6c2cd26095a5
child 219
fa7cad488e27

Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.

src/EditProduct.cpp file | annotate | diff | comparison | revisions
src/Utils.cpp file | annotate | diff | comparison | revisions
ui/EditProduct.ui file | annotate | diff | comparison | revisions
--- a/src/EditProduct.cpp	Tue May 17 21:19:31 2022 +0200
+++ b/src/EditProduct.cpp	Wed May 18 08:59:54 2022 +0200
@@ -940,13 +940,11 @@
     ui->brew_preboilvolEdit->setValue(product->brew_preboil_volume);
     ui->brew_preboilvolShow->setValue(product->boil_size * 1.04);
     ui->brew_preboileffShow->setValue(product->brew_preboil_efficiency);
-    calcEfficiencyBeforeBoil();
     ui->brew_aboilphEdit->setValue(product->brew_aboil_ph);
     ui->brew_aboilsgEdit->setValue(product->brew_aboil_sg);
     ui->brew_aboilvolEdit->setValue(product->brew_aboil_volume);
     ui->brew_aboilvolShow->setValue(product->batch_size * 1.04);
     ui->brew_aboileffShow->setValue(product->brew_aboil_efficiency);
-    calcEfficiencyAfterBoil();
     ui->brew_whirlpool9Edit->setValue(product->brew_whirlpool9);
     ui->brew_whirlpool7Edit->setValue(product->brew_whirlpool7);
     ui->brew_whirlpool6Edit->setValue(product->brew_whirlpool6);
@@ -973,11 +971,11 @@
     ui->prim_maxCEdit->setValue(product->primary_max_temp);
     ui->prim_endCEdit->setValue(product->primary_end_temp);
     ui->prim_endsgEdit->setValue(product->primary_end_sg);
-    ui->prim_enddateEdit->setText(product->primary_end_date.toString("dd MMM yyyy"));
+    ui->prim_enddateEdit->setDate(product->primary_end_date);
     ui->prim_attShow->setValue(Utils::calc_svg(product->brew_fermenter_sg, product->primary_end_sg));
     ui->sec_tempEdit->setValue(product->secondary_temp);
     ui->sec_sgEdit->setValue(product->secondary_end_sg);
-    ui->sec_enddateEdit->setText(product->secondary_end_date.toString("dd MMM yyyy"));
+    ui->sec_enddateEdit->setDate(product->secondary_end_date);
     ui->sec_attShow->setValue(Utils::calc_svg(product->brew_fermenter_sg, product->secondary_end_sg));
     ui->tert_tempEdit->setValue(product->tertiary_temp);
     ui->tert_estsgShow->setValue(product->est_fg);
@@ -1014,6 +1012,8 @@
     ui->taste_mouthfeelEdit->setText(product->taste_mouthfeel);
     ui->taste_aftertasteEdit->setText(product->taste_aftertaste);
 
+    qDebug() << "== Start connecting ==";
+
     // All signals from tab "Generic"
     connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditProduct::is_changed);
     connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditProduct::name_changed);
@@ -1082,6 +1082,8 @@
     connect(ui->sp_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_ph_changed);
 
     /* All signals from tab Brewday */
+    calcEfficiencyBeforeBoil();
+    calcEfficiencyAfterBoil();
     connect(ui->brew_startButton1, SIGNAL(clicked()), this, SLOT(brew_date_today()));
     connect(ui->brew_startButton2, SIGNAL(clicked()), this, SLOT(brew_date_clear()));
     connect(ui->brew_startDate, &QDateEdit::dateChanged, this, &EditProduct::brew_start_date_changed);
--- a/src/Utils.cpp	Tue May 17 21:19:31 2022 +0200
+++ b/src/Utils.cpp	Wed May 18 08:59:54 2022 +0200
@@ -241,6 +241,9 @@
 
 double Utils::calc_svg(double og, double fg)
 {
+    if (og == 0.0 || fg == 0.0)
+	return 0;
+
     double oe = sg_to_plato(og);
     double ae = sg_to_plato(fg);
 
--- a/ui/EditProduct.ui	Tue May 17 21:19:31 2022 +0200
+++ b/ui/EditProduct.ui	Wed May 18 08:59:54 2022 +0200
@@ -95,7 +95,7 @@
        <enum>QTabWidget::Rounded</enum>
       </property>
       <property name="currentIndex">
-       <number>0</number>
+       <number>9</number>
       </property>
       <property name="elideMode">
        <enum>Qt::ElideNone</enum>
@@ -8021,7 +8021,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary start SG:</string>
+          <string>Start density:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8037,7 +8037,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary start temp °C:</string>
+          <string>Start temperature °C:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8053,7 +8053,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary peak temp °C:</string>
+          <string>Peak temperature °C:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8069,7 +8069,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary end temp °C:</string>
+          <string>End temperature °C:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8085,7 +8085,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary end SG:</string>
+          <string>End density:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8101,7 +8101,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary end date:</string>
+          <string>End date:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8226,22 +8226,6 @@
           <double>0.001000000000000</double>
          </property>
         </widget>
-        <widget class="QLineEdit" name="prim_enddateEdit">
-         <property name="geometry">
-          <rect>
-           <x>180</x>
-           <y>170</y>
-           <width>101</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>End of primary fermentation, start secondary.</string>
-         </property>
-         <property name="readOnly">
-          <bool>true</bool>
-         </property>
-        </widget>
         <widget class="QLabel" name="prim_attLabel">
          <property name="geometry">
           <rect>
@@ -8252,7 +8236,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Primary attenuation:</string>
+          <string>Apparent attenuation:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8289,7 +8273,7 @@
         <widget class="QToolButton" name="prim_endsgButton">
          <property name="geometry">
           <rect>
-           <x>290</x>
+           <x>300</x>
            <y>140</y>
            <width>28</width>
            <height>22</height>
@@ -8309,14 +8293,14 @@
         <widget class="QToolButton" name="prim_enddateButton">
          <property name="geometry">
           <rect>
-           <x>290</x>
+           <x>300</x>
            <y>170</y>
            <width>28</width>
            <height>22</height>
           </rect>
          </property>
          <property name="toolTip">
-          <string>Set or clear date</string>
+          <string>Set the date to today</string>
          </property>
          <property name="text">
           <string>...</string>
@@ -8326,6 +8310,25 @@
            <normaloff>:/icons/silk/date.png</normaloff>:/icons/silk/date.png</iconset>
          </property>
         </widget>
+        <widget class="NullDateEdit" name="prim_enddateEdit">
+         <property name="geometry">
+          <rect>
+           <x>180</x>
+           <y>170</y>
+           <width>111</width>
+           <height>24</height>
+          </rect>
+         </property>
+         <property name="toolTip">
+          <string>Edit the brewdate plan or start.</string>
+         </property>
+         <property name="displayFormat">
+          <string>dd-MM-yyyy</string>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
        </widget>
        <widget class="QGroupBox" name="secondaryBox">
         <property name="geometry">
@@ -8349,7 +8352,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Secondary end temp °C:</string>
+          <string>End temperature °C:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8365,7 +8368,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Secondary end SG:</string>
+          <string>End density:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8381,7 +8384,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Secondary end date:</string>
+          <string>End date:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8434,22 +8437,6 @@
           <double>0.001000000000000</double>
          </property>
         </widget>
-        <widget class="QLineEdit" name="sec_enddateEdit">
-         <property name="geometry">
-          <rect>
-           <x>180</x>
-           <y>80</y>
-           <width>101</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>End of fermentation. Optional transfer to lagertank.</string>
-         </property>
-         <property name="readOnly">
-          <bool>true</bool>
-         </property>
-        </widget>
         <widget class="QLabel" name="sec_attLabel">
          <property name="geometry">
           <rect>
@@ -8460,7 +8447,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Secondary attenuation:</string>
+          <string>Apparent attenuation:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8497,7 +8484,7 @@
         <widget class="QToolButton" name="sec_sgButton">
          <property name="geometry">
           <rect>
-           <x>290</x>
+           <x>300</x>
            <y>50</y>
            <width>28</width>
            <height>22</height>
@@ -8517,14 +8504,14 @@
         <widget class="QToolButton" name="sec_enddateButton">
          <property name="geometry">
           <rect>
-           <x>290</x>
+           <x>300</x>
            <y>80</y>
            <width>28</width>
            <height>22</height>
           </rect>
          </property>
          <property name="toolTip">
-          <string>Set or clear date</string>
+          <string>Set the date to today</string>
          </property>
          <property name="text">
           <string>...</string>
@@ -8534,6 +8521,25 @@
            <normaloff>:/icons/silk/date.png</normaloff>:/icons/silk/date.png</iconset>
          </property>
         </widget>
+        <widget class="NullDateEdit" name="sec_enddateEdit">
+         <property name="geometry">
+          <rect>
+           <x>180</x>
+           <y>80</y>
+           <width>111</width>
+           <height>24</height>
+          </rect>
+         </property>
+         <property name="toolTip">
+          <string>Edit the brewdate plan or start.</string>
+         </property>
+         <property name="displayFormat">
+          <string>dd-MM-yyyy</string>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
        </widget>
        <widget class="QGroupBox" name="tertiaryBox">
         <property name="geometry">
@@ -8557,7 +8563,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Tertiary temperature °C:</string>
+          <string>Average temperature °C:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8573,7 +8579,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Tertiary end SG:</string>
+          <string>Final density:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8636,7 +8642,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Tertiary attenuation:</string>
+          <string>Apparent attenuation:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8700,7 +8706,7 @@
           </rect>
          </property>
          <property name="text">
-          <string>Expected end SG:</string>
+          <string>Expected end density:</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -8766,7 +8772,7 @@
           <string> %</string>
          </property>
          <property name="decimals">
-          <number>1</number>
+          <number>2</number>
          </property>
          <property name="maximum">
           <double>100.000000000000000</double>

mercurial