src/PrinterDialog.cpp

changeset 282
d1d208a857b0
parent 280
efc213beb605
child 283
242a68fa7186
--- a/src/PrinterDialog.cpp	Mon Jun 13 12:26:27 2022 +0200
+++ b/src/PrinterDialog.cpp	Mon Jun 13 15:47:16 2022 +0200
@@ -435,29 +435,29 @@
 	double cost_hops = 0;
 	for (int i = 0; i < recipe->hops.size(); i++) {
 
-	    double cost = recipe->hops.at(i).h_amount * recipe->hops.at(i).h_cost;
+	    double cost = recipe->hops.at(i).amount * recipe->hops.at(i).cost;
 	    cost_hops += cost;
-	    double ibu = Utils::toIBU(recipe->hops.at(i).h_useat, recipe->hops.at(i).h_form, recipe->preboil_sg, recipe->batch_size,
-			    	      recipe->hops.at(i).h_amount, recipe->hops.at(i).h_time, recipe->hops.at(i).h_alpha,
-				      recipe->ibu_method, 0, recipe->hops.at(i).h_time, 0, recipe->boil_time);
+	    double ibu = Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->batch_size,
+			    	      recipe->hops.at(i).amount, recipe->hops.at(i).time, recipe->hops.at(i).alpha,
+				      recipe->ibu_method, 0, recipe->hops.at(i).time, 0, recipe->boil_time);
 
-	    if (recipe->hops.at(i).h_useat == 2 || recipe->hops.at(i).h_useat == 4)	// Boil or Whirlpool
-		use = hop_useat[recipe->hops.at(i).h_useat] + QString(" %1 min").arg(recipe->hops.at(i).h_time);
-	    else if (recipe->hops.at(i).h_useat == 5)					// Dryhop
-		use = hop_useat[recipe->hops.at(i).h_useat] + QString(" %1 days").arg(recipe->hops.at(i).h_time / 1440);
+	    if (recipe->hops.at(i).useat == 2 || recipe->hops.at(i).useat == 4)	// Boil or Whirlpool
+		use = hop_useat[recipe->hops.at(i).useat] + QString(" %1 min").arg(recipe->hops.at(i).time);
+	    else if (recipe->hops.at(i).useat == 5)					// Dryhop
+		use = hop_useat[recipe->hops.at(i).useat] + QString(" %1 days").arg(recipe->hops.at(i).time / 1440);
 	    else
-		use = hop_useat[recipe->hops.at(i).h_useat];
+		use = hop_useat[recipe->hops.at(i).useat];
 
-	    if (recipe->hops.at(i).h_amount > 1)
-		amount = QString("%1 kg").arg(recipe->hops.at(i).h_amount, 1, 'f', 3);
+	    if (recipe->hops.at(i).amount > 1)
+		amount = QString("%1 kg").arg(recipe->hops.at(i).amount, 1, 'f', 3);
 	    else
-		amount = QString("%1 gr").arg(recipe->hops.at(i).h_amount * 1000, 1, 'f', 1);
+		amount = QString("%1 gr").arg(recipe->hops.at(i).amount * 1000, 1, 'f', 1);
 
 	    painter.fillRect( 20, y,   715, 20, h_line);
-	    painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft,  recipe->hops.at(i).h_name + " (" + recipe->hops.at(i).h_origin + ")");
-	    painter.drawText(285, y+4,  70, 20, Qt::AlignRight, QString("%1%").arg(recipe->hops.at(i).h_alpha, 1, 'f', 1));
+	    painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft,  recipe->hops.at(i).name + " (" + recipe->hops.at(i).origin + ")");
+	    painter.drawText(285, y+4,  70, 20, Qt::AlignRight, QString("%1%").arg(recipe->hops.at(i).alpha, 1, 'f', 1));
 	    painter.drawText(360, y+4,  70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1));
