src/EditProductTab3.cpp

changeset 454
2dfead81c72f
parent 449
00757c056ca6
child 458
ac216a75ca9b
--- a/src/EditProductTab3.cpp	Tue Jan 10 16:56:21 2023 +0100
+++ b/src/EditProductTab3.cpp	Thu Jan 12 14:34:14 2023 +0100
@@ -68,7 +68,6 @@
     QHBoxLayout* pLayout;
     QTableWidgetItem *item;
 
-    qDebug() << "refreshFermentables" << product->fermentables.size();
     std::sort(product->fermentables.begin(), product->fermentables.end(), ferment_sort_test);
 
     const QStringList labels({tr("Supplier"), tr("Fermentable"), tr("EBC"), tr("Type"), tr("Graintype"), tr("When"), tr("Yield"),
@@ -345,11 +344,13 @@
 	    product->fermentables_ok = false;
 	}
     }
-//    qDebug() << "  adjust to 100" << product->fermentables_use100;
-//    qDebug() << "  supplies" << product->fermentables_ok;
-//    qDebug() << "  colort" << colort << "colorh" << colorh << "colorn" << colorn;
-//    qDebug() << "  psugar" << psugar << "pcara" << pcara << "mvol" << mvol;
-//    qDebug() << "  sugarsf" << sugarsf << "sugarsm" << sugarsm;
+#ifdef DEBUG_FERMENTABLES
+    qDebug() << "  adjust to 100" << product->fermentables_use100;
+    qDebug() << "  supplies" << product->fermentables_ok;
+    qDebug() << "  colort" << colort << "colorh" << colorh << "colorn" << colorn;
+    qDebug() << "  psugar" << psugar << "pcara" << pcara << "mvol" << mvol;
+    qDebug() << "  sugarsf" << sugarsf << "sugarsm" << sugarsm;
+#endif
 
     double v = s / sugardensity + mvol;
     s = 1000 * s / (v * 10); //deg. Plato
@@ -358,7 +359,9 @@
 
     /* Estimate total recipe OG */
     product->est_og = Utils::estimate_sg(sugarsf + addedS, product->batch_size);
-//    qDebug() << "  OG" << ui->est_ogEdit->value() << product->est_og;
+#ifdef DEBUG_FERMENTABLES
+    qDebug() << "  OG" << ui->est_ogEdit->value() << product->est_og;
+#endif
     if (product->stage > PROD_STAGE_BREW) {
 	ui->est_ogLabel->setText(tr("Final OG:"));
 	ui->est_ogEdit->setValue(product->og);
@@ -377,7 +380,9 @@
     /* Estimate SG in kettle before boil */
     product->preboil_sg = Utils::estimate_sg(sugarsm, product->boil_size);
     ui->brew_preboilsgShow->setValue(product->preboil_sg);
-//    qDebug() << "  preboil SG" << product->preboil_sg;
+#ifdef DEBUG_FERMENTABLES
+    qDebug() << "  preboil SG" << product->preboil_sg;
+#endif
 
     /*
      * Recalculate volumes
@@ -453,9 +458,13 @@
     } else {
 	cw = colort / product->batch_size * 8.34436;
 	color = Utils::kw_to_ebc(product->color_method, cw);
-	//qDebug() << "  oud EBC" << color << "new EBC" << Utils::kw_to_newebc(product->color_method, cw) << "SRM" << Utils::kw_to_srm(product->color_method, cw);
+#ifdef DEBUG_FERMENTABLES
+	qDebug() << "  oud EBC" << color << "new EBC" << Utils::kw_to_newebc(product->color_method, cw) << "SRM" << Utils::kw_to_srm(product->color_method, cw);
+#endif
     }
-    //qDebug() << "  color" << ui->est_colorEdit->value() << color << product->est_color;
+#ifdef DEBUG_FERMENTABLES
+    qDebug() << "  color" << ui->est_colorEdit->value() << color << product->est_color;
+#endif
     product->est_color = color;
     ui->est_color2Edit->setValue(color);
     ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(color));
@@ -479,10 +488,14 @@
     ui->perc_sugarsShow->setValue(round(psugar));
     ui->perc_caraShow->setValue(round(pcara));
     if (product->mashs_kg > 0) {
-//	qDebug() << "  lintner" << lintner << "  mashkg" << product->mashs_kg << "final" << round(lintner / product->mashs_kg);
+#ifdef DEBUG_FERMENTABLES
+	qDebug() << "  lintner" << lintner << "  mashkg" << product->mashs_kg << "final" << round(lintner / product->mashs_kg);
+#endif
 	ui->lintnerShow->setValue(round(lintner / product->mashs_kg));
     } else {
-//	qDebug() << "  lintner N/A";
+#ifdef DEBUG_FERMENTABLES
+	qDebug() << "  lintner N/A";
+#endif
 	ui->lintnerShow->setValue(0);
     }
 
@@ -514,7 +527,9 @@
 		product->yeasts_ok = false;
 	    }
 	}
-//	qDebug() << "  est SVG" << svg;
+#ifdef DEBUG_FERMENTABLES
+	qDebug() << "  est SVG" << svg;
+#endif
     }
     if (svg == 0)
 	svg = 77.0;
@@ -526,7 +541,9 @@
 	product->est_fg = Utils::estimate_fg(psugar, pcara, 0, 0, 0, svg, product->est_og, sta1);
     qDebug() << "  est FG" << ui->est_fgEdit->value() << product->est_fg;
     product->est_abv = Utils::abvol(product->est_og, product->est_fg);
-//    qDebug() << "  est ABV" << ui->est_abvEdit->value() << product->est_abv;
+#ifdef DEBUG_FERMENTABLES
+    qDebug() << "  est ABV" << ui->est_abvEdit->value() << product->est_abv;
+#endif
 
     if (product->stage > PROD_STAGE_TERTIARY) {
 	ui->est_fgLabel->setText(tr("Final FG:"));
@@ -791,7 +808,9 @@
     double oldperc = product->fermentables.at(product->fermentables_row).percentage;
     double diffp = val - oldperc;
     double diffw = (diffp / 100) * total;
+#ifdef DEBUG_FERMENTABLES
     qDebug() << "row100" << row100 << "total" << total << "diff kg" << diffw << "diff %" << diffp;
+#endif
 
     product->fermentables[product->fermentables_row].percentage += diffp;
     product->fermentables[product->fermentables_row].amount += diffw;

mercurial