src/EditProductTab11.cpp

changeset 283
242a68fa7186
parent 238
047e99c90848
child 297
c8f0ecc8a1cc
--- a/src/EditProductTab11.cpp	Mon Jun 13 15:47:16 2022 +0200
+++ b/src/EditProductTab11.cpp	Mon Jun 13 16:47:52 2022 +0200
@@ -115,14 +115,14 @@
     found1 = false;
     if (product->bottle_amount) {
 	for (i = 0; i < product->fermentables.size(); i++) {
-	    if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE) {
+	    if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) {
 		found1 = true;
 		break;
 	    }
 	}
        	if (found1) {
-	    SFactor = 1 / ((product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100));
-	    qDebug() << "  bottle sugar" << product->fermentables.at(i).f_name << SFactor << TSec;
+	    SFactor = 1 / ((product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100));
+	    qDebug() << "  bottle sugar" << product->fermentables.at(i).name << SFactor << TSec;
 
 	    query.prepare("SELECT name,supplier FROM inventory_fermentables WHERE type = '1' OR type = '3' ORDER BY name");      // Sugars or dry extract
 	    query.exec();
@@ -130,7 +130,7 @@
 	    found2 = false;
 	    while (query.next()) {
 		j++;
-		if (query.value(0).toString() == product->fermentables.at(i).f_name && query.value(1).toString() == product->fermentables.at(i).f_supplier) {
+		if (query.value(0).toString() == product->fermentables.at(i).name && query.value(1).toString() == product->fermentables.at(i).supplier) {
 		    ui->bottle_sugarEdit->setCurrentIndex(j);
 		    product->bottle_priming_sugar = j;
 		    found2 = true;
@@ -145,10 +145,10 @@
 		product->bottle_priming_amount = CarbCO2toS(product->bottle_carbonation, TSec, SFactor);
 		ui->bottle_sug_amountShow->setValue(product->bottle_priming_amount);
 		double total = round(product->bottle_priming_amount * product->bottle_amount * 100.0) / 100000.0;
-		qDebug() << "  total" << total << product->fermentables.at(i).f_amount;
-		if (total != product->fermentables.at(i).f_amount) {
+		qDebug() << "  total" << total << product->fermentables.at(i).amount;
+		if (total != product->fermentables.at(i).amount) {
 		    qDebug() << "  update priming sugar" << total;
-		    product->fermentables[i].f_amount = total;
+		    product->fermentables[i].amount = total;
 		    refreshFermentables();
 		    is_changed();
 		}
@@ -196,14 +196,14 @@
 
 	if (! product->keg_forced_carb) {
 	    for (i = 0; i < product->fermentables.size(); i++) {
-            	if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) {
+            	if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) {
                     found1 = true;
                     break;
             	}
             }
             if (found1) {
-            	SFactor = 1 / ((product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100));
-            	qDebug() << "  kegs sugar" << product->fermentables.at(i).f_name << SFactor << TSec;
+            	SFactor = 1 / ((product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100));
+            	qDebug() << "  kegs sugar" << product->fermentables.at(i).name << SFactor << TSec;
 
             	query.prepare("SELECT name,supplier FROM inventory_fermentables WHERE type = '1' OR type = '3' ORDER BY name");      // Sugars or dry extract
             	query.exec();
@@ -211,7 +211,7 @@
             	found2 = false;
             	while (query.next()) {
                     j++;
-                    if (query.value(0).toString() == product->fermentables.at(i).f_name && query.value(1).toString() == product->fermentables.at(i).f_supplier) {
+                    if (query.value(0).toString() == product->fermentables.at(i).name && query.value(1).toString() == product->fermentables.at(i).supplier) {
                     	ui->keg_sugarEdit->setCurrentIndex(j);
                     	product->keg_priming_sugar = j;
                     	found2 = true;
@@ -226,10 +226,10 @@
                     product->keg_priming_amount = CarbCO2toS(product->keg_carbonation, TSec, SFactor);
                     ui->keg_sug_amountShow->setValue(product->keg_priming_amount);
                     double total = round(product->keg_priming_amount * product->keg_amount * 100.0) / 100000.0;
-                    qDebug() << "  total" << total << product->fermentables.at(i).f_amount;
-                    if (total != product->fermentables.at(i).f_amount) {
+                    qDebug() << "  total" << total << product->fermentables.at(i).amount;
+                    if (total != product->fermentables.at(i).amount) {
                     	qDebug() << "  update priming sugar" << total;
-                    	product->fermentables[i].f_amount = total;
+                    	product->fermentables[i].amount = total;
                     	refreshFermentables();
                     	is_changed();
                     }
@@ -385,7 +385,7 @@
 
     qDebug() << "bottle_sugar_changed" << product->bottle_priming_sugar << val;
     for (int i = 0; i < product->fermentables.size(); i++) {
-	if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE) {
+	if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) {
 	    product->fermentables.removeAt(i);
 	    refreshFermentables();
 	    break;
@@ -405,27 +405,27 @@
         query.next();
     }
 
-    newf.f_name = query.value(0).toString();
-    newf.f_origin = query.value(1).toString();
-    newf.f_supplier = query.value(2).toString();
-    newf.f_cost = query.value(3).toDouble();
-    newf.f_type = query.value(4).toInt();
-    newf.f_yield = query.value(5).toDouble();
-    newf.f_color = query.value(6).toDouble();
-    newf.f_coarse_fine_diff = query.value(7).toDouble();
-    newf.f_moisture = query.value(8).toDouble();
-    newf.f_diastatic_power = query.value(9).toDouble();
-    newf.f_protein = query.value(10).toDouble();
-    newf.f_dissolved_protein = query.value(11).toDouble();
-    newf.f_max_in_batch = query.value(12).toDouble();
-    newf.f_graintype = query.value(13).toInt();
-    newf.f_recommend_mash = query.value(14).toInt() ? true:false;
-    newf.f_add_after_boil = true;
-    newf.f_di_ph = query.value(16).toDouble();
-    newf.f_acid_to_ph_57 = query.value(17).toDouble();
-    newf.f_inventory = query.value(18).toDouble();
-    newf.f_amount = 0;
-    newf.f_added = FERMENTABLE_ADDED_BOTTLE;
+    newf.name = query.value(0).toString();
+    newf.origin = query.value(1).toString();
+    newf.supplier = query.value(2).toString();
+    newf.cost = query.value(3).toDouble();
+    newf.type = query.value(4).toInt();
+    newf.yield = query.value(5).toDouble();
+    newf.color = query.value(6).toDouble();
+    newf.coarse_fine_diff = query.value(7).toDouble();
+    newf.moisture = query.value(8).toDouble();
+    newf.diastatic_power = query.value(9).toDouble();
+    newf.protein = query.value(10).toDouble();
+    newf.dissolved_protein = query.value(11).toDouble();
+    newf.max_in_batch = query.value(12).toDouble();
+    newf.graintype = query.value(13).toInt();
+    newf.recommend_mash = query.value(14).toInt() ? true:false;
+    newf.add_after_boil = true;
+    newf.di_ph = query.value(16).toDouble();
+    newf.acid_to_ph_57 = query.value(17).toDouble();
+    newf.inventory = query.value(18).toDouble();
+    newf.amount = 0;
+    newf.added = FERMENTABLE_ADDED_BOTTLE;
 
     product->fermentables.append(newf);
     refreshFermentables();
@@ -483,7 +483,7 @@
 
     qDebug() << "kegs_sugar_changed" << product->keg_priming_sugar << val;
     for (int i = 0; i < product->fermentables.size(); i++) {
-        if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) {
+        if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) {
             product->fermentables.removeAt(i);
             refreshFermentables();
             break;
@@ -503,27 +503,27 @@
         query.next();
     }
 
-    newf.f_name = query.value(0).toString();
-    newf.f_origin = query.value(1).toString();
-    newf.f_supplier = query.value(2).toString();
-    newf.f_cost = query.value(3).toDouble();
-    newf.f_type = query.value(4).toInt();
-    newf.f_yield = query.value(5).toDouble();
-    newf.f_color = query.value(6).toDouble();
-    newf.f_coarse_fine_diff = query.value(7).toDouble();
-    newf.f_moisture = query.value(8).toDouble();
-    newf.f_diastatic_power = query.value(9).toDouble();
-    newf.f_protein = query.value(10).toDouble();
-    newf.f_dissolved_protein = query.value(11).toDouble();
-    newf.f_max_in_batch = query.value(12).toDouble();
-    newf.f_graintype = query.value(13).toInt();
-    newf.f_recommend_mash = query.value(14).toInt() ? true:false;
-    newf.f_add_after_boil = true;
-    newf.f_di_ph = query.value(16).toDouble();
-    newf.f_acid_to_ph_57 = query.value(17).toDouble();
-    newf.f_inventory = query.value(18).toDouble();
-    newf.f_amount = 0;
-    newf.f_added = FERMENTABLE_ADDED_KEGS;
+    newf.name = query.value(0).toString();
+    newf.origin = query.value(1).toString();
+    newf.supplier = query.value(2).toString();
+    newf.cost = query.value(3).toDouble();
+    newf.type = query.value(4).toInt();
+    newf.yield = query.value(5).toDouble();
+    newf.color = query.value(6).toDouble();
+    newf.coarse_fine_diff = query.value(7).toDouble();
+    newf.moisture = query.value(8).toDouble();
+    newf.diastatic_power = query.value(9).toDouble();
+    newf.protein = query.value(10).toDouble();
+    newf.dissolved_protein = query.value(11).toDouble();
+    newf.max_in_batch = query.value(12).toDouble();
+    newf.graintype = query.value(13).toInt();
+    newf.recommend_mash = query.value(14).toInt() ? true:false;
+    newf.add_after_boil = true;
+    newf.di_ph = query.value(16).toDouble();
+    newf.acid_to_ph_57 = query.value(17).toDouble();
+    newf.inventory = query.value(18).toDouble();
+    newf.amount = 0;
+    newf.added = FERMENTABLE_ADDED_KEGS;
 
     product->fermentables.append(newf);
     refreshFermentables();
@@ -551,7 +551,7 @@
 	 * Make sure to remove priming sugars.
 	 */
 	for (int i = 0; i < product->fermentables.size(); i++) {
-	    if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) {
+	    if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) {
 		product->fermentables.removeAt(i);
 		refreshFermentables();
 		break;

mercurial