# HG changeset patch # User Michiel Broek # Date 1655131672 -7200 # Node ID 242a68fa7186b1fee0ad36cee8772f7ce4880d90 # Parent d1d208a857b0fca093c45cdbd74f02b29b1fcc97 Member names for fermentables normalized. diff -r d1d208a857b0 -r 242a68fa7186 src/EditProductExport.cpp --- a/src/EditProductExport.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditProductExport.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -140,29 +140,29 @@ xmlWriter->writeStartElement("FERMENTABLES"); 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) { xmlWriter->writeStartElement("FERMENTABLE"); xmlWriter->writeTextElement("VERSION", "1"); - xmlWriter->writeTextElement("NAME", product->fermentables.at(i).f_name); - xmlWriter->writeTextElement("TYPE", fermentable_type[product->fermentables.at(i).f_type]); - xmlWriter->writeTextElement("AMOUNT", QString::number(product->fermentables.at(i).f_amount, 'f', 4)); - xmlWriter->writeTextElement("YIELD", QString::number(product->fermentables.at(i).f_yield, 'f', 1)); - xmlWriter->writeTextElement("COLOR", QString::number(Utils::ebc_to_srm(product->fermentables.at(i).f_color), 'f', 1)); - xmlWriter->writeTextElement("ADD_AFTER_BOIL", product->fermentables.at(i).f_add_after_boil ? "TRUE":"FALSE"); - xmlWriter->writeTextElement("ORIGIN", product->fermentables.at(i).f_origin); - xmlWriter->writeTextElement("SUPPLIER", product->fermentables.at(i).f_supplier); - if (product->fermentables.at(i).f_coarse_fine_diff) - xmlWriter->writeTextElement("COARSE_FINE_DIFF", QString::number(product->fermentables.at(i).f_coarse_fine_diff, 'f', 4)); - if (product->fermentables.at(i).f_moisture) - xmlWriter->writeTextElement("MOISTURE", QString::number(product->fermentables.at(i).f_moisture, 'f', 4)); - if (product->fermentables.at(i).f_diastatic_power) - xmlWriter->writeTextElement("DIASTATIC_POWER", QString::number(product->fermentables.at(i).f_diastatic_power, 'f', 4)); - if (product->fermentables.at(i).f_protein) - xmlWriter->writeTextElement("PROTEIN", QString::number(product->fermentables.at(i).f_protein, 'f', 4)); - if (product->fermentables.at(i).f_max_in_batch) - xmlWriter->writeTextElement("MAX_IN_BATCH", QString::number(product->fermentables.at(i).f_max_in_batch, 'f', 1)); - xmlWriter->writeTextElement("RECOMMEND_MASH", product->fermentables.at(i).f_recommend_mash ? "TRUE":"FALSE"); - xmlWriter->writeTextElement("GRAINTYPE", fermentable_graintype[product->fermentables.at(i).f_graintype]); + xmlWriter->writeTextElement("NAME", product->fermentables.at(i).name); + xmlWriter->writeTextElement("TYPE", fermentable_type[product->fermentables.at(i).type]); + xmlWriter->writeTextElement("AMOUNT", QString::number(product->fermentables.at(i).amount, 'f', 4)); + xmlWriter->writeTextElement("YIELD", QString::number(product->fermentables.at(i).yield, 'f', 1)); + xmlWriter->writeTextElement("COLOR", QString::number(Utils::ebc_to_srm(product->fermentables.at(i).color), 'f', 1)); + xmlWriter->writeTextElement("ADD_AFTER_BOIL", product->fermentables.at(i).add_after_boil ? "TRUE":"FALSE"); + xmlWriter->writeTextElement("ORIGIN", product->fermentables.at(i).origin); + xmlWriter->writeTextElement("SUPPLIER", product->fermentables.at(i).supplier); + if (product->fermentables.at(i).coarse_fine_diff) + xmlWriter->writeTextElement("COARSE_FINE_DIFF", QString::number(product->fermentables.at(i).coarse_fine_diff, 'f', 4)); + if (product->fermentables.at(i).moisture) + xmlWriter->writeTextElement("MOISTURE", QString::number(product->fermentables.at(i).moisture, 'f', 4)); + if (product->fermentables.at(i).diastatic_power) + xmlWriter->writeTextElement("DIASTATIC_POWER", QString::number(product->fermentables.at(i).diastatic_power, 'f', 4)); + if (product->fermentables.at(i).protein) + xmlWriter->writeTextElement("PROTEIN", QString::number(product->fermentables.at(i).protein, 'f', 4)); + if (product->fermentables.at(i).max_in_batch) + xmlWriter->writeTextElement("MAX_IN_BATCH", QString::number(product->fermentables.at(i).max_in_batch, 'f', 1)); + xmlWriter->writeTextElement("RECOMMEND_MASH", product->fermentables.at(i).recommend_mash ? "TRUE":"FALSE"); + xmlWriter->writeTextElement("GRAINTYPE", fermentable_graintype[product->fermentables.at(i).graintype]); xmlWriter->writeEndElement(); } } @@ -459,11 +459,11 @@ memo.append("[tabular]\n"); memo.append("[head]Mout, granen en suikers[/head][head]EBC[/head][head]Gewicht kg[/head][head]%[/head][head]Gebruik tijdens[/head]\n"); for (int i = 0; i < product->fermentables.size(); i++) { - memo.append("[row][data]" + product->fermentables.at(i).f_name + " (" + product->fermentables.at(i).f_supplier + ")[/data]"); - memo.append("[data]" + QString::number(product->fermentables.at(i).f_color) + "[/data]"); - memo.append("[data]" + QString::number(product->fermentables.at(i).f_amount, 'f', 3) + "[/data]"); - memo.append("[data]" + QString::number(product->fermentables.at(i).f_percentage, 'f', 1) + "[/data]"); - memo.append("[data]" + fermentable_added[product->fermentables.at(i).f_added] + "[/data][/row]\n"); + memo.append("[row][data]" + product->fermentables.at(i).name + " (" + product->fermentables.at(i).supplier + ")[/data]"); + memo.append("[data]" + QString::number(product->fermentables.at(i).color) + "[/data]"); + memo.append("[data]" + QString::number(product->fermentables.at(i).amount, 'f', 3) + "[/data]"); + memo.append("[data]" + QString::number(product->fermentables.at(i).percentage, 'f', 1) + "[/data]"); + memo.append("[data]" + fermentable_added[product->fermentables.at(i).added] + "[/data][/row]\n"); } memo.append("[/tabular]\n\n"); @@ -926,7 +926,7 @@ sp->prop_volume[2] = sp->prop_volume[2] * factor; sp->prop_volume[3] = sp->prop_volume[3] * factor; for (int j = 0; j < sp->fermentables.size(); j++) { - sp->fermentables[j].f_amount = round(sp->fermentables.at(j).f_amount * factor * 100000) / 100000; + sp->fermentables[j].amount = round(sp->fermentables.at(j).amount * factor * 100000) / 100000; } for (int j = 0; j < sp->hops.size(); j++) { sp->hops[j].amount = round(sp->hops.at(j).amount * factor * 100000) / 100000; @@ -983,7 +983,7 @@ sp->prop_volume[2] = sp->prop_volume[2] * factor; sp->prop_volume[3] = sp->prop_volume[3] * factor; for (int j = 0; j < sp->fermentables.size(); j++) { - sp->fermentables[j].f_amount = round(sp->fermentables.at(j).f_amount * factor * 100000) / 100000; + sp->fermentables[j].amount = round(sp->fermentables.at(j).amount * factor * 100000) / 100000; } for (int j = 0; j < sp->hops.size(); j++) { sp->hops[j].amount = round(sp->hops.at(j).amount * factor * 100000) / 100000; diff -r d1d208a857b0 -r 242a68fa7186 src/EditProductTab11.cpp --- 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; diff -r d1d208a857b0 -r 242a68fa7186 src/EditProductTab3.cpp --- a/src/EditProductTab3.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditProductTab3.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -21,17 +21,17 @@ bool EditProduct::ferment_sort_test(const Fermentables &D1, const Fermentables &D2) { - if (D1.f_added > D2.f_added) + if (D1.added > D2.added) return false; - if (D1.f_added < D2.f_added) + if (D1.added < D2.added) return true; - return (D1.f_amount >= D2.f_amount) && (D1.f_color < D2.f_color); + return (D1.amount >= D2.amount) && (D1.color < D2.color); } void EditProduct::to100Fermentables(int row) { - if (product->fermentables.at(row).f_adjust_to_total_100) { + if (product->fermentables.at(row).adjust_to_total_100) { QWidget *pWidget = new QWidget(); QLabel *label = new QLabel; label->setPixmap(QPixmap(":icons/silk/tick.png")); @@ -79,42 +79,42 @@ for (int i = 0; i < product->fermentables.size(); i++) { - ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(product->fermentables.at(i).f_supplier)); - ui->fermentablesTable->setItem(i, 1, new QTableWidgetItem(product->fermentables.at(i).f_name)); + ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(product->fermentables.at(i).supplier)); + ui->fermentablesTable->setItem(i, 1, new QTableWidgetItem(product->fermentables.at(i).name)); - w = QString("%1").arg(product->fermentables.at(i).f_color, 1, 'f', 0, '0'); + w = QString("%1").arg(product->fermentables.at(i).color, 1, 'f', 0, '0'); item = new QTableWidgetItem(w); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 2, item); - item = new QTableWidgetItem(fermentable_types[product->fermentables.at(i).f_type]); + item = new QTableWidgetItem(fermentable_types[product->fermentables.at(i).type]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 3, item); - item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(i).f_graintype]); + item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(i).graintype]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 4, item); - item = new QTableWidgetItem(fermentable_added[product->fermentables.at(i).f_added]); + item = new QTableWidgetItem(fermentable_added[product->fermentables.at(i).added]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 5, item); - item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).f_yield, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).yield, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 6, item); - item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).f_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).amount, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 7, item); - item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).f_inventory, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).inventory, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); - if (product->fermentables.at(i).f_inventory < product->fermentables.at(i).f_amount) + if (product->fermentables.at(i).inventory < product->fermentables.at(i).amount) item->setForeground(QBrush(QColor(Qt::red))); ui->fermentablesTable->setItem(i, 8, item); - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { - item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).f_percentage, 2, 'f', 1, '0')); + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { + item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).percentage, 2, 'f', 1, '0')); } else { item = new QTableWidgetItem(QString("")); // Blank for bottling and kegging. } @@ -124,7 +124,7 @@ to100Fermentables(i); /* Add the Delete row button */ - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { pWidget = new QWidget(); QPushButton* btn_dele = new QPushButton(); btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ @@ -243,45 +243,45 @@ product->fermentables_ok = true; product->mashs_kg = 0; for (i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_type == FERMENTABLE_TYPE_SUGAR && product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) - psugar += product->fermentables.at(i).f_percentage; - if (product->fermentables.at(i).f_graintype == FERMENTABLE_GRAINTYPE_CRYSTAL && product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) - pcara += product->fermentables.at(i).f_percentage; - d = product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { + if (product->fermentables.at(i).type == FERMENTABLE_TYPE_SUGAR && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) + psugar += product->fermentables.at(i).percentage; + if (product->fermentables.at(i).graintype == FERMENTABLE_GRAINTYPE_CRYSTAL && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) + pcara += product->fermentables.at(i).percentage; + d = product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { if (mvol > 0) { // If mash volume is known - mvol += product->fermentables.at(i).f_amount * product->fermentables.at(i).f_moisture / 100; + mvol += product->fermentables.at(i).amount * product->fermentables.at(i).moisture / 100; s += d; } d = product->efficiency / 100 * d; sugarsm += d; - product->mashs_kg += product->fermentables.at(i).f_amount; + product->mashs_kg += product->fermentables.at(i).amount; } - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH || product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOIL) + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH || product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) sugarsf += d; - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION || product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING) { - x = (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); - addedS += product->fermentables.at(i).f_amount * x; - addedmass += product->fermentables.at(i).f_amount; - vol += (x * sugardensity + (1 - x) * 1) * product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION || product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) { + x = (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); + addedS += product->fermentables.at(i).amount * x; + addedmass += product->fermentables.at(i).amount; + vol += (x * sugardensity + (1 - x) * 1) * product->fermentables.at(i).amount; } - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH && - (product->fermentables.at(i).f_type == FERMENTABLE_TYPE_GRAIN || product->fermentables.at(i).f_type == FERMENTABLE_TYPE_ADJUCT) && - product->fermentables.at(i).f_color < 50) { - lintner += product->fermentables.at(i).f_diastatic_power * product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH && + (product->fermentables.at(i).type == FERMENTABLE_TYPE_GRAIN || product->fermentables.at(i).type == FERMENTABLE_TYPE_ADJUCT) && + product->fermentables.at(i).color < 50) { + lintner += product->fermentables.at(i).diastatic_power * product->fermentables.at(i).amount; } - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { - colort += product->fermentables.at(i).f_amount * Utils::ebc_to_srm(product->fermentables.at(i).f_color); - colorh += product->fermentables.at(i).f_amount * product->fermentables.at(i).f_color * Utils::get_kt(product->fermentables.at(i).f_color); - colorn += (product->fermentables.at(i).f_percentage / 100) * product->fermentables.at(i).f_color; // For 8.6 Pt wort. + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { + colort += product->fermentables.at(i).amount * Utils::ebc_to_srm(product->fermentables.at(i).color); + colorh += product->fermentables.at(i).amount * product->fermentables.at(i).color * Utils::get_kt(product->fermentables.at(i).color); + colorn += (product->fermentables.at(i).percentage / 100) * product->fermentables.at(i).color; // For 8.6 Pt wort. } /* Check supplies */ - if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->fermentables.at(i).f_added <= FERMENTABLE_ADDED_BOIL)) || - ((product->inventory_reduced <= PROD_STAGE_PRIMARY) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION)) || - ((product->inventory_reduced <= PROD_STAGE_TERTIARY) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING)) || - ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE)) || - ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS))) && - product->fermentables.at(i).f_inventory < product->fermentables.at(i).f_amount) { + if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->fermentables.at(i).added <= FERMENTABLE_ADDED_BOIL)) || + ((product->inventory_reduced <= PROD_STAGE_PRIMARY) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION)) || + ((product->inventory_reduced <= PROD_STAGE_TERTIARY) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING)) || + ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE)) || + ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS))) && + product->fermentables.at(i).inventory < product->fermentables.at(i).amount) { product->fermentables_ok = false; } } @@ -454,10 +454,10 @@ // Bottle priming double priming_total = 0; for (i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE) { - priming_total += ((product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100)) * - product->fermentables.at(i).f_amount; - qDebug() << " priming" << product->fermentables.at(i).f_amount << "total" << priming_total; + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) { + priming_total += ((product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100)) * + product->fermentables.at(i).amount; + qDebug() << " priming" << product->fermentables.at(i).amount << "total" << priming_total; } } double grl = priming_total * 1000.0 * (1 / product->batch_size); @@ -484,11 +484,11 @@ double sug = Utils::sg_to_plato(og) * product->batch_size * og / 100.0; // total amount of sugars in kg. for (i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { - d = product->fermentables.at(i).f_percentage / 100.0 * - (product->fermentables.at(i).f_yield / 100.0) * - (1 - product->fermentables.at(i).f_moisture / 100.0); - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { + d = product->fermentables.at(i).percentage / 100.0 * + (product->fermentables.at(i).yield / 100.0) * + (1 - product->fermentables.at(i).moisture / 100.0); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) d = efficiency / 100.0 * d; tot += d; } @@ -498,8 +498,8 @@ if (totmass) { for (i = 0; i < product->fermentables.size(); i++) { - amount = round(product->fermentables.at(i).f_percentage * 10.0 * totmass) / 1000.0; - product->fermentables[i].f_amount = amount; + amount = round(product->fermentables.at(i).percentage * 10.0 * totmass) / 1000.0; + product->fermentables[i].amount = amount; } } } @@ -578,32 +578,32 @@ qDebug() << "Add fermentable row"; for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_amount == 0 && product->fermentables.at(i).f_color == 0) + if (product->fermentables.at(i).amount == 0 && product->fermentables.at(i).color == 0) return; // Add only one at a time. } - newf.f_name = "Select one"; - newf.f_origin = ""; - newf.f_supplier = ""; - newf.f_amount = 0; - newf.f_cost = 0; - newf.f_type = FERMENTABLE_TYPE_GRAIN; - newf.f_yield = 0; - newf.f_color = 0; - newf.f_coarse_fine_diff = 0; - newf.f_moisture = 0; - newf.f_diastatic_power = 0; - newf.f_protein = 0; - newf.f_dissolved_protein = 0; - newf.f_max_in_batch = 100; - newf.f_graintype = FERMENTABLE_GRAINTYPE_BASE; - newf.f_added = FERMENTABLE_ADDED_MASH; - newf.f_recommend_mash = true; - newf.f_add_after_boil = false; - newf.f_adjust_to_total_100 = false; - newf.f_percentage = 0; - newf.f_di_ph = 0; - newf.f_acid_to_ph_57 = 0; + newf.name = "Select one"; + newf.origin = ""; + newf.supplier = ""; + newf.amount = 0; + newf.cost = 0; + newf.type = FERMENTABLE_TYPE_GRAIN; + newf.yield = 0; + newf.color = 0; + newf.coarse_fine_diff = 0; + newf.moisture = 0; + newf.diastatic_power = 0; + newf.protein = 0; + newf.dissolved_protein = 0; + newf.max_in_batch = 100; + newf.graintype = FERMENTABLE_GRAINTYPE_BASE; + newf.added = FERMENTABLE_ADDED_MASH; + newf.recommend_mash = true; + newf.add_after_boil = false; + newf.adjust_to_total_100 = false; + newf.percentage = 0; + newf.di_ph = 0; + newf.acid_to_ph_57 = 0; product->fermentables.append(newf); emit refreshAll(); @@ -622,7 +622,7 @@ if (product->fermentables.size() < 1) return; - int rc = QMessageBox::warning(this, tr("Delete fermentable"), tr("Delete %1").arg(product->fermentables.at(row).f_name), + int rc = QMessageBox::warning(this, tr("Delete fermentable"), tr("Delete %1").arg(product->fermentables.at(row).name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (rc == QMessageBox::No) return; @@ -634,11 +634,11 @@ */ double total = 0; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging - total += product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging + total += product->fermentables.at(i).amount; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) - product->fermentables[i].f_percentage = product->fermentables.at(i).f_amount / total * 100; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) + product->fermentables[i].percentage = product->fermentables.at(i).amount / total * 100; is_changed(); emit refreshAll(); @@ -650,26 +650,26 @@ QTableWidgetItem *item; double total = 0, perc; - if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE) + if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE) return; qDebug() << "ferment_amount_changed()" << product->fermentables_row << val; - product->fermentables[product->fermentables_row].f_amount = val; + product->fermentables[product->fermentables_row].amount = val; item = new QTableWidgetItem(QString("%1 Kg").arg(val, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 7, item); for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging - total += product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging + total += product->fermentables.at(i).amount; /* * Recalculate the percentages */ for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { - perc = product->fermentables.at(i).f_amount / total * 100; - product->fermentables[i].f_percentage = perc; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { + perc = product->fermentables.at(i).amount / total * 100; + product->fermentables[i].percentage = perc; item = new QTableWidgetItem(QString("%1%").arg(perc, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 8, item); @@ -695,35 +695,35 @@ * this is not the entry to be adjusted to 100. */ for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging - total += product->fermentables.at(i).f_amount; - if (product->fermentables.at(i).f_adjust_to_total_100) + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging + total += product->fermentables.at(i).amount; + if (product->fermentables.at(i).adjust_to_total_100) row100 = i; } - double oldperc = product->fermentables.at(product->fermentables_row).f_percentage; + double oldperc = product->fermentables.at(product->fermentables_row).percentage; double diffp = val - oldperc; double diffw = (diffp / 100) * total; qDebug() << "row100" << row100 << "total" << total << "diff kg" << diffw << "diff %" << diffp; - product->fermentables[product->fermentables_row].f_percentage += diffp; - product->fermentables[product->fermentables_row].f_amount += diffw; - product->fermentables[row100].f_percentage -= diffp; - product->fermentables[row100].f_amount -= diffw; + product->fermentables[product->fermentables_row].percentage += diffp; + product->fermentables[product->fermentables_row].amount += diffw; + product->fermentables[row100].percentage -= diffp; + product->fermentables[row100].amount -= diffw; - item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[product->fermentables_row].f_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[product->fermentables_row].amount, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 7, item); - this->famountEdit->setValue(product->fermentables[product->fermentables_row].f_amount); + this->famountEdit->setValue(product->fermentables[product->fermentables_row].amount); - item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[product->fermentables_row].f_percentage, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[product->fermentables_row].percentage, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 8, item); - item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[row100].f_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[row100].amount, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(row100, 7, item); - item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[row100].f_percentage, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[row100].percentage, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(row100, 8, item); @@ -735,9 +735,9 @@ { qDebug() << "ferment_to100_changed()" << product->fermentables_row << val << product->fermentables_use100; - if (product->fermentables.at(product->fermentables_row).f_added >= FERMENTABLE_ADDED_BOTTLE) { + if (product->fermentables.at(product->fermentables_row).added >= FERMENTABLE_ADDED_BOTTLE) { const QSignalBlocker blocker1(to100Edit); - product->fermentables[product->fermentables_row].f_adjust_to_total_100 = false; + product->fermentables[product->fermentables_row].adjust_to_total_100 = false; to100Edit->setChecked(false); return; } @@ -751,21 +751,21 @@ if (! product->fermentables_use100 && val) { /* Scenario 1. */ product->fermentables_use100 = true; - product->fermentables[product->fermentables_row].f_adjust_to_total_100 = true; + product->fermentables[product->fermentables_row].adjust_to_total_100 = true; pctEdit->setReadOnly(false); famountEdit->setReadOnly(true); - } else if (product->fermentables_use100 && product->fermentables[product->fermentables_row].f_adjust_to_total_100 && ! val) { + } else if (product->fermentables_use100 && product->fermentables[product->fermentables_row].adjust_to_total_100 && ! val) { /* Scenario 2. */ - product->fermentables[product->fermentables_row].f_adjust_to_total_100 = false; + product->fermentables[product->fermentables_row].adjust_to_total_100 = false; product->fermentables_use100 = false; pctEdit->setReadOnly(true); famountEdit->setReadOnly(false); - } else if (product->fermentables_use100 && ! product->fermentables[product->fermentables_row].f_adjust_to_total_100 && val) { + } else if (product->fermentables_use100 && ! product->fermentables[product->fermentables_row].adjust_to_total_100 && val) { /* Scenario 3. */ for (int i = 0; i < product->fermentables.size(); i++) { - product->fermentables[i].f_adjust_to_total_100 = false; + product->fermentables[i].adjust_to_total_100 = false; } - product->fermentables[product->fermentables_row].f_adjust_to_total_100 = true; + product->fermentables[product->fermentables_row].adjust_to_total_100 = true; } else { qDebug() << "bug"; return; @@ -808,56 +808,56 @@ /* * Replace the fermentable record contents */ - product->fermentables[product->fermentables_row].f_name = query.value(0).toString(); - product->fermentables[product->fermentables_row].f_origin = query.value(1).toString(); - product->fermentables[product->fermentables_row].f_supplier = query.value(2).toString(); - product->fermentables[product->fermentables_row].f_cost = query.value(3).toDouble(); - product->fermentables[product->fermentables_row].f_type = query.value(4).toInt(); - product->fermentables[product->fermentables_row].f_yield = query.value(5).toDouble(); - product->fermentables[product->fermentables_row].f_color = query.value(6).toDouble(); - product->fermentables[product->fermentables_row].f_coarse_fine_diff = query.value(7).toDouble(); - product->fermentables[product->fermentables_row].f_moisture = query.value(8).toDouble(); - product->fermentables[product->fermentables_row].f_diastatic_power = query.value(9).toDouble(); - product->fermentables[product->fermentables_row].f_protein = query.value(10).toDouble(); - product->fermentables[product->fermentables_row].f_dissolved_protein = query.value(11).toDouble(); - product->fermentables[product->fermentables_row].f_max_in_batch = query.value(12).toDouble(); - product->fermentables[product->fermentables_row].f_graintype = query.value(13).toInt(); - product->fermentables[product->fermentables_row].f_recommend_mash = query.value(14).toInt() ? true:false; - product->fermentables[product->fermentables_row].f_add_after_boil = query.value(15).toInt() ? true:false; - product->fermentables[product->fermentables_row].f_di_ph = query.value(16).toDouble(); - product->fermentables[product->fermentables_row].f_acid_to_ph_57 = query.value(17).toDouble(); - product->fermentables[product->fermentables_row].f_inventory = query.value(18).toDouble(); + product->fermentables[product->fermentables_row].name = query.value(0).toString(); + product->fermentables[product->fermentables_row].origin = query.value(1).toString(); + product->fermentables[product->fermentables_row].supplier = query.value(2).toString(); + product->fermentables[product->fermentables_row].cost = query.value(3).toDouble(); + product->fermentables[product->fermentables_row].type = query.value(4).toInt(); + product->fermentables[product->fermentables_row].yield = query.value(5).toDouble(); + product->fermentables[product->fermentables_row].color = query.value(6).toDouble(); + product->fermentables[product->fermentables_row].coarse_fine_diff = query.value(7).toDouble(); + product->fermentables[product->fermentables_row].moisture = query.value(8).toDouble(); + product->fermentables[product->fermentables_row].diastatic_power = query.value(9).toDouble(); + product->fermentables[product->fermentables_row].protein = query.value(10).toDouble(); + product->fermentables[product->fermentables_row].dissolved_protein = query.value(11).toDouble(); + product->fermentables[product->fermentables_row].max_in_batch = query.value(12).toDouble(); + product->fermentables[product->fermentables_row].graintype = query.value(13).toInt(); + product->fermentables[product->fermentables_row].recommend_mash = query.value(14).toInt() ? true:false; + product->fermentables[product->fermentables_row].add_after_boil = query.value(15).toInt() ? true:false; + product->fermentables[product->fermentables_row].di_ph = query.value(16).toDouble(); + product->fermentables[product->fermentables_row].acid_to_ph_57 = query.value(17).toDouble(); + product->fermentables[product->fermentables_row].inventory = query.value(18).toDouble(); /* * Update the visible fields */ - fnameEdit->setText(product->fermentables.at(product->fermentables_row).f_name); - fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).f_supplier); - fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).f_max_in_batch); + fnameEdit->setText(product->fermentables.at(product->fermentables_row).name); + fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).supplier); + fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).max_in_batch); - ui->fermentablesTable->setItem(product->fermentables_row, 0, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).f_supplier)); - ui->fermentablesTable->setItem(product->fermentables_row, 1, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).f_name)); + ui->fermentablesTable->setItem(product->fermentables_row, 0, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).supplier)); + ui->fermentablesTable->setItem(product->fermentables_row, 1, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).name)); - w = QString("%1").arg(product->fermentables.at(product->fermentables_row).f_color, 1, 'f', 0, '0'); + w = QString("%1").arg(product->fermentables.at(product->fermentables_row).color, 1, 'f', 0, '0'); item = new QTableWidgetItem(w); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 2, item); - item = new QTableWidgetItem(fermentable_types[product->fermentables.at(product->fermentables_row).f_type]); + item = new QTableWidgetItem(fermentable_types[product->fermentables.at(product->fermentables_row).type]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 3, item); - item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(product->fermentables_row).f_graintype]); + item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(product->fermentables_row).graintype]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 4, item); - item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(product->fermentables_row).f_yield, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(product->fermentables_row).yield, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 6, item); - item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(product->fermentables_row).f_inventory, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(product->fermentables_row).inventory, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); - if (product->fermentables.at(product->fermentables_row).f_inventory < product->fermentables.at(product->fermentables_row).f_amount) + if (product->fermentables.at(product->fermentables_row).inventory < product->fermentables.at(product->fermentables_row).amount) item->setForeground(QBrush(QColor(Qt::red))); ui->fermentablesTable->setItem(product->fermentables_row, 8, item); @@ -894,21 +894,21 @@ { qDebug() << "ferment_added_changed()" << product->fermentables_row << val; - product->fermentables[product->fermentables_row].f_added = val; + product->fermentables[product->fermentables_row].added = val; QTableWidgetItem *item = new QTableWidgetItem(fermentable_added[val]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(product->fermentables_row, 5, item); - famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE); - pctEdit->setReadOnly(! (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE)); + famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE); + pctEdit->setReadOnly(! (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE)); double total = 0; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging - total += product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging + total += product->fermentables.at(i).amount; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) - product->fermentables[i].f_percentage = product->fermentables.at(i).f_amount / total * 100; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) + product->fermentables[i].percentage = product->fermentables.at(i).amount / total * 100; is_changed(); emit refreshAll(); @@ -988,12 +988,12 @@ fnameEdit = new QLineEdit(dialog); fnameEdit->setObjectName(QString::fromUtf8("fnameEdit")); - fnameEdit->setText(product->fermentables.at(product->fermentables_row).f_name); + fnameEdit->setText(product->fermentables.at(product->fermentables_row).name); fnameEdit->setGeometry(QRect(160, 10, 511, 23)); fnameEdit->setReadOnly(true); fsupplierEdit = new QLineEdit(dialog); fsupplierEdit->setObjectName(QString::fromUtf8("fsupplierEdit")); - fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).f_supplier); + fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).supplier); fsupplierEdit->setGeometry(QRect(160, 40, 511, 23)); fsupplierEdit->setReadOnly(true); famountEdit = new QDoubleSpinBox(dialog); @@ -1002,10 +1002,10 @@ famountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); famountEdit->setAccelerated(true); famountEdit->setDecimals(3); - famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < 4); + famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < 4); famountEdit->setMaximum(100000.0); famountEdit->setSingleStep(0.0010); - famountEdit->setValue(product->fermentables.at(product->fermentables_row).f_amount); + famountEdit->setValue(product->fermentables.at(product->fermentables_row).amount); pctEdit = new QDoubleSpinBox(dialog); pctEdit->setObjectName(QString::fromUtf8("pctEdit")); @@ -1013,8 +1013,8 @@ pctEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); pctEdit->setAccelerated(true); pctEdit->setDecimals(1); - if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE) { - if (product->fermentables.at(product->fermentables_row).f_adjust_to_total_100) + if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE) { + if (product->fermentables.at(product->fermentables_row).adjust_to_total_100) pctEdit->setReadOnly(true); else pctEdit->setReadOnly(false); @@ -1023,7 +1023,7 @@ } pctEdit->setMaximum(100.0); pctEdit->setSingleStep(0.1); - pctEdit->setValue(product->fermentables.at(product->fermentables_row).f_percentage); + pctEdit->setValue(product->fermentables.at(product->fermentables_row).percentage); faddedEdit = new QComboBox(dialog); faddedEdit->setObjectName(QString::fromUtf8("faddedEdit")); @@ -1032,12 +1032,12 @@ faddedEdit->addItem(tr("Boil")); faddedEdit->addItem(tr("Fermentation")); faddedEdit->addItem(tr("Lagering")); - faddedEdit->setCurrentIndex(product->fermentables.at(product->fermentables_row).f_added); + faddedEdit->setCurrentIndex(product->fermentables.at(product->fermentables_row).added); to100Edit = new QCheckBox(dialog); to100Edit->setObjectName(QString::fromUtf8("to100Edit")); to100Edit->setGeometry(QRect(160, 160, 85, 21)); - to100Edit->setChecked(product->fermentables.at(product->fermentables_row).f_adjust_to_total_100); + to100Edit->setChecked(product->fermentables.at(product->fermentables_row).adjust_to_total_100); finstockEdit = new QCheckBox(dialog); finstockEdit->setObjectName(QString::fromUtf8("instockEdit")); @@ -1051,7 +1051,7 @@ fmaxEdit->setReadOnly(true); fmaxEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); fmaxEdit->setDecimals(1); - fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).f_max_in_batch); + fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).max_in_batch); ferment_instock_changed(true); @@ -1074,14 +1074,14 @@ */ double total = 0; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging - total += product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging + total += product->fermentables.at(i).amount; product->fermentables_use100 = false; for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_adjust_to_total_100) + if (product->fermentables.at(i).adjust_to_total_100) product->fermentables_use100 = true; - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { - product->fermentables[i].f_percentage = product->fermentables.at(i).f_amount / total * 100; + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { + product->fermentables[i].percentage = product->fermentables.at(i).amount / total * 100; } } } diff -r d1d208a857b0 -r 242a68fa7186 src/EditProductTab8.cpp --- a/src/EditProductTab8.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditProductTab8.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -61,20 +61,20 @@ { double C1 = 0; - if ((F.f_di_ph != 5.7) && ((F.f_acid_to_ph_57 < - 0.1) || (F.f_acid_to_ph_57 > 0.1))) { - C1 = F.f_acid_to_ph_57 / (F.f_di_ph - 5.7); + if ((F.di_ph != 5.7) && ((F.acid_to_ph_57 < - 0.1) || (F.acid_to_ph_57 > 0.1))) { + C1 = F.acid_to_ph_57 / (F.di_ph - 5.7); } else { /* * If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. */ - switch (F.f_graintype) { + switch (F.graintype) { case FERMENTABLE_GRAINTYPE_BASE: case FERMENTABLE_GRAINTYPE_KILNED: - case FERMENTABLE_GRAINTYPE_SPECIAL: C1 = 0.014 * F.f_color - 34.192; + case FERMENTABLE_GRAINTYPE_SPECIAL: C1 = 0.014 * F.color - 34.192; break; - case FERMENTABLE_GRAINTYPE_CRYSTAL: C1 = -0.0597 * F.f_color - 32.457; + case FERMENTABLE_GRAINTYPE_CRYSTAL: C1 = -0.0597 * F.color - 32.457; break; - case FERMENTABLE_GRAINTYPE_ROAST: C1 = 0.0107 * F.f_color - 54.768; + case FERMENTABLE_GRAINTYPE_ROAST: C1 = 0.0107 * F.color - 54.768; break; case FERMENTABLE_GRAINTYPE_SOUR_MALT: C1 = -149; break; @@ -87,7 +87,7 @@ double EditProduct::AcidRequired(double ZpH, Fermentables F) { double C1 = BufferCapacity(F); - double x = F.f_di_ph; + double x = F.di_ph; return C1 * (ZpH - x); } @@ -105,8 +105,8 @@ if (product->fermentables.size()) { for (i = 0; i < product->fermentables.size(); i++) { F = product->fermentables.at(i); - if (F.f_added == FERMENTABLE_ADDED_MASH && F.f_graintype != FERMENTABLE_GRAINTYPE_NO_MALT) { - x = AcidRequired(pHZ, F) * F.f_amount; + if (F.added == FERMENTABLE_ADDED_MASH && F.graintype != FERMENTABLE_GRAINTYPE_NO_MALT) { + x = AcidRequired(pHZ, F) * F.amount; Result += x; } } diff -r d1d208a857b0 -r 242a68fa7186 src/EditProductTab9.cpp --- a/src/EditProductTab9.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditProductTab9.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -224,8 +224,8 @@ if (product->fermentables.size() == 0) return; // no fermentables loaded yet for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { - m += product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { + m += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); } } tot = Utils::sg_to_plato(product->brew_preboil_sg) * (product->brew_preboil_volume / 1.04) * product->brew_preboil_sg * 10 / 1000; @@ -306,10 +306,10 @@ if (product->fermentables.size() == 0) return; // no fermentables loaded yet for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { - m += product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); - } else if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOIL) { - b += product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { + m += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); + } else if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) { + b += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); } } double tot = Utils::sg_to_plato(product->brew_aboil_sg) * (product->brew_aboil_volume / 1.04) * product->brew_aboil_sg * 10 / 1000; diff -r d1d208a857b0 -r 242a68fa7186 src/EditRecipeExport.cpp --- a/src/EditRecipeExport.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditRecipeExport.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -134,26 +134,26 @@ for (int i = 0; i < recipe->fermentables.size(); i++) { xmlWriter->writeStartElement("FERMENTABLE"); xmlWriter->writeTextElement("VERSION", "1"); - xmlWriter->writeTextElement("NAME", recipe->fermentables.at(i).f_name); - xmlWriter->writeTextElement("TYPE", fermentable_type[recipe->fermentables.at(i).f_type]); - xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->fermentables.at(i).f_amount, 'f', 4)); - xmlWriter->writeTextElement("YIELD", QString::number(recipe->fermentables.at(i).f_yield, 'f', 1)); - xmlWriter->writeTextElement("COLOR", QString::number(Utils::ebc_to_srm(recipe->fermentables.at(i).f_color), 'f', 1)); - xmlWriter->writeTextElement("ADD_AFTER_BOIL", recipe->fermentables.at(i).f_add_after_boil ? "TRUE":"FALSE"); - xmlWriter->writeTextElement("ORIGIN", recipe->fermentables.at(i).f_origin); - xmlWriter->writeTextElement("SUPPLIER", recipe->fermentables.at(i).f_supplier); - if (recipe->fermentables.at(i).f_coarse_fine_diff) - xmlWriter->writeTextElement("COARSE_FINE_DIFF", QString::number(recipe->fermentables.at(i).f_coarse_fine_diff, 'f', 4)); - if (recipe->fermentables.at(i).f_moisture) - xmlWriter->writeTextElement("MOISTURE", QString::number(recipe->fermentables.at(i).f_moisture, 'f', 4)); - if (recipe->fermentables.at(i).f_diastatic_power) - xmlWriter->writeTextElement("DIASTATIC_POWER", QString::number(recipe->fermentables.at(i).f_diastatic_power, 'f', 4)); - if (recipe->fermentables.at(i).f_protein) - xmlWriter->writeTextElement("PROTEIN", QString::number(recipe->fermentables.at(i).f_protein, 'f', 4)); - if (recipe->fermentables.at(i).f_max_in_batch) - xmlWriter->writeTextElement("MAX_IN_BATCH", QString::number(recipe->fermentables.at(i).f_max_in_batch, 'f', 1)); - xmlWriter->writeTextElement("RECOMMEND_MASH", recipe->fermentables.at(i).f_recommend_mash ? "TRUE":"FALSE"); - xmlWriter->writeTextElement("GRAINTYPE", fermentable_graintype[recipe->fermentables.at(i).f_graintype]); + xmlWriter->writeTextElement("NAME", recipe->fermentables.at(i).name); + xmlWriter->writeTextElement("TYPE", fermentable_type[recipe->fermentables.at(i).type]); + xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->fermentables.at(i).amount, 'f', 4)); + xmlWriter->writeTextElement("YIELD", QString::number(recipe->fermentables.at(i).yield, 'f', 1)); + xmlWriter->writeTextElement("COLOR", QString::number(Utils::ebc_to_srm(recipe->fermentables.at(i).color), 'f', 1)); + xmlWriter->writeTextElement("ADD_AFTER_BOIL", recipe->fermentables.at(i).add_after_boil ? "TRUE":"FALSE"); + xmlWriter->writeTextElement("ORIGIN", recipe->fermentables.at(i).origin); + xmlWriter->writeTextElement("SUPPLIER", recipe->fermentables.at(i).supplier); + if (recipe->fermentables.at(i).coarse_fine_diff) + xmlWriter->writeTextElement("COARSE_FINE_DIFF", QString::number(recipe->fermentables.at(i).coarse_fine_diff, 'f', 4)); + if (recipe->fermentables.at(i).moisture) + xmlWriter->writeTextElement("MOISTURE", QString::number(recipe->fermentables.at(i).moisture, 'f', 4)); + if (recipe->fermentables.at(i).diastatic_power) + xmlWriter->writeTextElement("DIASTATIC_POWER", QString::number(recipe->fermentables.at(i).diastatic_power, 'f', 4)); + if (recipe->fermentables.at(i).protein) + xmlWriter->writeTextElement("PROTEIN", QString::number(recipe->fermentables.at(i).protein, 'f', 4)); + if (recipe->fermentables.at(i).max_in_batch) + xmlWriter->writeTextElement("MAX_IN_BATCH", QString::number(recipe->fermentables.at(i).max_in_batch, 'f', 1)); + xmlWriter->writeTextElement("RECOMMEND_MASH", recipe->fermentables.at(i).recommend_mash ? "TRUE":"FALSE"); + xmlWriter->writeTextElement("GRAINTYPE", fermentable_graintype[recipe->fermentables.at(i).graintype]); xmlWriter->writeEndElement(); } xmlWriter->writeEndElement(); // FERMENTABLES @@ -476,11 +476,11 @@ memo.append("[tabular]\n"); memo.append("[head]Mout, granen en suikers[/head][head]EBC[/head][head]Gewicht kg[/head][head]%[/head][head]Gebruik tijdens[/head]\n"); for (int i = 0; i < recipe->fermentables.size(); i++) { - memo.append("[row][data]" + recipe->fermentables.at(i).f_name + " (" + recipe->fermentables.at(i).f_supplier + ")[/data]"); - memo.append("[data]" + QString::number(recipe->fermentables.at(i).f_color) + "[/data]"); - memo.append("[data]" + QString::number(recipe->fermentables.at(i).f_amount, 'f', 3) + "[/data]"); - memo.append("[data]" + QString::number(recipe->fermentables.at(i).f_percentage, 'f', 1) + "[/data]"); - memo.append("[data]" + fermentable_added[recipe->fermentables.at(i).f_added] + "[/data][/row]\n"); + memo.append("[row][data]" + recipe->fermentables.at(i).name + " (" + recipe->fermentables.at(i).supplier + ")[/data]"); + memo.append("[data]" + QString::number(recipe->fermentables.at(i).color) + "[/data]"); + memo.append("[data]" + QString::number(recipe->fermentables.at(i).amount, 'f', 3) + "[/data]"); + memo.append("[data]" + QString::number(recipe->fermentables.at(i).percentage, 'f', 1) + "[/data]"); + memo.append("[data]" + fermentable_added[recipe->fermentables.at(i).added] + "[/data][/row]\n"); } memo.append("[/tabular]\n\n"); diff -r d1d208a857b0 -r 242a68fa7186 src/EditRecipeTab2.cpp --- a/src/EditRecipeTab2.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditRecipeTab2.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -21,17 +21,17 @@ bool EditRecipe::ferment_sort_test(const Fermentables &D1, const Fermentables &D2) { - if (D1.f_added > D2.f_added) + if (D1.added > D2.added) return false; - if (D1.f_added < D2.f_added) + if (D1.added < D2.added) return true; - return (D1.f_amount >= D2.f_amount) && (D1.f_color < D2.f_color); + return (D1.amount >= D2.amount) && (D1.color < D2.color); } void EditRecipe::to100Fermentables(int row) { - if (recipe->fermentables.at(row).f_adjust_to_total_100) { + if (recipe->fermentables.at(row).adjust_to_total_100) { QWidget *pWidget = new QWidget(); QLabel *label = new QLabel; label->setPixmap(QPixmap(":icons/silk/tick.png")); @@ -78,36 +78,36 @@ for (int i = 0; i < recipe->fermentables.size(); i++) { - ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(recipe->fermentables.at(i).f_supplier)); - ui->fermentablesTable->setItem(i, 1, new QTableWidgetItem(recipe->fermentables.at(i).f_name)); + ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(recipe->fermentables.at(i).supplier)); + ui->fermentablesTable->setItem(i, 1, new QTableWidgetItem(recipe->fermentables.at(i).name)); - w = QString("%1").arg(recipe->fermentables.at(i).f_color, 1, 'f', 0, '0'); + w = QString("%1").arg(recipe->fermentables.at(i).color, 1, 'f', 0, '0'); item = new QTableWidgetItem(w); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 2, item); - item = new QTableWidgetItem(fermentable_types[recipe->fermentables.at(i).f_type]); + item = new QTableWidgetItem(fermentable_types[recipe->fermentables.at(i).type]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 3, item); - item = new QTableWidgetItem(fermentable_graintypes[recipe->fermentables.at(i).f_graintype]); + item = new QTableWidgetItem(fermentable_graintypes[recipe->fermentables.at(i).graintype]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 4, item); - item = new QTableWidgetItem(fermentable_added[recipe->fermentables.at(i).f_added]); + item = new QTableWidgetItem(fermentable_added[recipe->fermentables.at(i).added]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 5, item); - item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables.at(i).f_yield, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables.at(i).yield, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 6, item); - item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables.at(i).f_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables.at(i).amount, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 7, item); - if (recipe->fermentables.at(i).f_added < 4) { - item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables.at(i).f_percentage, 2, 'f', 1, '0')); + if (recipe->fermentables.at(i).added < 4) { + item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables.at(i).percentage, 2, 'f', 1, '0')); } else { item = new QTableWidgetItem(QString("")); // Blank for bottling and kegging. } @@ -219,37 +219,37 @@ recipe->mashs_kg = 0; for (i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_type == 1 && recipe->fermentables.at(i).f_added < 4) // Sugars - psugar += recipe->fermentables.at(i).f_percentage; - if (recipe->fermentables.at(i).f_graintype == 2 && recipe->fermentables.at(i).f_added < 4) // Crystal/Cara - pcara += recipe->fermentables.at(i).f_percentage; - d = recipe->fermentables.at(i).f_amount * (recipe->fermentables.at(i).f_yield / 100) * (1 - recipe->fermentables.at(i).f_moisture / 100); - if (recipe->fermentables.at(i).f_added == 0) { // Mash + if (recipe->fermentables.at(i).type == 1 && recipe->fermentables.at(i).added < 4) // Sugars + psugar += recipe->fermentables.at(i).percentage; + if (recipe->fermentables.at(i).graintype == 2 && recipe->fermentables.at(i).added < 4) // Crystal/Cara + pcara += recipe->fermentables.at(i).percentage; + d = recipe->fermentables.at(i).amount * (recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100); + if (recipe->fermentables.at(i).added == 0) { // Mash if (mvol > 0) { // If mash volume is known - mvol += recipe->fermentables.at(i).f_amount * recipe->fermentables.at(i).f_moisture / 100; + mvol += recipe->fermentables.at(i).amount * recipe->fermentables.at(i).moisture / 100; s += d; } d = ui->efficiencyEdit->value() / 100 * d; sugarsm += d; - recipe->mashs_kg += recipe->fermentables.at(i).f_amount; + recipe->mashs_kg += recipe->fermentables.at(i).amount; } - if (recipe->fermentables.at(i).f_added == 0 || recipe->fermentables.at(i).f_added == 1) // Mash or boil + if (recipe->fermentables.at(i).added == 0 || recipe->fermentables.at(i).added == 1) // Mash or boil sugarsf += d; - if (recipe->fermentables.at(i).f_added == 2 || recipe->fermentables.at(i).f_added == 3) { // Fermentation or lagering - x = (recipe->fermentables.at(i).f_yield / 100) * (1 - recipe->fermentables.at(i).f_moisture / 100); - addedS += recipe->fermentables.at(i).f_amount * x; - addedmass += recipe->fermentables.at(i).f_amount; - vol += (x * sugardensity + (1 - x) * 1) * recipe->fermentables.at(i).f_amount; + if (recipe->fermentables.at(i).added == 2 || recipe->fermentables.at(i).added == 3) { // Fermentation or lagering + x = (recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100); + addedS += recipe->fermentables.at(i).amount * x; + addedmass += recipe->fermentables.at(i).amount; + vol += (x * sugardensity + (1 - x) * 1) * recipe->fermentables.at(i).amount; } - if (recipe->fermentables.at(i).f_added == 0 && - (recipe->fermentables.at(i).f_type == 0 || recipe->fermentables.at(i).f_type == 4) && - recipe->fermentables.at(i).f_color < 50) { - lintner += recipe->fermentables.at(i).f_diastatic_power * recipe->fermentables.at(i).f_amount; + if (recipe->fermentables.at(i).added == 0 && + (recipe->fermentables.at(i).type == 0 || recipe->fermentables.at(i).type == 4) && + recipe->fermentables.at(i).color < 50) { + lintner += recipe->fermentables.at(i).diastatic_power * recipe->fermentables.at(i).amount; } - if (recipe->fermentables.at(i).f_added < 4) { - colort += recipe->fermentables.at(i).f_amount * Utils::ebc_to_srm(recipe->fermentables.at(i).f_color); - colorh += recipe->fermentables.at(i).f_amount * recipe->fermentables.at(i).f_color * Utils::get_kt(recipe->fermentables.at(i).f_color); - colorn += (recipe->fermentables.at(i).f_percentage / 100) * recipe->fermentables.at(i).f_color; // For 8.6 Pt wort. + if (recipe->fermentables.at(i).added < 4) { + colort += recipe->fermentables.at(i).amount * Utils::ebc_to_srm(recipe->fermentables.at(i).color); + colorh += recipe->fermentables.at(i).amount * recipe->fermentables.at(i).color * Utils::get_kt(recipe->fermentables.at(i).color); + colorn += (recipe->fermentables.at(i).percentage / 100) * recipe->fermentables.at(i).color; // For 8.6 Pt wort. } } qDebug() << " colort" << colort << "colorh" << colorh << "colorn" << colorn; @@ -351,10 +351,10 @@ // Bottle priming double priming_total = 0; for (i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_added == 4) { - priming_total += ((recipe->fermentables.at(i).f_yield / 100) * (1 - recipe->fermentables.at(i).f_moisture / 100)) * - recipe->fermentables.at(i).f_amount; - qDebug() << " priming" << recipe->fermentables.at(i).f_amount << "total" << priming_total; + if (recipe->fermentables.at(i).added == 4) { + priming_total += ((recipe->fermentables.at(i).yield / 100) * (1 - recipe->fermentables.at(i).moisture / 100)) * + recipe->fermentables.at(i).amount; + qDebug() << " priming" << recipe->fermentables.at(i).amount << "total" << priming_total; } } double grl = priming_total * 1000.0 * (1 / recipe->batch_size); @@ -381,11 +381,11 @@ double sug = Utils::sg_to_plato(og) * recipe->batch_size * og / 100.0; // total amount of sugars in kg. for (i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_added < 4) { - d = recipe->fermentables.at(i).f_percentage / 100.0 * - (recipe->fermentables.at(i).f_yield / 100.0) * - (1 - recipe->fermentables.at(i).f_moisture / 100.0); - if (recipe->fermentables.at(i).f_added == 0) // Mash + if (recipe->fermentables.at(i).added < 4) { + d = recipe->fermentables.at(i).percentage / 100.0 * + (recipe->fermentables.at(i).yield / 100.0) * + (1 - recipe->fermentables.at(i).moisture / 100.0); + if (recipe->fermentables.at(i).added == 0) // Mash d = efficiency / 100.0 * d; tot += d; } @@ -395,8 +395,8 @@ if (totmass) { for (i = 0; i < recipe->fermentables.size(); i++) { - amount = round(recipe->fermentables.at(i).f_percentage * 10.0 * totmass) / 1000.0; - recipe->fermentables[i].f_amount = amount; + amount = round(recipe->fermentables.at(i).percentage * 10.0 * totmass) / 1000.0; + recipe->fermentables[i].amount = amount; } } } @@ -475,32 +475,32 @@ qDebug() << "Add fermentable row"; for (int i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_amount == 0 && recipe->fermentables.at(i).f_color == 0) + if (recipe->fermentables.at(i).amount == 0 && recipe->fermentables.at(i).color == 0) return; // Add only one at a time. } - newf.f_name = "Select one"; - newf.f_origin = ""; - newf.f_supplier = ""; - newf.f_amount = 0; - newf.f_cost = 0; - newf.f_type = 0; - newf.f_yield = 0; - newf.f_color = 0; - newf.f_coarse_fine_diff = 0; - newf.f_moisture = 0; - newf.f_diastatic_power = 0; - newf.f_protein = 0; - newf.f_dissolved_protein = 0; - newf.f_max_in_batch = 100; - newf.f_graintype = 0; - newf.f_added = 0; - newf.f_recommend_mash = true; - newf.f_add_after_boil = false; - newf.f_adjust_to_total_100 = false; - newf.f_percentage = 0; - newf.f_di_ph = 0; - newf.f_acid_to_ph_57 = 0; + newf.name = "Select one"; + newf.origin = ""; + newf.supplier = ""; + newf.amount = 0; + newf.cost = 0; + newf.type = 0; + newf.yield = 0; + newf.color = 0; + newf.coarse_fine_diff = 0; + newf.moisture = 0; + newf.diastatic_power = 0; + newf.protein = 0; + newf.dissolved_protein = 0; + newf.max_in_batch = 100; + newf.graintype = 0; + newf.added = 0; + newf.recommend_mash = true; + newf.add_after_boil = false; + newf.adjust_to_total_100 = false; + newf.percentage = 0; + newf.di_ph = 0; + newf.acid_to_ph_57 = 0; recipe->fermentables.append(newf); emit refreshAll(); @@ -519,7 +519,7 @@ if (recipe->fermentables.size() < 1) return; - int rc = QMessageBox::warning(this, tr("Delete fermentable"), tr("Delete %1").arg(recipe->fermentables.at(row).f_name), + int rc = QMessageBox::warning(this, tr("Delete fermentable"), tr("Delete %1").arg(recipe->fermentables.at(row).name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (rc == QMessageBox::No) return; @@ -531,11 +531,11 @@ */ double total = 0; for (int i = 0; i < recipe->fermentables.size(); i++) - if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging - total += recipe->fermentables.at(i).f_amount; + if (recipe->fermentables.at(i).added < 4) // Only before bottle/kegging + total += recipe->fermentables.at(i).amount; for (int i = 0; i < recipe->fermentables.size(); i++) - if (recipe->fermentables.at(i).f_added < 4) - recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100; + if (recipe->fermentables.at(i).added < 4) + recipe->fermentables[i].percentage = recipe->fermentables.at(i).amount / total * 100; is_changed(); emit refreshAll(); @@ -547,26 +547,26 @@ QTableWidgetItem *item; double total = 0, perc; - if (recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).f_added < 4) + if (recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).added < 4) return; qDebug() << "ferment_amount_changed()" << recipe->fermentables_row << val; - recipe->fermentables[recipe->fermentables_row].f_amount = val; + recipe->fermentables[recipe->fermentables_row].amount = val; item = new QTableWidgetItem(QString("%1 Kg").arg(val, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 7, item); for (int i = 0; i < recipe->fermentables.size(); i++) - if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging - total += recipe->fermentables.at(i).f_amount; + if (recipe->fermentables.at(i).added < 4) // Only before bottle/kegging + total += recipe->fermentables.at(i).amount; /* * Recalculate the percentages */ for (int i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_added < 4) { - perc = recipe->fermentables.at(i).f_amount / total * 100; - recipe->fermentables[i].f_percentage = perc; + if (recipe->fermentables.at(i).added < 4) { + perc = recipe->fermentables.at(i).amount / total * 100; + recipe->fermentables[i].percentage = perc; item = new QTableWidgetItem(QString("%1%").arg(perc, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(i, 8, item); @@ -592,35 +592,35 @@ * this is not the entry to be adjusted to 100. */ for (int i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging - total += recipe->fermentables.at(i).f_amount; - if (recipe->fermentables.at(i).f_adjust_to_total_100) + if (recipe->fermentables.at(i).added < 4) // Only before bottle/kegging + total += recipe->fermentables.at(i).amount; + if (recipe->fermentables.at(i).adjust_to_total_100) row100 = i; } - double oldperc = recipe->fermentables.at(recipe->fermentables_row).f_percentage; + double oldperc = recipe->fermentables.at(recipe->fermentables_row).percentage; double diffp = val - oldperc; double diffw = (diffp / 100) * total; qDebug() << "row100" << row100 << "total" << total << "diff kg" << diffw << "diff %" << diffp; - recipe->fermentables[recipe->fermentables_row].f_percentage += diffp; - recipe->fermentables[recipe->fermentables_row].f_amount += diffw; - recipe->fermentables[row100].f_percentage -= diffp; - recipe->fermentables[row100].f_amount -= diffw; + recipe->fermentables[recipe->fermentables_row].percentage += diffp; + recipe->fermentables[recipe->fermentables_row].amount += diffw; + recipe->fermentables[row100].percentage -= diffp; + recipe->fermentables[row100].amount -= diffw; - item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables[recipe->fermentables_row].f_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables[recipe->fermentables_row].amount, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 7, item); - this->famountEdit->setValue(recipe->fermentables[recipe->fermentables_row].f_amount); + this->famountEdit->setValue(recipe->fermentables[recipe->fermentables_row].amount); - item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables[recipe->fermentables_row].f_percentage, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables[recipe->fermentables_row].percentage, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 8, item); - item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables[row100].f_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables[row100].amount, 4, 'f', 3, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(row100, 7, item); - item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables[row100].f_percentage, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables[row100].percentage, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(row100, 8, item); @@ -632,9 +632,9 @@ { qDebug() << "ferment_to100_changed()" << recipe->fermentables_row << val << recipe->fermentables_use100; - if (recipe->fermentables.at(recipe->fermentables_row).f_added >= 4) { + if (recipe->fermentables.at(recipe->fermentables_row).added >= 4) { const QSignalBlocker blocker1(to100Edit); - recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = false; + recipe->fermentables[recipe->fermentables_row].adjust_to_total_100 = false; to100Edit->setChecked(false); return; } @@ -648,21 +648,21 @@ if (! recipe->fermentables_use100 && val) { /* Scenario 1. */ recipe->fermentables_use100 = true; - recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = true; + recipe->fermentables[recipe->fermentables_row].adjust_to_total_100 = true; pctEdit->setReadOnly(false); famountEdit->setReadOnly(true); - } else if (recipe->fermentables_use100 && recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 && ! val) { + } else if (recipe->fermentables_use100 && recipe->fermentables[recipe->fermentables_row].adjust_to_total_100 && ! val) { /* Scenario 2. */ - recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = false; + recipe->fermentables[recipe->fermentables_row].adjust_to_total_100 = false; recipe->fermentables_use100 = false; pctEdit->setReadOnly(true); famountEdit->setReadOnly(false); - } else if (recipe->fermentables_use100 && ! recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 && val) { + } else if (recipe->fermentables_use100 && ! recipe->fermentables[recipe->fermentables_row].adjust_to_total_100 && val) { /* Scenario 3. */ for (int i = 0; i < recipe->fermentables.size(); i++) { - recipe->fermentables[i].f_adjust_to_total_100 = false; + recipe->fermentables[i].adjust_to_total_100 = false; } - recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = true; + recipe->fermentables[recipe->fermentables_row].adjust_to_total_100 = true; } else { qDebug() << "bug"; return; @@ -706,49 +706,49 @@ /* * Replace the fermentable record contents */ - recipe->fermentables[recipe->fermentables_row].f_name = query.value(0).toString(); - recipe->fermentables[recipe->fermentables_row].f_origin = query.value(1).toString(); - recipe->fermentables[recipe->fermentables_row].f_supplier = query.value(2).toString(); - recipe->fermentables[recipe->fermentables_row].f_cost = query.value(3).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_type = query.value(4).toInt(); - recipe->fermentables[recipe->fermentables_row].f_yield = query.value(5).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_color = query.value(6).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_coarse_fine_diff = query.value(7).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_moisture = query.value(8).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_diastatic_power = query.value(9).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_protein = query.value(10).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_dissolved_protein = query.value(11).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_max_in_batch = query.value(12).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_graintype = query.value(13).toInt(); - recipe->fermentables[recipe->fermentables_row].f_recommend_mash = query.value(14).toInt() ? true:false; - recipe->fermentables[recipe->fermentables_row].f_add_after_boil = query.value(15).toInt() ? true:false; - recipe->fermentables[recipe->fermentables_row].f_di_ph = query.value(16).toDouble(); - recipe->fermentables[recipe->fermentables_row].f_acid_to_ph_57 = query.value(17).toDouble(); + recipe->fermentables[recipe->fermentables_row].name = query.value(0).toString(); + recipe->fermentables[recipe->fermentables_row].origin = query.value(1).toString(); + recipe->fermentables[recipe->fermentables_row].supplier = query.value(2).toString(); + recipe->fermentables[recipe->fermentables_row].cost = query.value(3).toDouble(); + recipe->fermentables[recipe->fermentables_row].type = query.value(4).toInt(); + recipe->fermentables[recipe->fermentables_row].yield = query.value(5).toDouble(); + recipe->fermentables[recipe->fermentables_row].color = query.value(6).toDouble(); + recipe->fermentables[recipe->fermentables_row].coarse_fine_diff = query.value(7).toDouble(); + recipe->fermentables[recipe->fermentables_row].moisture = query.value(8).toDouble(); + recipe->fermentables[recipe->fermentables_row].diastatic_power = query.value(9).toDouble(); + recipe->fermentables[recipe->fermentables_row].protein = query.value(10).toDouble(); + recipe->fermentables[recipe->fermentables_row].dissolved_protein = query.value(11).toDouble(); + recipe->fermentables[recipe->fermentables_row].max_in_batch = query.value(12).toDouble(); + recipe->fermentables[recipe->fermentables_row].graintype = query.value(13).toInt(); + recipe->fermentables[recipe->fermentables_row].recommend_mash = query.value(14).toInt() ? true:false; + recipe->fermentables[recipe->fermentables_row].add_after_boil = query.value(15).toInt() ? true:false; + recipe->fermentables[recipe->fermentables_row].di_ph = query.value(16).toDouble(); + recipe->fermentables[recipe->fermentables_row].acid_to_ph_57 = query.value(17).toDouble(); /* * Update the visible fields */ - fnameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_name); - fsupplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_supplier); - fmaxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_max_in_batch); + fnameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).name); + fsupplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).supplier); + fmaxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).max_in_batch); - ui->fermentablesTable->setItem(recipe->fermentables_row, 0, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).f_supplier)); - ui->fermentablesTable->setItem(recipe->fermentables_row, 1, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).f_name)); + ui->fermentablesTable->setItem(recipe->fermentables_row, 0, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).supplier)); + ui->fermentablesTable->setItem(recipe->fermentables_row, 1, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).name)); - w = QString("%1").arg(recipe->fermentables.at(recipe->fermentables_row).f_color, 1, 'f', 0, '0'); + w = QString("%1").arg(recipe->fermentables.at(recipe->fermentables_row).color, 1, 'f', 0, '0'); item = new QTableWidgetItem(w); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 2, item); - item = new QTableWidgetItem(fermentable_types[recipe->fermentables.at(recipe->fermentables_row).f_type]); + item = new QTableWidgetItem(fermentable_types[recipe->fermentables.at(recipe->fermentables_row).type]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 3, item); - item = new QTableWidgetItem(fermentable_graintypes[recipe->fermentables.at(recipe->fermentables_row).f_graintype]); + item = new QTableWidgetItem(fermentable_graintypes[recipe->fermentables.at(recipe->fermentables_row).graintype]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 4, item); - item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables.at(recipe->fermentables_row).f_yield, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables.at(recipe->fermentables_row).yield, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 6, item); @@ -785,21 +785,21 @@ { qDebug() << "ferment_added_changed()" << recipe->fermentables_row << val; - recipe->fermentables[recipe->fermentables_row].f_added = val; + recipe->fermentables[recipe->fermentables_row].added = val; QTableWidgetItem *item = new QTableWidgetItem(fermentable_added[val]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->fermentablesTable->setItem(recipe->fermentables_row, 5, item); - famountEdit->setReadOnly(recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).f_added < 4); - pctEdit->setReadOnly(! (recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).f_added < 4)); + famountEdit->setReadOnly(recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).added < 4); + pctEdit->setReadOnly(! (recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).added < 4)); double total = 0; for (int i = 0; i < recipe->fermentables.size(); i++) - if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging - total += recipe->fermentables.at(i).f_amount; + if (recipe->fermentables.at(i).added < 4) // Only before bottle/kegging + total += recipe->fermentables.at(i).amount; for (int i = 0; i < recipe->fermentables.size(); i++) - if (recipe->fermentables.at(i).f_added < 4) - recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100; + if (recipe->fermentables.at(i).added < 4) + recipe->fermentables[i].percentage = recipe->fermentables.at(i).amount / total * 100; is_changed(); emit refreshAll(); @@ -879,12 +879,12 @@ fnameEdit = new QLineEdit(dialog); fnameEdit->setObjectName(QString::fromUtf8("fnameEdit")); - fnameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_name); + fnameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).name); fnameEdit->setGeometry(QRect(160, 10, 511, 23)); fnameEdit->setReadOnly(true); fsupplierEdit = new QLineEdit(dialog); fsupplierEdit->setObjectName(QString::fromUtf8("fsupplierEdit")); - fsupplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_supplier); + fsupplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).supplier); fsupplierEdit->setGeometry(QRect(160, 40, 511, 23)); fsupplierEdit->setReadOnly(true); famountEdit = new QDoubleSpinBox(dialog); @@ -893,10 +893,10 @@ famountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); famountEdit->setAccelerated(true); famountEdit->setDecimals(3); - famountEdit->setReadOnly(recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).f_added < 4); + famountEdit->setReadOnly(recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).added < 4); famountEdit->setMaximum(100000.0); famountEdit->setSingleStep(0.0010); - famountEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_amount); + famountEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).amount); pctEdit = new QDoubleSpinBox(dialog); pctEdit->setObjectName(QString::fromUtf8("pctEdit")); @@ -904,8 +904,8 @@ pctEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); pctEdit->setAccelerated(true); pctEdit->setDecimals(1); - if (recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).f_added < 4) { - if (recipe->fermentables.at(recipe->fermentables_row).f_adjust_to_total_100) + if (recipe->fermentables_use100 && recipe->fermentables.at(recipe->fermentables_row).added < 4) { + if (recipe->fermentables.at(recipe->fermentables_row).adjust_to_total_100) pctEdit->setReadOnly(true); else pctEdit->setReadOnly(false); @@ -914,7 +914,7 @@ } pctEdit->setMaximum(100.0); pctEdit->setSingleStep(0.1); - pctEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_percentage); + pctEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).percentage); faddedEdit = new QComboBox(dialog); faddedEdit->setObjectName(QString::fromUtf8("faddedEdit")); @@ -925,12 +925,12 @@ faddedEdit->addItem(tr("Lagering")); faddedEdit->addItem(tr("Bottle")); faddedEdit->addItem(tr("Kegs")); - faddedEdit->setCurrentIndex(recipe->fermentables.at(recipe->fermentables_row).f_added); + faddedEdit->setCurrentIndex(recipe->fermentables.at(recipe->fermentables_row).added); to100Edit = new QCheckBox(dialog); to100Edit->setObjectName(QString::fromUtf8("to100Edit")); to100Edit->setGeometry(QRect(160, 160, 85, 21)); - to100Edit->setChecked(recipe->fermentables.at(recipe->fermentables_row).f_adjust_to_total_100); + to100Edit->setChecked(recipe->fermentables.at(recipe->fermentables_row).adjust_to_total_100); finstockEdit = new QCheckBox(dialog); finstockEdit->setObjectName(QString::fromUtf8("instockEdit")); @@ -944,7 +944,7 @@ fmaxEdit->setReadOnly(true); fmaxEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); fmaxEdit->setDecimals(1); - fmaxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_max_in_batch); + fmaxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).max_in_batch); ferment_instock_changed(true); @@ -967,14 +967,14 @@ */ double total = 0; for (int i = 0; i < recipe->fermentables.size(); i++) - if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging - total += recipe->fermentables.at(i).f_amount; + if (recipe->fermentables.at(i).added < 4) // Only before bottle/kegging + total += recipe->fermentables.at(i).amount; recipe->fermentables_use100 = false; for (int i = 0; i < recipe->fermentables.size(); i++) { - if (recipe->fermentables.at(i).f_adjust_to_total_100) + if (recipe->fermentables.at(i).adjust_to_total_100) recipe->fermentables_use100 = true; - if (recipe->fermentables.at(i).f_added < 4) { - recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100; + if (recipe->fermentables.at(i).added < 4) { + recipe->fermentables[i].percentage = recipe->fermentables.at(i).amount / total * 100; } } } diff -r d1d208a857b0 -r 242a68fa7186 src/EditRecipeTab7.cpp --- a/src/EditRecipeTab7.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/EditRecipeTab7.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -61,20 +61,20 @@ { double C1 = 0; - if ((F.f_di_ph != 5.7) && ((F.f_acid_to_ph_57 < - 0.1) || (F.f_acid_to_ph_57 > 0.1))) { - C1 = F.f_acid_to_ph_57 / (F.f_di_ph - 5.7); + if ((F.di_ph != 5.7) && ((F.acid_to_ph_57 < - 0.1) || (F.acid_to_ph_57 > 0.1))) { + C1 = F.acid_to_ph_57 / (F.di_ph - 5.7); } else { /* * If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. */ - switch (F.f_graintype) { + switch (F.graintype) { case 0: // Base, Special, Kilned case 3: - case 5: C1 = 0.014 * F.f_color - 34.192; + case 5: C1 = 0.014 * F.color - 34.192; break; - case 2: C1 = -0.0597 * F.f_color - 32.457; // Crystal + case 2: C1 = -0.0597 * F.color - 32.457; // Crystal break; - case 1: C1 = 0.0107 * F.f_color - 54.768; // Roast + case 1: C1 = 0.0107 * F.color - 54.768; // Roast break; case 4: C1 = -149; // Sour malt break; @@ -87,7 +87,7 @@ double EditRecipe::AcidRequired(double ZpH, Fermentables F) { double C1 = BufferCapacity(F); - double x = F.f_di_ph; + double x = F.di_ph; return C1 * (ZpH - x); } @@ -105,8 +105,8 @@ if (recipe->fermentables.size()) { for (i = 0; i < recipe->fermentables.size(); i++) { F = recipe->fermentables.at(i); - if (F.f_added == 0 && F.f_graintype != 6) { // Added == Mash && graintype != No Malt - x = AcidRequired(pHZ, F) * F.f_amount; + if (F.added == 0 && F.graintype != 6) { // Added == Mash && graintype != No Malt + x = AcidRequired(pHZ, F) * F.amount; Result += x; } } diff -r d1d208a857b0 -r 242a68fa7186 src/ImportXML.cpp --- a/src/ImportXML.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/ImportXML.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -360,11 +360,11 @@ */ total++; Fermentables *f = new Fermentables(); - f->f_supplier = f->f_origin = f->f_notes = ""; - f->f_yield = 80; - f->f_max_in_batch = 100; - f->f_recommend_mash = true; - f->f_di_ph = 5.7; + f->supplier = f->origin = f->notes = ""; + f->yield = 80; + f->max_in_batch = 100; + f->recommend_mash = true; + f->di_ph = 5.7; while (xml->readNext()) { if (xml->atEnd()) @@ -375,25 +375,25 @@ "moisture=:moisture, diastatic_power=:diastatic, protein=:protein, dissolved_protein=:dissolved, " "max_in_batch=:maxinbatch, recommend_mash=:mash, added=:added, di_ph=:diph, " "acid_to_ph_57=:acidph, graintype=:graintype, uuid = :uuid"); - query.bindValue(":name", f->f_name); - query.bindValue(":type", f->f_type); - query.bindValue(":yield", QString("%1").arg(f->f_yield, 2, 'f', 1, '0')); - query.bindValue(":color", QString("%1").arg(Utils::srm_to_ebc(f->f_color), 1, 'f', 0, '0')); - query.bindValue(":addafter", f->f_add_after_boil ? 1:0); - query.bindValue(":origin", f->f_origin); - query.bindValue(":supplier", f->f_supplier); - query.bindValue(":notes", f->f_notes); - query.bindValue(":coarse", QString("%1").arg(f->f_coarse_fine_diff, 4, 'f', 3, '0')); - query.bindValue(":moisture", QString("%1").arg(f->f_moisture, 4, 'f', 3, '0')); - query.bindValue(":diastatic", Utils::kolbach_to_lintner(f->f_diastatic_power)); - query.bindValue(":protein", QString("%1").arg(f->f_protein, 4, 'f', 3, '0')); - query.bindValue(":dissolved", QString("%1").arg(f->f_dissolved_protein, 4, 'f', 3, '0')); - query.bindValue(":maxinbatch", QString("%1").arg(f->f_max_in_batch, 2, 'f', 1, '0')); - query.bindValue(":mash", f->f_recommend_mash ? 1:0); - query.bindValue(":added", f->f_added); - query.bindValue(":diph", QString("%1").arg(f->f_di_ph, 6, 'f', 5, '0')); - query.bindValue(":acidph", QString("%1").arg(f->f_acid_to_ph_57, 6, 'f', 5, '0')); - query.bindValue(":graintype", f->f_graintype); + query.bindValue(":name", f->name); + query.bindValue(":type", f->type); + query.bindValue(":yield", QString("%1").arg(f->yield, 2, 'f', 1, '0')); + query.bindValue(":color", QString("%1").arg(Utils::srm_to_ebc(f->color), 1, 'f', 0, '0')); + query.bindValue(":addafter", f->add_after_boil ? 1:0); + query.bindValue(":origin", f->origin); + query.bindValue(":supplier", f->supplier); + query.bindValue(":notes", f->notes); + query.bindValue(":coarse", QString("%1").arg(f->coarse_fine_diff, 4, 'f', 3, '0')); + query.bindValue(":moisture", QString("%1").arg(f->moisture, 4, 'f', 3, '0')); + query.bindValue(":diastatic", Utils::kolbach_to_lintner(f->diastatic_power)); + query.bindValue(":protein", QString("%1").arg(f->protein, 4, 'f', 3, '0')); + query.bindValue(":dissolved", QString("%1").arg(f->dissolved_protein, 4, 'f', 3, '0')); + query.bindValue(":maxinbatch", QString("%1").arg(f->max_in_batch, 2, 'f', 1, '0')); + query.bindValue(":mash", f->recommend_mash ? 1:0); + query.bindValue(":added", f->added); + query.bindValue(":diph", QString("%1").arg(f->di_ph, 6, 'f', 5, '0')); + query.bindValue(":acidph", QString("%1").arg(f->acid_to_ph_57, 6, 'f', 5, '0')); + query.bindValue(":graintype", f->graintype); query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); query.exec(); if (query.lastError().isValid()) { @@ -410,77 +410,77 @@ (xml->name() == "PERCENTAGE") || (xml->name() == "ADJUST_TO_TOTAL_100") )) { // Ignore. } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) { - f->f_name = xml->readElementText(); + f->name = xml->readElementText(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TYPE")) { QString temp = xml->readElementText(); if (temp == "Sugar") - f->f_type = 1; + f->type = 1; else if (temp == "Extract") - f->f_type = 2; + f->type = 2; else if (temp == "Dry extract") - f->f_type = 3; + f->type = 3; else if (temp == "Adjunct") - f->f_type = 4; + f->type = 4; else - f->f_type = 0; + f->type = 0; } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ORIGIN")) { - f->f_origin = xml->readElementText(); + f->origin = xml->readElementText(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "SUPPLIER")) { - f->f_supplier = xml->readElementText(); + f->supplier = xml->readElementText(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) { - f->f_notes = xml->readElementText(); + f->notes = xml->readElementText(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "YIELD")) { - f->f_yield = xml->readElementText().toDouble(); + f->yield = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COARSE_FINE_DIFF")) { - f->f_coarse_fine_diff = xml->readElementText().toDouble(); + f->coarse_fine_diff = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MOISTURE")) { - f->f_moisture = xml->readElementText().toDouble(); + f->moisture = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "DIASTATIC_POWER")) { - f->f_diastatic_power = xml->readElementText().toDouble(); + f->diastatic_power = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MAX_IN_BATCH")) { - f->f_max_in_batch = xml->readElementText().toDouble(); + f->max_in_batch = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "RECOMMEND_MASH")) { - f->f_recommend_mash = (xml->readElementText() == "TRUE") ? true:false; + f->recommend_mash = (xml->readElementText() == "TRUE") ? true:false; } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "GRAINTYPE")) { QString temp = xml->readElementText(); if (temp == "Roast") - f->f_graintype = 1; + f->graintype = 1; else if (temp == "Crystal") - f->f_graintype = 2; + f->graintype = 2; else if (temp == "Kilned") - f->f_graintype = 3; + f->graintype = 3; else if (temp == "Sour Malt") - f->f_graintype = 4; + f->graintype = 4; else if (temp == "Special") - f->f_graintype = 5; + f->graintype = 5; else if (temp == "No malt") - f->f_graintype = 6; + f->graintype = 6; else - f->f_graintype = 0; + f->graintype = 0; } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ADDED")) { QString temp = xml->readElementText(); if (temp == "Boil") - f->f_added = 1; + f->added = 1; else if (temp == "Fermentation") - f->f_added = 2; + f->added = 2; else if (temp == "Lagering") - f->f_added = 3; + f->added = 3; else if (temp == "Bottle") - f->f_added = 4; + f->added = 4; else - f->f_added = 0; + f->added = 0; } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ADD_AFTER_BOIL")) { - f->f_add_after_boil = (xml->readElementText() == "TRUE") ? true:false; + f->add_after_boil = (xml->readElementText() == "TRUE") ? true:false; } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COLOR")) { - f->f_color = xml->readElementText().toDouble(); + f->color = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "PROTEIN")) { - f->f_protein = xml->readElementText().toDouble(); + f->protein = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "DISSOLVED_PROTEIN")) { - f->f_dissolved_protein = xml->readElementText().toDouble(); + f->dissolved_protein = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "DI_pH")) { - f->f_di_ph = xml->readElementText().toDouble(); + f->di_ph = xml->readElementText().toDouble(); } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ACID_TO_pH_5.7")) { - f->f_acid_to_ph_57 = xml->readElementText().toDouble(); + f->acid_to_ph_57 = xml->readElementText().toDouble(); } else { if (xml->tokenType() == QXmlStreamReader::StartElement) qDebug() << "2 " << xml->tokenType() << xml->name(); diff -r d1d208a857b0 -r 242a68fa7186 src/PrinterDialog.cpp --- a/src/PrinterDialog.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/PrinterDialog.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -388,30 +388,30 @@ double cost_fermentables = 0; QString soort, amount, use; for (int i = 0; i < recipe->fermentables.size(); i++) { - double cost = recipe->fermentables.at(i).f_amount * recipe->fermentables.at(i).f_cost; + double cost = recipe->fermentables.at(i).amount * recipe->fermentables.at(i).cost; cost_fermentables += cost; - if (recipe->fermentables.at(i).f_type == 0) - soort = fermentable_graintypes[recipe->fermentables.at(i).f_graintype]; + if (recipe->fermentables.at(i).type == 0) + soort = fermentable_graintypes[recipe->fermentables.at(i).graintype]; else - soort = fermentable_types[recipe->fermentables.at(i).f_type]; + soort = fermentable_types[recipe->fermentables.at(i).type]; - if (recipe->fermentables.at(i).f_amount > 100) - amount = QString("%1 kg").arg(recipe->fermentables.at(i).f_amount, 1, 'f', 1); - else if (recipe->fermentables.at(i).f_amount > 10) - amount = QString("%1 kg").arg(recipe->fermentables.at(i).f_amount, 1, 'f', 2); + if (recipe->fermentables.at(i).amount > 100) + amount = QString("%1 kg").arg(recipe->fermentables.at(i).amount, 1, 'f', 1); + else if (recipe->fermentables.at(i).amount > 10) + amount = QString("%1 kg").arg(recipe->fermentables.at(i).amount, 1, 'f', 2); else - amount = QString("%1 gr").arg(recipe->fermentables.at(i).f_amount * 1000, 1, 'f', 0); + amount = QString("%1 gr").arg(recipe->fermentables.at(i).amount * 1000, 1, 'f', 0); painter.fillRect( 20, y, 715, 20, f_line); - painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->fermentables.at(i).f_name + - QString(", %1 EBC (").arg(recipe->fermentables.at(i).f_color, 1, 'f', 0) + - recipe->fermentables.at(i).f_supplier + ")"); - painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).f_percentage, 1, 'f', 1)); - painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).f_yield, 1, 'f', 1)); + painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->fermentables.at(i).name + + QString(", %1 EBC (").arg(recipe->fermentables.at(i).color, 1, 'f', 0) + + recipe->fermentables.at(i).supplier + ")"); + painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).percentage, 1, 'f', 1)); + painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).yield, 1, 'f', 1)); painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort); - painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, fermentable_added[recipe->fermentables.at(i).f_added]); + painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, fermentable_added[recipe->fermentables.at(i).added]); 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)); y += 20; @@ -785,33 +785,33 @@ double cost_fermentables = 0; QString soort, amount, use; for (int i = 0; i < product->fermentables.size(); i++) { - double cost = product->fermentables.at(i).f_amount * product->fermentables.at(i).f_cost; + double cost = product->fermentables.at(i).amount * product->fermentables.at(i).cost; cost_fermentables += cost; - if (product->fermentables.at(i).f_type == 0) - soort = fermentable_graintypes[product->fermentables.at(i).f_graintype]; + if (product->fermentables.at(i).type == 0) + soort = fermentable_graintypes[product->fermentables.at(i).graintype]; else - soort = fermentable_types[product->fermentables.at(i).f_type]; + soort = fermentable_types[product->fermentables.at(i).type]; - if (product->fermentables.at(i).f_amount > 100) - amount = QString("%1 kg").arg(product->fermentables.at(i).f_amount, 1, 'f', 1); - else if (product->fermentables.at(i).f_amount > 10) - amount = QString("%1 kg").arg(product->fermentables.at(i).f_amount, 1, 'f', 2); + if (product->fermentables.at(i).amount > 100) + amount = QString("%1 kg").arg(product->fermentables.at(i).amount, 1, 'f', 1); + else if (product->fermentables.at(i).amount > 10) + amount = QString("%1 kg").arg(product->fermentables.at(i).amount, 1, 'f', 2); else - amount = QString("%1 gr").arg(product->fermentables.at(i).f_amount * 1000, 1, 'f', 0); + amount = QString("%1 gr").arg(product->fermentables.at(i).amount * 1000, 1, 'f', 0); painter.fillRect( 20, y, 715, 20, f_line); - painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->fermentables.at(i).f_name + - QString(", %1 EBC (").arg(product->fermentables.at(i).f_color, 1, 'f', 0) + - product->fermentables.at(i).f_supplier + ")"); - if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) - painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).f_percentage, 1, 'f', 1)); + painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->fermentables.at(i).name + + QString(", %1 EBC (").arg(product->fermentables.at(i).color, 1, 'f', 0) + + product->fermentables.at(i).supplier + ")"); + if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) + painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).percentage, 1, 'f', 1)); else painter.drawText(285, y+4, 70, 20, Qt::AlignRight, ""); - painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).f_yield, 1, 'f', 1)); + painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).yield, 1, 'f', 1)); painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort); - painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, fermentable_added[product->fermentables.at(i).f_added]); + painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, fermentable_added[product->fermentables.at(i).added]); 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)); y += 20; @@ -1414,13 +1414,13 @@ QString bsugar = "", ksugar = ""; double bamount = 0, kamount = 0; for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE) { - bsugar = product->fermentables.at(i).f_name; - bamount = product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) { + bsugar = product->fermentables.at(i).name; + bamount = product->fermentables.at(i).amount; } - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) { - ksugar = product->fermentables.at(i).f_name; - kamount = product->fermentables.at(i).f_amount; + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) { + ksugar = product->fermentables.at(i).name; + kamount = product->fermentables.at(i).amount; } } painter.fillRect( 20, y, 330, 20, c_line1); @@ -1612,9 +1612,9 @@ checkHeader(&painter, &y, tr("Weight and mill the malts")); for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { - checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3). - arg(product->fermentables.at(i).f_name).arg(product->fermentables.at(i).f_supplier)); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { + checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).amount * factor, 1, 'f', 3). + arg(product->fermentables.at(i).name).arg(product->fermentables.at(i).supplier)); } } checkLine(&painter, &y, QString(tr("Mill the malts"))); @@ -1674,11 +1674,11 @@ } double est_masg_sg = 0, sugardensity = 1.611, grainabsorbtion = 0; for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { - double d = product->fermentables.at(i).f_amount * factor * (product->fermentables.at(i).f_yield / 100) * - (1 - product->fermentables.at(i).f_moisture / 100); - mvol += product->fermentables.at(i).f_amount * factor * (product->fermentables.at(i).f_moisture / 100); - grainabsorbtion += my_grain_absorbtion * product->fermentables.at(i).f_amount * factor; + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { + double d = product->fermentables.at(i).amount * factor * (product->fermentables.at(i).yield / 100) * + (1 - product->fermentables.at(i).moisture / 100); + mvol += product->fermentables.at(i).amount * factor * (product->fermentables.at(i).moisture / 100); + grainabsorbtion += my_grain_absorbtion * product->fermentables.at(i).amount * factor; msugars += d; } } @@ -1725,7 +1725,7 @@ if (product->brew_cooling_method == 1) lines++; for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOIL) + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) lines++; } for (int i = 0; i < product->hops.size(); i++) { @@ -1751,10 +1751,10 @@ for (int i = product->boil_time; i >= 0; i--) { if (i == 10) { for (int j = 0; j < product->fermentables.size(); j++) { - if (product->fermentables.at(j).f_added == FERMENTABLE_ADDED_BOIL) + if (product->fermentables.at(j).added == FERMENTABLE_ADDED_BOIL) checkLine(&painter, &y, QString(tr("%1 kg `%2` at 10 minutes before end of boil")) - .arg(product->fermentables.at(j).f_amount * factor, 1, 'f', 3) - .arg(product->fermentables.at(j).f_name)); + .arg(product->fermentables.at(j).amount * factor, 1, 'f', 3) + .arg(product->fermentables.at(j).name)); } if (product->brew_cooling_method == 1) checkLine(&painter, &y, QString(tr("Place emersion chiller at 10 minutes before end of boil"))); @@ -1903,7 +1903,7 @@ /* During primary fermentation */ lines = 0; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION) + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION) lines++; for (int i = 0; i < product->miscs.size(); i++) if (product->miscs.at(i).use_use == MISC_USES_PRIMARY) @@ -1918,9 +1918,9 @@ } checkHeader(&painter, &y, tr("Primary fermentation")); for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION) - checkLine(&painter, &y, QString(tr("Add %1 kg `%2` on day 3 or 4")).arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) - .arg(product->fermentables.at(i).f_name)); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION) + checkLine(&painter, &y, QString(tr("Add %1 kg `%2` on day 3 or 4")).arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) + .arg(product->fermentables.at(i).name)); } for (int i = 0; i < product->miscs.size(); i++) { if (product->miscs.at(i).use_use == MISC_USES_PRIMARY) { @@ -1976,7 +1976,7 @@ /* During tertiary fermentation */ lines = 0; for (int i = 0; i < product->fermentables.size(); i++) - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING) + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) lines++; for (int i = 0; i < product->hops.size(); i++) if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP) @@ -1998,9 +1998,9 @@ } checkHeader(&painter, &y, tr("Tertiary fermentation")); for (int i = 0; i < product->fermentables.size(); i++) { - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING) - checkLine(&painter, &y, QString(tr("Add %1 kg `%2`")).arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) - .arg(product->fermentables.at(i).f_name)); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) + checkLine(&painter, &y, QString(tr("Add %1 kg `%2`")).arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) + .arg(product->fermentables.at(i).name)); } for (int i = 0; i < product->hops.size(); i++) { if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP) { @@ -2037,7 +2037,7 @@ /* During packaging */ lines = 0; 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) lines++; for (int i = 0; i < product->miscs.size(); i++) if (product->miscs.at(i).use_use == MISC_USES_BOTTLING) @@ -2055,14 +2055,14 @@ } checkHeader(&painter, &y, tr("Packaging")); 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) checkLine(&painter, &y, QString(tr("Bottling add %1 kg `%2` with %3 liter water")) - .arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) - .arg(product->fermentables.at(i).f_name).arg(product->bottle_priming_water * factor, 1, 'f', 3)); - if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) + .arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) + .arg(product->fermentables.at(i).name).arg(product->bottle_priming_water * factor, 1, 'f', 3)); + if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) checkLine(&painter, &y, QString(tr("Kegging add %1 kg `%2` with %3 liter water")) - .arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) - .arg(product->fermentables.at(i).f_name).arg(product->keg_priming_water * factor, 1, 'f', 3)); + .arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) + .arg(product->fermentables.at(i).name).arg(product->keg_priming_water * factor, 1, 'f', 3)); } for (int i = 0; i < product->yeasts.size(); i++) { if (product->yeasts.at(i).y_use == YEAST_USE_BOTTLE) { diff -r d1d208a857b0 -r 242a68fa7186 src/database/db_product.cpp --- a/src/database/db_product.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/database/db_product.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -277,42 +277,42 @@ for (int i = 0; i < fermentables.array().size(); i++) { QJsonObject obj = fermentables.array().at(i).toObject(); Fermentables f; - f.f_inventory = 0; - f.f_avail = false; - f.f_name = obj["f_name"].toString(); - f.f_origin = obj["f_origin"].toString(); - f.f_supplier = obj["f_supplier"].toString(); - f.f_amount = obj["f_amount"].toDouble(); - f.f_cost = obj["f_cost"].toDouble(); - f.f_type = obj["f_type"].toInt(); - f.f_yield = obj["f_yield"].toDouble(); - f.f_color = obj["f_color"].toDouble(); - f.f_coarse_fine_diff = obj["f_coarse_fine_diff"].toDouble(); - f.f_moisture = obj["f_moisture"].toDouble(); - f.f_diastatic_power = obj["f_diastatic_power"].toDouble(); - f.f_protein = obj["f_protein"].toDouble(); - f.f_dissolved_protein = obj["f_dissolved_protein"].toDouble(); - f.f_max_in_batch = obj["f_max_in_batch"].toDouble(); - f.f_graintype = obj["f_graintype"].toInt(); - f.f_added = obj["f_added"].toInt(); - f.f_recommend_mash = obj["f_recommend_mash"].toInt() ? true:false; - f.f_add_after_boil = obj["f_add_after_boil"].toInt() ? true:false; - f.f_adjust_to_total_100 = obj["f_adjust_to_total_100"].toInt() ? true:false; - f.f_percentage = obj["f_percentage"].toDouble(); - f.f_di_ph = obj["f_di_ph"].toDouble(); - f.f_acid_to_ph_57 = obj["f_acid_to_ph_57"].toDouble(); - if (f.f_adjust_to_total_100) + f.inventory = 0; + f.avail = false; + f.name = obj["f_name"].toString(); + f.origin = obj["f_origin"].toString(); + f.supplier = obj["f_supplier"].toString(); + f.amount = obj["f_amount"].toDouble(); + f.cost = obj["f_cost"].toDouble(); + f.type = obj["f_type"].toInt(); + f.yield = obj["f_yield"].toDouble(); + f.color = obj["f_color"].toDouble(); + f.coarse_fine_diff = obj["f_coarse_fine_diff"].toDouble(); + f.moisture = obj["f_moisture"].toDouble(); + f.diastatic_power = obj["f_diastatic_power"].toDouble(); + f.protein = obj["f_protein"].toDouble(); + f.dissolved_protein = obj["f_dissolved_protein"].toDouble(); + f.max_in_batch = obj["f_max_in_batch"].toDouble(); + f.graintype = obj["f_graintype"].toInt(); + f.added = obj["f_added"].toInt(); + f.recommend_mash = obj["f_recommend_mash"].toInt() ? true:false; + f.add_after_boil = obj["f_add_after_boil"].toInt() ? true:false; + f.adjust_to_total_100 = obj["f_adjust_to_total_100"].toInt() ? true:false; + f.percentage = obj["f_percentage"].toDouble(); + f.di_ph = obj["f_di_ph"].toDouble(); + f.acid_to_ph_57 = obj["f_acid_to_ph_57"].toDouble(); + if (f.adjust_to_total_100) prod->fermentables_use100 = true; - percentcheck += f.f_percentage; + percentcheck += f.percentage; /* Check and update inventory */ yquery.prepare("SELECT inventory FROM inventory_fermentables WHERE name=:name AND supplier=:supplier AND origin=:origin"); - yquery.bindValue(":name", f.f_name); - yquery.bindValue(":supplier", f.f_supplier); - yquery.bindValue(":origin", f.f_origin); + yquery.bindValue(":name", f.name); + yquery.bindValue(":supplier", f.supplier); + yquery.bindValue(":origin", f.origin); yquery.exec(); if (yquery.first()) { - f.f_avail = true; - f.f_inventory = yquery.value(0).toDouble(); + f.avail = true; + f.inventory = yquery.value(0).toDouble(); } prod->fermentables.append(f); } @@ -321,12 +321,12 @@ /* Missing percentages, fix it. */ double total = 0; for (int i = 0; i < prod->fermentables.size(); i++) { - if (prod->fermentables.at(i).f_added < 4) - total += prod->fermentables.at(i).f_amount; + if (prod->fermentables.at(i).added < 4) + total += prod->fermentables.at(i).amount; } for (int i = 0; i < prod->fermentables.size(); i++) { - if (prod->fermentables.at(i).f_added < 4) - prod->fermentables[i].f_percentage = round((prod->fermentables.at(i).f_amount / total) * 10000.0) / 100.0; + if (prod->fermentables.at(i).added < 4) + prod->fermentables[i].percentage = round((prod->fermentables.at(i).amount / total) * 10000.0) / 100.0; } qInfo() << " fixed missing percentages"; // is_changed(); @@ -839,28 +839,28 @@ QJsonArray array; for (int i = 0; i < prod->fermentables.size(); i++) { QJsonObject obj; - obj.insert("f_name", prod->fermentables.at(i).f_name); - obj.insert("f_origin", prod->fermentables.at(i).f_origin); - obj.insert("f_supplier", prod->fermentables.at(i).f_supplier); - obj.insert("f_amount", round(prod->fermentables.at(i).f_amount * 100000) / 100000); - obj.insert("f_cost", round(prod->fermentables.at(i).f_cost * 1000) / 1000); - obj.insert("f_type", prod->fermentables.at(i).f_type); - obj.insert("f_yield", round(prod->fermentables.at(i).f_yield * 10) / 10); - obj.insert("f_color", round(prod->fermentables.at(i).f_color * 10) / 10); - obj.insert("f_coarse_fine_diff", round(prod->fermentables.at(i).f_coarse_fine_diff * 10) / 10); - obj.insert("f_moisture", round(prod->fermentables.at(i).f_moisture * 10) / 10); - obj.insert("f_diastatic_power", round(prod->fermentables.at(i).f_diastatic_power * 100000) / 100000); - obj.insert("f_protein", round(prod->fermentables.at(i).f_protein * 10) / 10); - obj.insert("f_dissolved_protein", round(prod->fermentables.at(i).f_dissolved_protein * 10) / 10); - obj.insert("f_max_in_batch", prod->fermentables.at(i).f_max_in_batch); - obj.insert("f_graintype", prod->fermentables.at(i).f_graintype); - obj.insert("f_added", prod->fermentables.at(i).f_added); - obj.insert("f_recommend_mash", prod->fermentables.at(i).f_recommend_mash ? 1:0); - obj.insert("f_add_after_boil", prod->fermentables.at(i).f_add_after_boil ? 1:0); - obj.insert("f_adjust_to_total_100", prod->fermentables.at(i).f_adjust_to_total_100 ? 1:0); - obj.insert("f_percentage", round(prod->fermentables.at(i).f_percentage * 10) / 10); - obj.insert("f_di_ph", round(prod->fermentables.at(i).f_di_ph * 100000) / 100000); - obj.insert("f_acid_to_ph_57", round(prod->fermentables.at(i).f_acid_to_ph_57 * 100000) / 100000); + obj.insert("f_name", prod->fermentables.at(i).name); + obj.insert("f_origin", prod->fermentables.at(i).origin); + obj.insert("f_supplier", prod->fermentables.at(i).supplier); + obj.insert("f_amount", round(prod->fermentables.at(i).amount * 100000) / 100000); + obj.insert("f_cost", round(prod->fermentables.at(i).cost * 1000) / 1000); + obj.insert("f_type", prod->fermentables.at(i).type); + obj.insert("f_yield", round(prod->fermentables.at(i).yield * 10) / 10); + obj.insert("f_color", round(prod->fermentables.at(i).color * 10) / 10); + obj.insert("f_coarse_fine_diff", round(prod->fermentables.at(i).coarse_fine_diff * 10) / 10); + obj.insert("f_moisture", round(prod->fermentables.at(i).moisture * 10) / 10); + obj.insert("f_diastatic_power", round(prod->fermentables.at(i).diastatic_power * 100000) / 100000); + obj.insert("f_protein", round(prod->fermentables.at(i).protein * 10) / 10); + obj.insert("f_dissolved_protein", round(prod->fermentables.at(i).dissolved_protein * 10) / 10); + obj.insert("f_max_in_batch", prod->fermentables.at(i).max_in_batch); + obj.insert("f_graintype", prod->fermentables.at(i).graintype); + obj.insert("f_added", prod->fermentables.at(i).added); + obj.insert("f_recommend_mash", prod->fermentables.at(i).recommend_mash ? 1:0); + obj.insert("f_add_after_boil", prod->fermentables.at(i).add_after_boil ? 1:0); + obj.insert("f_adjust_to_total_100", prod->fermentables.at(i).adjust_to_total_100 ? 1:0); + obj.insert("f_percentage", round(prod->fermentables.at(i).percentage * 10) / 10); + obj.insert("f_di_ph", round(prod->fermentables.at(i).di_ph * 100000) / 100000); + obj.insert("f_acid_to_ph_57", round(prod->fermentables.at(i).acid_to_ph_57 * 100000) / 100000); // qDebug() << "fermentables_Json" << i << obj; array.append(obj); /* Append this object */ } diff -r d1d208a857b0 -r 242a68fa7186 src/database/db_recipe.cpp --- a/src/database/db_recipe.cpp Mon Jun 13 15:47:16 2022 +0200 +++ b/src/database/db_recipe.cpp Mon Jun 13 16:47:52 2022 +0200 @@ -138,43 +138,43 @@ for (int i = 0; i < fermentables.array().size(); i++) { QJsonObject obj = fermentables.array().at(i).toObject(); Fermentables f; - f.f_name = obj["f_name"].toString(); - f.f_origin = obj["f_origin"].toString(); - f.f_supplier = obj["f_supplier"].toString(); - f.f_amount = obj["f_amount"].toDouble(); - f.f_cost = obj["f_cost"].toDouble(); - f.f_type = obj["f_type"].toInt(); - f.f_yield = obj["f_yield"].toDouble(); - f.f_color = obj["f_color"].toDouble(); - f.f_coarse_fine_diff = obj["f_coarse_fine_diff"].toDouble(); - f.f_moisture = obj["f_moisture"].toDouble(); - f.f_diastatic_power = obj["f_diastatic_power"].toDouble(); - f.f_protein = obj["f_protein"].toDouble(); - f.f_dissolved_protein = obj["f_dissolved_protein"].toDouble(); - f.f_max_in_batch = obj["f_max_in_batch"].toDouble(); - f.f_graintype = obj["f_graintype"].toInt(); - f.f_added = obj["f_added"].toInt(); - f.f_recommend_mash = obj["f_recommend_mash"].toInt() ? true:false; - f.f_add_after_boil = obj["f_add_after_boil"].toInt() ? true:false; - f.f_adjust_to_total_100 = obj["f_adjust_to_total_100"].toInt() ? true:false; - f.f_percentage = obj["f_percentage"].toDouble(); - f.f_di_ph = obj["f_di_ph"].toDouble(); - f.f_acid_to_ph_57 = obj["f_acid_to_ph_57"].toDouble(); - if (f.f_adjust_to_total_100) + f.name = obj["f_name"].toString(); + f.origin = obj["f_origin"].toString(); + f.supplier = obj["f_supplier"].toString(); + f.amount = obj["f_amount"].toDouble(); + f.cost = obj["f_cost"].toDouble(); + f.type = obj["f_type"].toInt(); + f.yield = obj["f_yield"].toDouble(); + f.color = obj["f_color"].toDouble(); + f.coarse_fine_diff = obj["f_coarse_fine_diff"].toDouble(); + f.moisture = obj["f_moisture"].toDouble(); + f.diastatic_power = obj["f_diastatic_power"].toDouble(); + f.protein = obj["f_protein"].toDouble(); + f.dissolved_protein = obj["f_dissolved_protein"].toDouble(); + f.max_in_batch = obj["f_max_in_batch"].toDouble(); + f.graintype = obj["f_graintype"].toInt(); + f.added = obj["f_added"].toInt(); + f.recommend_mash = obj["f_recommend_mash"].toInt() ? true:false; + f.add_after_boil = obj["f_add_after_boil"].toInt() ? true:false; + f.adjust_to_total_100 = obj["f_adjust_to_total_100"].toInt() ? true:false; + f.percentage = obj["f_percentage"].toDouble(); + f.di_ph = obj["f_di_ph"].toDouble(); + f.acid_to_ph_57 = obj["f_acid_to_ph_57"].toDouble(); + if (f.adjust_to_total_100) reci->fermentables_use100 = true; - percentcheck += f.f_percentage; + percentcheck += f.percentage; reci->fermentables.append(f); } if (percentcheck == 0) { /* Missing percentages, fix it. */ double total = 0; for (int i = 0; i < reci->fermentables.size(); i++) { - if (reci->fermentables.at(i).f_added < 4) - total += reci->fermentables.at(i).f_amount; + if (reci->fermentables.at(i).added < 4) + total += reci->fermentables.at(i).amount; } for (int i = 0; i < reci->fermentables.size(); i++) { - if (reci->fermentables.at(i).f_added < 4) - reci->fermentables[i].f_percentage = round((reci->fermentables.at(i).f_amount / total) * 10000.0) / 100.0; + if (reci->fermentables.at(i).added < 4) + reci->fermentables[i].percentage = round((reci->fermentables.at(i).amount / total) * 10000.0) / 100.0; } qInfo() << "fixed missing percentages"; } @@ -485,28 +485,28 @@ QJsonArray array; for (int i = 0; i < reci->fermentables.size(); i++) { QJsonObject obj; - obj.insert("f_name", reci->fermentables.at(i).f_name); - obj.insert("f_origin", reci->fermentables.at(i).f_origin); - obj.insert("f_supplier", reci->fermentables.at(i).f_supplier); - obj.insert("f_amount", round(reci->fermentables.at(i).f_amount * 10000) / 10000); - obj.insert("f_cost", round(reci->fermentables.at(i).f_cost * 1000) / 1000); - obj.insert("f_type", reci->fermentables.at(i).f_type); - obj.insert("f_yield", round(reci->fermentables.at(i).f_yield * 10) / 10); - obj.insert("f_color", round(reci->fermentables.at(i).f_color * 10) / 10); - obj.insert("f_coarse_fine_diff", round(reci->fermentables.at(i).f_coarse_fine_diff * 10) / 10); - obj.insert("f_moisture", round(reci->fermentables.at(i).f_moisture * 10) / 10); - obj.insert("f_diastatic_power", round(reci->fermentables.at(i).f_diastatic_power * 100000) / 100000); - obj.insert("f_protein", round(reci->fermentables.at(i).f_protein * 10) / 10); - obj.insert("f_dissolved_protein", round(reci->fermentables.at(i).f_dissolved_protein * 10) / 10); - obj.insert("f_max_in_batch", reci->fermentables.at(i).f_max_in_batch); - obj.insert("f_graintype", reci->fermentables.at(i).f_graintype); - obj.insert("f_added", reci->fermentables.at(i).f_added); - obj.insert("f_recommend_mash", reci->fermentables.at(i).f_recommend_mash ? 1:0); - obj.insert("f_add_after_boil", reci->fermentables.at(i).f_add_after_boil ? 1:0); - obj.insert("f_adjust_to_total_100", reci->fermentables.at(i).f_adjust_to_total_100 ? 1:0); - obj.insert("f_percentage", round(reci->fermentables.at(i).f_percentage * 10) / 10); - obj.insert("f_di_ph", round(reci->fermentables.at(i).f_di_ph * 100000) / 100000); - obj.insert("f_acid_to_ph_57", round(reci->fermentables.at(i).f_acid_to_ph_57 * 100000) / 100000); + obj.insert("f_name", reci->fermentables.at(i).name); + obj.insert("f_origin", reci->fermentables.at(i).origin); + obj.insert("f_supplier", reci->fermentables.at(i).supplier); + obj.insert("f_amount", round(reci->fermentables.at(i).amount * 10000) / 10000); + obj.insert("f_cost", round(reci->fermentables.at(i).cost * 1000) / 1000); + obj.insert("f_type", reci->fermentables.at(i).type); + obj.insert("f_yield", round(reci->fermentables.at(i).yield * 10) / 10); + obj.insert("f_color", round(reci->fermentables.at(i).color * 10) / 10); + obj.insert("f_coarse_fine_diff", round(reci->fermentables.at(i).coarse_fine_diff * 10) / 10); + obj.insert("f_moisture", round(reci->fermentables.at(i).moisture * 10) / 10); + obj.insert("f_diastatic_power", round(reci->fermentables.at(i).diastatic_power * 100000) / 100000); + obj.insert("f_protein", round(reci->fermentables.at(i).protein * 10) / 10); + obj.insert("f_dissolved_protein", round(reci->fermentables.at(i).dissolved_protein * 10) / 10); + obj.insert("f_max_in_batch", reci->fermentables.at(i).max_in_batch); + obj.insert("f_graintype", reci->fermentables.at(i).graintype); + obj.insert("f_added", reci->fermentables.at(i).added); + obj.insert("f_recommend_mash", reci->fermentables.at(i).recommend_mash ? 1:0); + obj.insert("f_add_after_boil", reci->fermentables.at(i).add_after_boil ? 1:0); + obj.insert("f_adjust_to_total_100", reci->fermentables.at(i).adjust_to_total_100 ? 1:0); + obj.insert("f_percentage", round(reci->fermentables.at(i).percentage * 10) / 10); + obj.insert("f_di_ph", round(reci->fermentables.at(i).di_ph * 100000) / 100000); + obj.insert("f_acid_to_ph_57", round(reci->fermentables.at(i).acid_to_ph_57 * 100000) / 100000); array.append(obj); /* Append this object */ } QJsonDocument doc; diff -r d1d208a857b0 -r 242a68fa7186 src/global.h --- a/src/global.h Mon Jun 13 15:47:16 2022 +0200 +++ b/src/global.h Mon Jun 13 16:47:52 2022 +0200 @@ -51,6 +51,9 @@ /* * Fermentables, Hops, Miscs, Yeasts and Mashs are stored in the * database in json arrays. These are the QList structures. + * For some purposes there are more fields then needed in these + * structures such as for inventory database i/o. + * Just use what is needed. */ struct Fermentables {