Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.

Sat, 30 Jul 2022 16:30:02 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 30 Jul 2022 16:30:02 +0200
changeset 380
8f5c03ed4321
parent 379
0f2ce4ebd1b8
child 381
34ba0be70f79

Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.

src/EditHop.cpp file | annotate | diff | comparison | revisions
src/EditHop.h file | annotate | diff | comparison | revisions
src/EditProductTab4.cpp file | annotate | diff | comparison | revisions
src/InventoryHops.cpp file | annotate | diff | comparison | revisions
src/MainWindow.cpp file | annotate | diff | comparison | revisions
src/Setup.cpp file | annotate | diff | comparison | revisions
src/Setup.h file | annotate | diff | comparison | revisions
src/Utils.cpp file | annotate | diff | comparison | revisions
src/global.cpp file | annotate | diff | comparison | revisions
src/global.h file | annotate | diff | comparison | revisions
--- a/src/EditHop.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/EditHop.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -71,9 +71,9 @@
 	ui->bufactorEdit->setValue(query.value("bu_factor").toDouble());
     } else {
 	/* Set some defaults */
-	ui->typeEdit->setCurrentIndex(0);
-	ui->formEdit->setCurrentIndex(0);
-	ui->utilisationEdit->setValue(20.0);
+	ui->typeEdit->setCurrentIndex(HOP_TYPE_BITTERING);
+	ui->formEdit->setCurrentIndex(HOP_FORMS_PELLET);
+	ui->utilisationEdit->setValue(my_ut_pellet);
 	ui->bufactorEdit->setValue(1.0);
 	ui->prodEdit->clear();
 	ui->thtEdit->clear();
@@ -87,7 +87,7 @@
     connect(ui->myrceneEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed);
     connect(ui->hsiEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed);
     connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditHop::is_changed);
-    connect(ui->formEdit, &QComboBox::currentTextChanged, this, &EditHop::is_changed);
+    connect(ui->formEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditHop::form_changed);
     connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed()));
     connect(ui->originEdit, &QLineEdit::textChanged, this, &EditHop::is_changed);
     connect(ui->substitutesEdit, &QLineEdit::textChanged, this, &EditHop::is_changed);
@@ -136,12 +136,6 @@
 	txt.append((QString(" **")));
     }
     setWindowTitle(txt);
-
-    if (ui->formEdit->currentIndex() < HOP_FORMS_CO2EXTRACT) {
-        ui->inventoryEdit->setSuffix(tr(" Kg"));
-    } else {
-        ui->inventoryEdit->setSuffix(tr(" L"));
-    }
 }
 
 
@@ -306,6 +300,20 @@
 }
 
 
+void EditHop::form_changed(int val)
+{
+    switch (val) {
+	case HOP_FORMS_PELLET:		ui->utilisationEdit->setValue(my_ut_pellet);		break;
+	case HOP_FORMS_PLUG:		ui->utilisationEdit->setValue(my_ut_plug);		break;
+	case HOP_FORMS_LEAF:		ui->utilisationEdit->setValue(my_ut_leaf);		break;
+	case HOP_FORMS_LEAF_WET:	ui->utilisationEdit->setValue(my_ut_wethop);		break;
+	case HOP_FORMS_CRYO:		ui->utilisationEdit->setValue(my_ut_t45);		break;
+	case HOP_FORMS_CO2EXTRACT:	ui->utilisationEdit->setValue(my_ut_co2extract);	break;
+    }
+    is_changed();
+}
+
+
 void EditHop::on_quitButton_clicked()
 {
     if (this->textIsChanged) {
--- a/src/EditHop.h	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/EditHop.h	Sat Jul 30 16:30:02 2022 +0200
@@ -25,6 +25,7 @@
     void on_quitButton_clicked();
     void on_deleteButton_clicked();
     void is_changed();
+    void form_changed(int val);
     void prod_date_clear();
     void prod_date_today();
     void tht_date_clear();
--- a/src/EditProductTab4.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/EditProductTab4.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -325,7 +325,7 @@
     newh.myrcene = 0;
     newh.total_oil = 0;
     newh.inventory = 0;
-    newh.utilisation = 20;
+    newh.utilisation = my_ut_pellet;
     newh.bu_factor = 1;
 
     product->hops.append(newh);
@@ -549,15 +549,17 @@
     if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) {
 	htimeLabel->setText(tr("Time in minutes:"));
         htimeEdit->setValue(product->hops.at(product->hops_row).time);
-	htimeEdit->setReadOnly(false);
+	htimeLabel->show();
+	htimeEdit->show();
     } else if (val == HOP_USEAT_DRY_HOP) {
         htimeLabel->setText(tr("Time in days:"));
 	htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440);
-	htimeEdit->setReadOnly(false);
+	htimeLabel->show();
+        htimeEdit->show();
     } else {
-        htimeLabel->setText("");
 	htimeEdit->setValue(0);
-	htimeEdit->setReadOnly(true);
+	htimeLabel->hide();
+        htimeEdit->hide();
     }
 
     is_changed();