-	    painter.drawText(435, y+4,  80, 20, Qt::AlignLeft,  hop_forms[recipe->hops.at(i).h_form]);
+	    painter.drawText(435, y+4,  80, 20, Qt::AlignLeft,  hop_forms[recipe->hops.at(i).form]);
 	    painter.drawText(520, y+4,  80, 20, Qt::AlignLeft,	use);
 	    painter.drawText(605, y+4,  60, 20, Qt::AlignRight, amount);
             painter.drawText(670, y+4,  60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
@@ -835,29 +835,29 @@
         double cost_hops = 0;
         for (int i = 0; i < product->hops.size(); i++) {
 
-            double cost = product->hops.at(i).h_amount * product->hops.at(i).h_cost;
+            double cost = product->hops.at(i).amount * product->hops.at(i).cost;
             cost_hops += cost;
-            double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size,
-                                      product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha,
+            double ibu = Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->batch_size,
+                                      product->hops.at(i).amount, product->hops.at(i).time, product->hops.at(i).alpha,
                                       product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time);
 
-            if (product->hops.at(i).h_useat == 2 || product->hops.at(i).h_useat == 4)     // Boil or Whirlpool
-                use = hop_useat[product->hops.at(i).h_useat] + QString(" %1 min").arg(product->hops.at(i).h_time);
-            else if (product->hops.at(i).h_useat == 5)                                   // Dryhop
-                use = hop_useat[product->hops.at(i).h_useat] + QString(" %1 days").arg(product->hops.at(i).h_time / 1440);
+            if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4)     // Boil or Whirlpool
+                use = hop_useat[product->hops.at(i).useat] + QString(" %1 min").arg(product->hops.at(i).time);
+            else if (product->hops.at(i).useat == 5)                                   // Dryhop
+                use = hop_useat[product->hops.at(i).useat] + QString(" %1 days").arg(product->hops.at(i).time / 1440);
             else
-                use = hop_useat[product->hops.at(i).h_useat];
+                use = hop_useat[product->hops.at(i).useat];
 
-            if (product->hops.at(i).h_amount > 1)
-                amount = QString("%1 kg").arg(product->hops.at(i).h_amount, 1, 'f', 3);
+            if (product->hops.at(i).amount > 1)
+                amount = QString("%1 kg").arg(product->hops.at(i).amount, 1, 'f', 3);
             else
-                amount = QString("%1 gr").arg(product->hops.at(i).h_amount * 1000, 1, 'f', 1);
+                amount = QString("%1 gr").arg(product->hops.at(i).amount * 1000, 1, 'f', 1);
 
             painter.fillRect( 20, y,   715, 20, h_line);
-            painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft,  product->hops.at(i).h_name + " (" + product->hops.at(i).h_origin + ")");
-            painter.drawText(285, y+4,  70, 20, Qt::AlignRight, QString("%1%").arg(product->hops.at(i).h_alpha, 1, 'f', 1));
+            painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft,  product->hops.at(i).name + " (" + product->hops.at(i).origin + ")");
+            painter.drawText(285, y+4,  70, 20, Qt::AlignRight, QString("%1%").arg(product->hops.at(i).alpha, 1, 'f', 1));
             painter.drawText(360, y+4,  70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1));
