src/EditProductTab4.cpp

changeset 380
8f5c03ed4321
parent 375
c21567bfd703
child 398
49cf387e9070
--- 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);

mercurial