@@ -603,12 +605,10 @@
     amountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     htimeLabel = new QLabel(dialog);
     htimeLabel->setObjectName(QString::fromUtf8("htimeLabel"));
-    if (product->hops.at(product->hops_row).useat == 5)		// Dry-hop
+    if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP)
 	htimeLabel->setText(tr("Time in days:"));
-    else if (product->hops.at(product->hops_row).useat == 2 || product->hops.at(product->hops_row).useat == 4)	// Boil or whirlpool
+    else
     	htimeLabel->setText(tr("Time in minutes:"));
-    else
-	htimeLabel->setText("");
 
     htimeLabel->setGeometry(QRect(10, 130, 141, 20));
     htimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -664,23 +664,21 @@
     htimeEdit->setMaximum(10000.0);
     if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) {
 	htimeEdit->setValue(product->hops.at(product->hops_row).time);
-	htimeEdit->setReadOnly(false);
+	htimeLabel->show();
+	htimeEdit->show();
     } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) {
 	htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440);
-	htimeEdit->setReadOnly(false);
+	htimeLabel->show();
+        htimeEdit->show();
     } else {
-	htimeEdit->setReadOnly(true);
+	htimeLabel->hide();
+        htimeEdit->hide();
     }
     useatEdit = new QComboBox(dialog);
     useatEdit->setObjectName(QString::fromUtf8("useatEdit"));
     useatEdit->setGeometry(QRect(160, 160, 161, 23));
-    useatEdit->addItem(tr("Mash"));
-    useatEdit->addItem(tr("First wort"));
-    useatEdit->addItem(tr("Boil"));
-    useatEdit->addItem(tr("Aroma"));
-    useatEdit->addItem(tr("Whirlpool"));
-    useatEdit->addItem(tr("Dry hop"));
-    useatEdit->addItem(tr("Bottling"));
+    for (int i = 0; i < 7; i++)
+	useatEdit->addItem(QCoreApplication::translate("HopUse", g_hop_useat[i]));
     useatEdit->setCurrentIndex(product->hops.at(product->hops_row).useat);
 
     hinstockEdit = new QCheckBox(dialog);
