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; } } }