-            painter.drawText(435, y+4,  80, 20, Qt::AlignLeft,  hop_forms[product->hops.at(i).h_form]);
+            painter.drawText(435, y+4,  80, 20, Qt::AlignLeft,  hop_forms[product->hops.at(i).form]);
             painter.drawText(520, y+4,  80, 20, Qt::AlignLeft,  use);
             painter.drawText(605, y+4,  60, 20, Qt::AlignRight, amount);
             painter.drawText(670, y+4,  60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
@@ -1638,9 +1638,9 @@
 		    checkLine(&painter, &y, QString(tr("Add brouwzouten")));
 		checkLine(&painter, &y, QString(tr("Add malts and dough-in")));
 		for (int j = 0; j < product->hops.size(); j++) {
-		    if (product->hops.at(j).h_useat == HOP_USEAT_MASH) {
-			checkLine(&painter, &y, QString(tr("Add %1 gram `%2` hop")).arg(product->hops.at(j).h_amount * 1000 * factor, 1, 'f', 1)
-			       .arg(product->hops.at(j).h_name));
+		    if (product->hops.at(j).useat == HOP_USEAT_MASH) {
+			checkLine(&painter, &y, QString(tr("Add %1 gram `%2` hop")).arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 1)
+			       .arg(product->hops.at(j).name));
 		    }
 		}
 		for (int j = 0; j < product->miscs.size(); j++) {
@@ -1708,9 +1708,9 @@
 	checkInput(&painter, &y, QString(tr("Target SG in boil kettle: ")) + strDensity(product->preboil_sg), QString(tr("SG")));
 	checkInput(&painter, &y, "", QString(tr("pH")));
 	for (int i = 0; i < product->hops.size(); i++) {
-	    if (product->hops.at(i).h_useat == HOP_USEAT_FWH) {
-		checkLine(&painter, &y, QString(tr("Add %1 gr `%2` hop after sparge")).arg(product->hops.at(i).h_amount * 1000 * factor, 1, 'f', 1)
-			.arg(product->hops.at(i).h_name));
+	    if (product->hops.at(i).useat == HOP_USEAT_FWH) {
+		checkLine(&painter, &y, QString(tr("Add %1 gr `%2` hop after sparge")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1)
+			.arg(product->hops.at(i).name));
 	    }
 	}
 
@@ -1729,7 +1729,7 @@
 		    lines++;
 	   }
 	   for (int i = 0; i < product->hops.size(); i++) {
-		if (product->hops.at(i).h_useat == HOP_USEAT_BOIL || product->hops.at(i).h_useat == HOP_USEAT_AROMA)
+		if (product->hops.at(i).useat == HOP_USEAT_BOIL || product->hops.at(i).useat == HOP_USEAT_AROMA)
 		    lines++;
 	   }
 	   for (int i = 0; i < product->miscs.size(); i++) {
@@ -1760,13 +1760,13 @@
 			checkLine(&painter, &y, QString(tr("Place emersion chiller at 10 minutes before end of boil")));
 		}
 		for (int j = 0; j < product->hops.size(); j++) {
-		    if ((product->hops.at(j).h_useat == HOP_USEAT_BOIL || product->hops.at(j).h_useat == HOP_USEAT_AROMA) && product->hops.at(j).h_time == i) {
+		    if ((product->hops.at(j).useat == HOP_USEAT_BOIL || product->hops.at(j).useat == HOP_USEAT_AROMA) && product->hops.at(j).time == i) {
 			if (i == 0)
-			    checkLine(&painter, &y, QString(tr("%1 gr `%2` at flameout")).arg(product->hops.at(j).h_amount * 1000 * factor, 1, 'f', 2)
-				.arg(product->hops.at(j).h_name));
+			    checkLine(&painter, &y, QString(tr("%1 gr `%2` at flameout")).arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 2)
+				.arg(product->hops.at(j).name));
 			else
 			    checkLine(&painter, &y, QString(tr("%1 gr `%2` at %3 minutes before end of boil"))
-				.arg(product->hops.at(j).h_amount * 1000 * factor, 1, 'f', 2).arg(product->hops.at(j).h_name).arg(i));
+				.arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 2).arg(product->hops.at(j).name).arg(i));
 		    }
 		}
 		for (int j = 0; j < product->miscs.size(); j++) {
@@ -1804,7 +1804,7 @@
 	if (product->brew_whirlpool2)
             lines++;
 	for (int i = 0; i < product->hops.size(); i++) {
-	    if (product->hops.at(i).h_useat == HOP_USEAT_WHIRLPOOL)
+	    if (product->hops.at(i).useat == HOP_USEAT_WHIRLPOOL)
 		lines++;
 	}
 	if ((y + (lines * 20)) > painter.device()->height()) {
@@ -1823,10 +1823,10 @@
 	    if (product->brew_whirlpool6 > 0)
                 checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 60 and 66°C")).arg(product->brew_whirlpool6, 1, 'f', 0));
 	    for (int i = 0; i < product->hops.size(); i++) {
-            	if (product->hops.at(i).h_useat == HOP_USEAT_WHIRLPOOL)
+            	if (product->hops.at(i).useat == HOP_USEAT_WHIRLPOOL)
 		    checkLine(&painter, &y, QString(tr("%1 gr `%2` for %3 minutes in the whirlpool"))
-			.arg(product->hops.at(i).h_amount * 1000 * factor, 1, 'f', 1).arg(product->hops.at(i).h_name)
-			.arg(product->hops.at(i).h_time));
+			.arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1).arg(product->hops.at(i).name)
+			.arg(product->hops.at(i).time));
 	    }
 	    checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1));
 	    if (product->brew_whirlpool2 > 0)
@@ -1979,7 +1979,7 @@
             if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING)
                 lines++;
 	for (int i = 0; i < product->hops.size(); i++)
-	    if (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP)
+	    if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP)
 		lines++;
         for (int i = 0; i < product->miscs.size(); i++)
             if (product->miscs.at(i).use_use == MISC_USES_SECONDARY)
@@ -2003,9 +2003,9 @@
                         .arg(product->fermentables.at(i).f_name));
             }
 	    for (int i = 0; i < product->hops.size(); i++) {
-		if (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP) {
-		    checkLine(&painter, &y, QString(tr("Add %1 gram `%2` for %3 days")).arg(product->hops.at(i).h_amount * 1000 * factor, 1, 'f', 1)
-			.arg(product->hops.at(i).h_name).arg(product->hops.at(i).h_time / 1440));
+		if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP) {
+		    checkLine(&painter, &y, QString(tr("Add %1 gram `%2` for %3 days")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1)
+			.arg(product->hops.at(i).name).arg(product->hops.at(i).time / 1440));
 		}
 	    }
 	    for (int i = 0; i < product->yeasts.size(); i++) {

mercurial