--- a/src/InventoryHops.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/InventoryHops.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -143,18 +143,10 @@
 
 	w = QString("");
 	if (query.value("inventory").toDouble() > 0) {
-	    if (query.value("form").toInt() < HOP_FORMS_CO2EXTRACT) {
-	    	if (query.value("inventory").toDouble() < 1.000) {
-	      	    w = QString("%1 gr").arg(query.value("inventory").toDouble() * 1000.0, 2, 'f', 1, '0' );
-	    	} else {
-              	    w = QString("%1 kg").arg(query.value("inventory").toDouble(), 4, 'f', 3, '0' );
-	    	}
+	    if (query.value("inventory").toDouble() < 1.000) {
+	      	w = QString("%1 gr").arg(query.value("inventory").toDouble() * 1000.0, 2, 'f', 1, '0' );
 	    } else {
-            	if (query.value("inventory").toDouble() < 1.000) {
-              	    w = QString("%1 mL").arg(query.value("inventory").toDouble() * 1000.0, 2, 'f', 1, '0' );
-            	} else {
-              	    w = QString("%1 L").arg(query.value("inventory").toDouble(), 4, 'f', 3, '0' );
-            	}
+              	w = QString("%1 kg").arg(query.value("inventory").toDouble(), 4, 'f', 3, '0' );
 	    }
         }
 	item = new QTableWidgetItem(w);
--- a/src/MainWindow.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/MainWindow.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -133,10 +133,12 @@
     my_logoByteArray = query.value("brewery_logo").toByteArray();
     my_factor_mashhop = query.value("factor_mashhop").toInt();
     my_factor_fwh = query.value("factor_fwh").toInt();
-    my_factor_pellet = query.value("factor_pellet").toInt();
-    my_factor_plug = query.value("factor_plug").toInt();
-    my_factor_wethop = query.value("factor_wethop").toInt();
-    my_factor_cryohop = query.value("factor_cryohop").toInt();
+    my_ut_pellet = query.value("ut_pellet").toDouble();
+    my_ut_plug = query.value("ut_plug").toDouble();
+    my_ut_leaf = query.value("ut_leaf").toDouble();
+    my_ut_wethop = query.value("ut_wethop").toDouble();
+    my_ut_t45 = query.value("ut_t45").toDouble();
+    my_ut_co2extract = query.value("ut_co2extract").toDouble();
     my_ibu_method = query.value("ibu_method").toInt();
     my_color_method = query.value("color_method").toInt();
     my_brix_correction = query.value("brix_correction").toDouble();
--- a/src/Setup.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/Setup.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -53,39 +53,52 @@
 
     fwhLabel = new QLabel(topWidget);
     fwhLabel->setObjectName(QString::fromUtf8("fwhLabel"));
-    fwhLabel->setGeometry(QRect(60, 120, 131, 20));
+    fwhLabel->setGeometry(QRect(10, 120, 181, 20));
     fwhLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     fwhLabel->setText(tr("First Wort Hop factor:"));
 
     mashhopLabel = new QLabel(topWidget);
     mashhopLabel->setObjectName(QString::fromUtf8("mashhopLabel"));
-    mashhopLabel->setGeometry(QRect(60, 150, 131, 20));
+    mashhopLabel->setGeometry(QRect(10, 150, 181, 20));
     mashhopLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     mashhopLabel->setText(tr("Mash Hop factor:"));
 
     pelletLabel = new QLabel(topWidget);
     pelletLabel->setObjectName(QString::fromUtf8("pelletLabel"));
-    pelletLabel->setGeometry(QRect(60, 180, 131, 20));
+    pelletLabel->setGeometry(QRect(10, 210, 181, 20));
     pelletLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
-    pelletLabel->setText(tr("Pellet Hop factor:"));
+    pelletLabel->setText(tr("Hop Pellets utilisation:"));
 
     hopplugLabel = new QLabel(topWidget);
-    hopplugLabel->setObjectName(QString::fromUtf8("hopplugLabel"));
-    hopplugLabel->setGeometry(QRect(60, 210, 131, 20));
+    hopplugLabel->setObjectName(QString::fromUtf8("plugsLabel"));
+    hopplugLabel->setGeometry(QRect(10, 240, 181, 20));
     hopplugLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
-    hopplugLabel->setText(tr("Hop Plugs factor:"));
+    hopplugLabel->setText(tr("Hop Plugs utilisation:"));
+
+    leafLabel = new QLabel(topWidget);
+    leafLabel->setObjectName(QString::fromUtf8("leafLabel"));
+    leafLabel->setGeometry(QRect(10, 270, 181, 20));
+    leafLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    leafLabel->setText(tr("Hop Leafs utilisation:"));
 
     wethopLabel = new QLabel(topWidget);
     wethopLabel->setObjectName(QString::fromUtf8("wethopLabel"));
-    wethopLabel->setGeometry(QRect(60, 240, 131, 20));
+    wethopLabel->setGeometry(QRect(10, 300, 181, 20));
     wethopLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
-    wethopLabel->setText(tr("Wet Hop factor:"));
+    wethopLabel->setText(tr("Wet Hop utilisation:"));
 
     cryohopLabel = new QLabel(topWidget);
     cryohopLabel->setObjectName(QString::fromUtf8("cryohopLabel"));
-    cryohopLabel->setGeometry(QRect(60, 270, 131, 20));
+    cryohopLabel->setGeometry(QRect(10, 330, 181, 20));
     cryohopLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
-    cryohopLabel->setText(tr("Cryo Hop\302\256 factor:"));
+    cryohopLabel->setText(tr("Cryo Hop\302\256 utilisation:"));
+
+    extractLabel = new QLabel(topWidget);
+    extractLabel->setObjectName(QString::fromUtf8("extractLabel"));
+    extractLabel->setGeometry(QRect(10, 360, 181, 20));
+    extractLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    extractLabel->setText(tr("CO2 Hop Extract utilisation:"));
+
 
     fwhEdit = new QSpinBox(topWidget);
     fwhEdit->setObjectName(QString::fromUtf8("fwhEdit"));
@@ -107,45 +120,66 @@
     mashhopEdit->setToolTip(tr("The efficiency for Mash hopping."));
     mashhopEdit->setSuffix(tr("%"));
 
-    pelletEdit = new QSpinBox(topWidget);
+    pelletEdit = new QDoubleSpinBox(topWidget);
     pelletEdit->setObjectName(QString::fromUtf8("pelletEdit"));
-    pelletEdit->setGeometry(QRect(210, 180, 81, 24));
+    pelletEdit->setGeometry(QRect(210, 210, 81, 24));
     pelletEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     pelletEdit->setAccelerated(true);
-    pelletEdit->setMinimum(0);
-    pelletEdit->setMaximum(20);
-    pelletEdit->setToolTip(tr("The efficiency for hop pellets."));
+    pelletEdit->setMaximum(100);
+    pelletEdit->setDecimals(1);
+    pelletEdit->setToolTip(tr("The utilisation for hop pellets, default 22"));
     pelletEdit->setSuffix(tr("%"));
 
-    hopplugEdit = new QSpinBox(topWidget);
+    hopplugEdit = new QDoubleSpinBox(topWidget);
     hopplugEdit->setObjectName(QString::fromUtf8("hopplugEdit"));
-    hopplugEdit->setGeometry(QRect(210, 210, 81, 24));
+    hopplugEdit->setGeometry(QRect(210, 240, 81, 24));
     hopplugEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     hopplugEdit->setAccelerated(true);
-    hopplugEdit->setMaximum(20);
-    hopplugEdit->setToolTip(tr("The efficiency for hop plugs."));
+    hopplugEdit->setMaximum(100);
+    hopplugEdit->setDecimals(1);
+    hopplugEdit->setToolTip(tr("The utilisation for hop plugs, default 20.4"));
     hopplugEdit->setSuffix(tr("%"));
 
-    wethopEdit = new QSpinBox(topWidget);
+    leafEdit = new QDoubleSpinBox(topWidget);
+    leafEdit->setObjectName(QString::fromUtf8("leafEdit"));
+    leafEdit->setGeometry(QRect(210, 270, 81, 24));
+    leafEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    leafEdit->setAccelerated(true);
+    leafEdit->setMaximum(100);
+    leafEdit->setDecimals(1);
+    leafEdit->setToolTip(tr("The utilisation for hop leafs, default 20"));
+    leafEdit->setSuffix(tr("%"));
+
+    wethopEdit = new QDoubleSpinBox(topWidget);
     wethopEdit->setObjectName(QString::fromUtf8("wethopEdit"));
-    wethopEdit->setGeometry(QRect(210, 240, 81, 24));
+    wethopEdit->setGeometry(QRect(210, 300, 81, 24));
     wethopEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     wethopEdit->setAccelerated(true);
-    wethopEdit->setMinimum(-98);
-    wethopEdit->setMaximum(-20);
-    wethopEdit->setToolTip(tr("The efficiency for fresh hops."));
+    wethopEdit->setMaximum(100);
+    wethopEdit->setDecimals(1);
+    wethopEdit->setToolTip(tr("The uyilisation for fresh hops, default 3.6"));
     wethopEdit->setSuffix(tr("%"));
 
-    cryohopEdit = new QSpinBox(topWidget);
+    cryohopEdit = new QDoubleSpinBox(topWidget);
     cryohopEdit->setObjectName(QString::fromUtf8("cryohopEdit"));
-    cryohopEdit->setGeometry(QRect(210, 270, 81, 24));
+    cryohopEdit->setGeometry(QRect(210, 330, 81, 24));
     cryohopEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     cryohopEdit->setAccelerated(true);
-    cryohopEdit->setMinimum(-20);
-    cryohopEdit->setMaximum(150);
-    cryohopEdit->setToolTip(tr("The efficiency for using Cryo Hop\302\256."));
+    cryohopEdit->setMaximum(100);
+    cryohopEdit->setDecimals(1);
+    cryohopEdit->setToolTip(tr("The utilisation for using Cryo Hop\302\256, default 50"));
     cryohopEdit->setSuffix(tr("%"));
 
+    extractEdit = new QDoubleSpinBox(topWidget);
+    extractEdit->setObjectName(QString::fromUtf8("extractEdit"));
+    extractEdit->setGeometry(QRect(210, 360, 81, 24));
+    extractEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    extractEdit->setAccelerated(true);
+    extractEdit->setMaximum(100);
+    extractEdit->setDecimals(1);
+    extractEdit->setToolTip(tr("The utilisation for using CO2 hop extract, default 35"));
+    extractEdit->setSuffix(tr("%"));
+
     grainLabel = new QLabel(topWidget);
     grainLabel->setObjectName(QString::fromUtf8("grainLabel"));
     grainLabel->setGeometry(QRect(400, 120, 161, 20));
@@ -318,16 +352,20 @@
 
     fwhEdit->setValue(query.value("factor_fwh").toInt());
     mashhopEdit->setValue(query.value("factor_mashhop").toInt());
-    pelletEdit->setValue(query.value("factor_pellet").toInt());
-    hopplugEdit->setValue(query.value("factor_plug").toInt());
-    wethopEdit->setValue(query.value("factor_wethop").toInt());
-    cryohopEdit->setValue(query.value("factor_cryohop").toInt());
+    pelletEdit->setValue(query.value("ut_pellet").toDouble());
+    hopplugEdit->setValue(query.value("ut_plug").toDouble());
+    leafEdit->setValue(query.value("ut_leaf").toDouble());
+    wethopEdit->setValue(query.value("ut_wethop").toDouble());
+    cryohopEdit->setValue(query.value("ut_t45").toDouble());
+    extractEdit->setValue(query.value("ut_co2extract").toDouble());
     connect(fwhEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
     connect(mashhopEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
-    connect(pelletEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
-    connect(hopplugEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
-    connect(wethopEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
-    connect(cryohopEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
+    connect(pelletEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
+    connect(hopplugEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
+    connect(leafEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
+    connect(wethopEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
+    connect(cryohopEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
+    connect(extractEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
 
     grainEdit->setValue(query.value("grain_absorbtion").toDouble());
     brixEdit->setValue(query.value("brix_correction").toDouble());
@@ -471,7 +509,8 @@
      * Update all other data
      */
     query.prepare("UPDATE profile_setup SET brewery_name=:brewery, brewery_logo=:logo, factor_mashhop=:mashhop, factor_fwh=:fwh, "
-		  "factor_pellet=:pellet, factor_plug=:plug, factor_wethop=:wet, factor_cryohop=:cryo, color_method=:color, ibu_method=:ibu, "
+		  "ut_pellet=:pellet, ut_plug=:plug, ut_leaf=:leaf, ut_wethop=:wet, ut_t45=:cryo, ut_co2extract=:extract, "
+		  "color_method=:color, ibu_method=:ibu, "
 		  "brix_correction=:brix, grain_absorbtion=:grain, default_water=:water, my_yeastlab=:yeast, "
 		  "brewery_height=:height  WHERE record='1'");
     query.bindValue(":brewery", this->breweryEdit->text());
@@ -480,8 +519,10 @@
     query.bindValue(":fwh", this->fwhEdit->value());
     query.bindValue(":pellet", this->pelletEdit->value());
     query.bindValue(":plug", this->hopplugEdit->value());
+    query.bindValue(":leaf", this->leafEdit->value());
     query.bindValue(":wet", this->wethopEdit->value());
     query.bindValue(":cryo", this->cryohopEdit->value());
+    query.bindValue(":extract", this->extractEdit->value());
     query.bindValue(":color", this->colorEdit->currentIndex());
     query.bindValue(":ibu", this->ibuEdit->currentIndex());
     query.bindValue(":brix", this->brixEdit->value());
--- a/src/Setup.h	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/Setup.h	Sat Jul 30 16:30:02 2022 +0200
@@ -50,10 +50,12 @@
     QLabel *breweryLabel;
     QLabel *fwhLabel;
     QLabel *mashhopLabel;
+    QLabel *leafLabel;
     QLabel *pelletLabel;
     QLabel *hopplugLabel;
     QLabel *wethopLabel;
     QLabel *cryohopLabel;
+    QLabel *extractLabel;
     QLabel *grainLabel;
     QLabel *brixLabel;
     QLabel *heightLabel;
@@ -67,10 +69,12 @@
 
     QSpinBox *fwhEdit;
     QSpinBox *mashhopEdit;
-    QSpinBox *pelletEdit;
-    QSpinBox *hopplugEdit;
-    QSpinBox *wethopEdit;
-    QSpinBox *cryohopEdit;
+    QDoubleSpinBox *pelletEdit;
+    QDoubleSpinBox *hopplugEdit;
+    QDoubleSpinBox *leafEdit;
+    QDoubleSpinBox *wethopEdit;
+    QDoubleSpinBox *cryohopEdit;
+    QDoubleSpinBox *extractEdit;
     QComboBox *waterEdit;
     QDoubleSpinBox *grainEdit;
     QDoubleSpinBox *brixEdit;
--- a/src/Utils.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/Utils.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -395,7 +395,6 @@
 {
     double alpha = Alpha / 100.0;
     double mass = Amount * 1000.0;
-    double ibu = 0.0;
 
     /*
      * Basic Glenn Tinseth formula.
@@ -410,23 +409,10 @@
     double Bigness_factor = 1.65 * pow(0.000125, SG - 1);
     double BoilTime_factor1 = ((1 - exp(-0.04 * T1)) / kUtilisation);
     double BoilTime_factor2 = ((1 - exp(-0.04 * T2)) / kUtilisation);
-    ibu = Bigness_factor * (BoilTime_factor2 - BoilTime_factor1) * AddedAlphaAcids;
-    qDebug() << "TinsethIBU" << SG << Amount << Alpha << Volume << kUtilisation << Bigness_factor * (BoilTime_factor2 - BoilTime_factor1) << "ibu:" << ibu;
+    double ibu = Bigness_factor * (BoilTime_factor2 - BoilTime_factor1) * AddedAlphaAcids;
+    //qDebug() << "TinsethIBU" << SG << Amount << Alpha << Volume << kUtilisation << Bigness_factor * (BoilTime_factor2 - BoilTime_factor1) << "ibu:" << ibu;
 
-    /*
-     * Correction for hop forms
-     */
-    if (Form == HOP_FORMS_PELLET) {
-	ibu *= (1 + my_factor_pellet / 100.0);
-    } else if (Form == HOP_FORMS_PLUG) {
-	ibu *= (1 + my_factor_plug / 100.0);
-    } else if (Form == HOP_FORMS_LEAF_WET) {
-	ibu *= (1 + my_factor_wethop / 100.0);      // From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
-    } else if (Form == HOP_FORMS_CRYO) {
-	ibu *= (1 + my_factor_cryohop / 100.0);
-    }
-
-    qDebug() << "boilIBU" << Form << SG << Volume << Amount << BoilTime_factor2 << BoilTime_factor1 << Alpha << "IBU:" << ibu;
+    //qDebug() << "boilIBU" << Form << SG << Volume << Amount << BoilTime_factor2 << BoilTime_factor1 << Alpha << "IBU:" << ibu;
     return ibu;
 }
 
--- a/src/global.cpp	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/global.cpp	Sat Jul 30 16:30:02 2022 +0200
@@ -9,10 +9,6 @@
 QByteArray my_logoByteArray = 0;
 int my_factor_mashhop = -30;
 int my_factor_fwh = 10;
-int my_factor_pellet = 10;
-int my_factor_plug = 2;
-int my_factor_wethop = -82;
-int my_factor_cryohop = 100;
 int my_ibu_method = 0;
 int my_color_method = 0;
 double my_brix_correction = 1.04;
@@ -20,6 +16,13 @@
 int my_default_water = -1;
 QString my_yeastlab = "";
 int my_height = 0;
+double my_ut_pellet = 22.0;
+double my_ut_plug = 20.4;
+double my_ut_leaf = 20.0;
+double my_ut_wethop = 3.6;
+double my_ut_t45 = 50.0;
+double my_ut_co2extract = 35.0;
+
 
 Recipe *recipe;
 Product *product;
--- a/src/global.h	Fri Jul 29 20:59:21 2022 +0200
+++ b/src/global.h	Sat Jul 30 16:30:02 2022 +0200
@@ -681,10 +681,6 @@
 extern QByteArray	my_logoByteArray;
 extern int		my_factor_mashhop;
 extern int		my_factor_fwh;
-extern int		my_factor_pellet;
-extern int		my_factor_plug;
-extern int		my_factor_wethop;
-extern int		my_factor_cryohop;
 extern int		my_ibu_method;
 extern int		my_color_method;
 extern double		my_brix_correction;
@@ -692,6 +688,12 @@
 extern int		my_default_water;
 extern QString		my_yeastlab;
 extern int		my_height;
+extern double		my_ut_pellet;
+extern double		my_ut_plug;
+extern double		my_ut_leaf;
+extern double		my_ut_wethop;
+extern double		my_ut_t45;
+extern double		my_ut_co2extract;
 
 
 enum ProdStages {

mercurial