diff -r af3dac6ff6c3 -r d1d208a857b0 src/EditProductTab4.cpp --- a/src/EditProductTab4.cpp Mon Jun 13 12:26:27 2022 +0200 +++ b/src/EditProductTab4.cpp Mon Jun 13 15:47:16 2022 +0200 @@ -21,17 +21,17 @@ bool EditProduct::hop_sort_test(const Hops &D1, const Hops &D2) { - if (D1.h_useat > D2.h_useat) + if (D1.useat > D2.useat) return false; - if (D1.h_useat < D2.h_useat) + if (D1.useat < D2.useat) return true; /* Same useat moments, test time. */ - if (D1.h_time < D2.h_time) + if (D1.time < D2.time) return false; - if (D1.h_time > D2.h_time) + if (D1.time > D2.time) return true; /* Finally consider the amounts */ - return (D1.h_amount > D2.h_amount); + return (D1.amount > D2.amount); } @@ -67,57 +67,57 @@ for (int i = 0; i < product->hops.size(); i++) { - ui->hopsTable->setItem(i, 0, new QTableWidgetItem(product->hops.at(i).h_origin)); - ui->hopsTable->setItem(i, 1, new QTableWidgetItem(product->hops.at(i).h_name)); + ui->hopsTable->setItem(i, 0, new QTableWidgetItem(product->hops.at(i).origin)); + ui->hopsTable->setItem(i, 1, new QTableWidgetItem(product->hops.at(i).name)); - item = new QTableWidgetItem(hop_types[product->hops.at(i).h_type]); + item = new QTableWidgetItem(hop_types[product->hops.at(i).type]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->hopsTable->setItem(i, 2, item); - item = new QTableWidgetItem(hop_forms[product->hops.at(i).h_form]); + item = new QTableWidgetItem(hop_forms[product->hops.at(i).form]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->hopsTable->setItem(i, 3, item); - item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(i).h_alpha, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(i).alpha, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(i, 4, item); - item = new QTableWidgetItem(hop_useat[product->hops.at(i).h_useat]); + item = new QTableWidgetItem(hop_useat[product->hops.at(i).useat]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->hopsTable->setItem(i, 5, item); - if (product->hops.at(i).h_useat == 2 || product->hops.at(i).h_useat == 4) { // Boil or whirlpool - item = new QTableWidgetItem(QString("%1 min.").arg(product->hops.at(i).h_time, 1, 'f', 0, '0')); - } else if (product->hops.at(i).h_useat == 5) { // Dry-hop - item = new QTableWidgetItem(QString("%1 days.").arg(product->hops.at(i).h_time / 1440, 1, 'f', 0, '0')); + if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4) { // Boil or whirlpool + item = new QTableWidgetItem(QString("%1 min.").arg(product->hops.at(i).time, 1, 'f', 0, '0')); + } else if (product->hops.at(i).useat == 5) { // Dry-hop + item = new QTableWidgetItem(QString("%1 days.").arg(product->hops.at(i).time / 1440, 1, 'f', 0, '0')); } else { item = new QTableWidgetItem(QString("")); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(i, 6, item); - double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size, - product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, + double ibu = Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->batch_size, + product->hops.at(i).amount, product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(i, 7, item); - if (product->hops.at(i).h_amount < 1.0) { - item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(i).h_amount * 1000.0, 2, 'f', 1, '0')); + if (product->hops.at(i).amount < 1.0) { + item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(i).amount * 1000.0, 2, 'f', 1, '0')); } else { - item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(i).h_amount, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(i).amount, 4, 'f', 3, '0')); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(i, 8, item); - if (product->hops.at(i).h_inventory < 1.0) { - item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(i).h_inventory * 1000.0, 2, 'f', 1, '0')); + if (product->hops.at(i).inventory < 1.0) { + item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(i).inventory * 1000.0, 2, 'f', 1, '0')); } else { - item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(i).h_inventory, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(i).inventory, 4, 'f', 3, '0')); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); - if (product->hops.at(i).h_inventory < product->hops.at(i).h_amount) + if (product->hops.at(i).inventory < product->hops.at(i).amount) item->setForeground(QBrush(QColor(Qt::red))); ui->hopsTable->setItem(i, 9, item); @@ -234,20 +234,20 @@ product->hops_ok = true; for (int i = 0; i < product->hops.size(); i++) { - ibus += Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, - product->batch_size, product->hops.at(i).h_amount, - product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, + ibus += Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, + product->batch_size, product->hops.at(i).amount, + product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); - ferm_ibus += Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, - product->brew_fermenter_volume + product->brew_fermenter_tcloss, product->hops.at(i).h_amount, - product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, + ferm_ibus += Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, + product->brew_fermenter_volume + product->brew_fermenter_tcloss, product->hops.at(i).amount, + product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); - hop_flavour += Utils::hopFlavourContribution(product->hops.at(i).h_time, product->batch_size, product->hops.at(i).h_useat, product->hops.at(i).h_amount); - hop_aroma += Utils::hopAromaContribution(product->hops.at(i).h_time, product->batch_size, product->hops.at(i).h_useat, product->hops.at(i).h_amount); - if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->hops.at(i).h_useat <= HOP_USEAT_WHIRLPOOL)) || - ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP))) && - (product->hops.at(i).h_inventory < product->hops.at(i).h_amount)) + hop_flavour += Utils::hopFlavourContribution(product->hops.at(i).time, product->batch_size, product->hops.at(i).useat, product->hops.at(i).amount); + hop_aroma += Utils::hopAromaContribution(product->hops.at(i).time, product->batch_size, product->hops.at(i).useat, product->hops.at(i).amount); + if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->hops.at(i).useat <= HOP_USEAT_WHIRLPOOL)) || + ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->hops.at(i).useat == HOP_USEAT_DRY_HOP))) && + (product->hops.at(i).inventory < product->hops.at(i).amount)) product->hops_ok = false; } @@ -278,27 +278,27 @@ qDebug() << "Add hop row"; for (int i = 0; i < product->hops.size(); i++) { - if (product->hops.at(i).h_amount == 0 && product->hops.at(i).h_alpha == 0) + if (product->hops.at(i).amount == 0 && product->hops.at(i).alpha == 0) return; // Add only one at a time. } - newh.h_name = "Select one"; - newh.h_origin = ""; - newh.h_amount = 0; - newh.h_cost = 0; - newh.h_type = HOP_TYPE_BITTERING; - newh.h_form = HOP_FORMS_PELLET; - newh.h_useat = HOP_USEAT_BOIL; - newh.h_time = 0; - newh.h_alpha = 0; - newh.h_beta = 0; - newh.h_hsi = 0; - newh.h_humulene = 0; - newh.h_caryophyllene = 0; - newh.h_cohumulone = 0; - newh.h_myrcene = 0; - newh.h_total_oil = 0; - newh.h_inventory = 0; + newh.name = "Select one"; + newh.origin = ""; + newh.amount = 0; + newh.cost = 0; + newh.type = HOP_TYPE_BITTERING; + newh.form = HOP_FORMS_PELLET; + newh.useat = HOP_USEAT_BOIL; + newh.time = 0; + newh.alpha = 0; + newh.beta = 0; + newh.hsi = 0; + newh.humulene = 0; + newh.caryophyllene = 0; + newh.cohumulone = 0; + newh.myrcene = 0; + newh.total_oil = 0; + newh.inventory = 0; product->hops.append(newh); emit refreshAll(); @@ -314,7 +314,7 @@ int row = pb->objectName().toInt(); qDebug() << "Delete hop row" << row << product->hops.size(); - int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(product->hops.at(row).h_name), + int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(product->hops.at(row).name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (rc == QMessageBox::No) return; @@ -331,14 +331,14 @@ qDebug() << "hop_amount_changed()" << product->hops_row << val; - product->hops[product->hops_row].h_amount = val / 1000.0; + product->hops[product->hops_row].amount = val / 1000.0; item = new QTableWidgetItem(QString("%1 gr").arg(val, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 8, item); - double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, - product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, - product->hops.at(product->hops_row).h_alpha, product->ibu_method, + double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, + product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, + product->hops.at(product->hops_row).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); ibuEdit->setValue(ibu); @@ -357,22 +357,22 @@ qDebug() << "hop_time_changed()" << product->hops_row << val; - if (product->hops.at(product->hops_row).h_useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).h_useat == HOP_USEAT_WHIRLPOOL) { + if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) { item = new QTableWidgetItem(QString("%1 min.").arg(val, 1, 'f', 0, '0')); - product->hops[product->hops_row].h_time = val; - } else if (product->hops.at(product->hops_row).h_useat == HOP_USEAT_DRY_HOP) { + product->hops[product->hops_row].time = val; + } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) { item = new QTableWidgetItem(QString("%1 days.").arg(val, 1, 'f', 0, '0')); - product->hops[product->hops_row].h_time = val * 1440; + product->hops[product->hops_row].time = val * 1440; } else { item = new QTableWidgetItem(QString("")); - product->hops[product->hops_row].h_time = val; + product->hops[product->hops_row].time = val; } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 6, item); - double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, - product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, - product->hops.at(product->hops_row).h_alpha, product->ibu_method, + double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, + product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, + product->hops.at(product->hops_row).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); ibuEdit->setValue(ibu); @@ -414,45 +414,45 @@ /* * Replace the hop record contents */ - product->hops[product->hops_row].h_name = query.value(0).toString(); - product->hops[product->hops_row].h_origin = query.value(1).toString(); - product->hops[product->hops_row].h_alpha = query.value(2).toDouble(); - product->hops[product->hops_row].h_beta = query.value(3).toDouble(); - product->hops[product->hops_row].h_humulene = query.value(4).toDouble(); - product->hops[product->hops_row].h_caryophyllene = query.value(5).toDouble(); - product->hops[product->hops_row].h_cohumulone = query.value(6).toDouble(); - product->hops[product->hops_row].h_myrcene = query.value(7).toDouble(); - product->hops[product->hops_row].h_hsi = query.value(8).toDouble(); - product->hops[product->hops_row].h_total_oil = query.value(9).toDouble(); - product->hops[product->hops_row].h_type = query.value(10).toInt(); - product->hops[product->hops_row].h_form = query.value(11).toInt(); - product->hops[product->hops_row].h_cost = query.value(12).toDouble(); - product->hops[product->hops_row].h_inventory = query.value(13).toDouble(); + product->hops[product->hops_row].name = query.value(0).toString(); + product->hops[product->hops_row].origin = query.value(1).toString(); + product->hops[product->hops_row].alpha = query.value(2).toDouble(); + product->hops[product->hops_row].beta = query.value(3).toDouble(); + product->hops[product->hops_row].humulene = query.value(4).toDouble(); + product->hops[product->hops_row].caryophyllene = query.value(5).toDouble(); + product->hops[product->hops_row].cohumulone = query.value(6).toDouble(); + product->hops[product->hops_row].myrcene = query.value(7).toDouble(); + product->hops[product->hops_row].hsi = query.value(8).toDouble(); + product->hops[product->hops_row].total_oil = query.value(9).toDouble(); + product->hops[product->hops_row].type = query.value(10).toInt(); + product->hops[product->hops_row].form = query.value(11).toInt(); + product->hops[product->hops_row].cost = query.value(12).toDouble(); + product->hops[product->hops_row].inventory = query.value(13).toDouble(); /* * Update the visible fields */ - hnameEdit->setText(product->hops.at(product->hops_row).h_name); - horiginEdit->setText(product->hops.at(product->hops_row).h_origin); + hnameEdit->setText(product->hops.at(product->hops_row).name); + horiginEdit->setText(product->hops.at(product->hops_row).origin); - double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, - product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, - product->hops.at(product->hops_row).h_alpha, product->ibu_method, + double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, + product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, + product->hops.at(product->hops_row).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); ibuEdit->setValue(ibu); - ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).h_origin)); - ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).h_name)); + ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).origin)); + ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).name)); - item = new QTableWidgetItem(hop_types[product->hops.at(product->hops_row).h_type]); + item = new QTableWidgetItem(hop_types[product->hops.at(product->hops_row).type]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 2, item); - item = new QTableWidgetItem(hop_forms[product->hops.at(product->hops_row).h_form]); + item = new QTableWidgetItem(hop_forms[product->hops.at(product->hops_row).form]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 3, item); - item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(product->hops_row).h_alpha, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(product->hops_row).alpha, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 4, item); @@ -460,13 +460,13 @@ item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 7, item); - if (product->hops.at(product->hops_row).h_inventory < 1.0) { - item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(product->hops_row).h_inventory * 1000.0, 2, 'f', 1, '0')); + if (product->hops.at(product->hops_row).inventory < 1.0) { + item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(product->hops_row).inventory * 1000.0, 2, 'f', 1, '0')); } else { - item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(product->hops_row).h_inventory, 4, 'f', 3, '0')); + item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(product->hops_row).inventory, 4, 'f', 3, '0')); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); - if (product->hops.at(product->hops_row).h_inventory < product->hops.at(product->hops_row).h_amount) + if (product->hops.at(product->hops_row).inventory < product->hops.at(product->hops_row).amount) item->setForeground(QBrush(QColor(Qt::red))); ui->hopsTable->setItem(product->hops_row, 9, item); @@ -503,18 +503,18 @@ { qDebug() << "hop_useat_changed()" << product->hops_row << val; - product->hops[product->hops_row].h_useat = val; + product->hops[product->hops_row].useat = val; QTableWidgetItem *item = new QTableWidgetItem(hop_useat[val]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->hopsTable->setItem(product->hops_row, 5, item); if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) { htimeLabel->setText(tr("Time in minutes:")); - htimeEdit->setValue(product->hops.at(product->hops_row).h_time); + htimeEdit->setValue(product->hops.at(product->hops_row).time); htimeEdit->setReadOnly(false); } else if (val == HOP_USEAT_DRY_HOP) { htimeLabel->setText(tr("Time in days:")); - htimeEdit->setValue(product->hops.at(product->hops_row).h_time / 1440); + htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440); htimeEdit->setReadOnly(false); } else { htimeLabel->setText(""); @@ -565,9 +565,9 @@ amountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); htimeLabel = new QLabel(dialog); htimeLabel->setObjectName(QString::fromUtf8("htimeLabel")); - if (product->hops.at(product->hops_row).h_useat == 5) // Dry-hop + if (product->hops.at(product->hops_row).useat == 5) // Dry-hop htimeLabel->setText(tr("Time in days:")); - else if (product->hops.at(product->hops_row).h_useat == 2 || product->hops.at(product->hops_row).h_useat == 4) // Boil or whirlpool + else if (product->hops.at(product->hops_row).useat == 2 || product->hops.at(product->hops_row).useat == 4) // Boil or whirlpool htimeLabel->setText(tr("Time in minutes:")); else htimeLabel->setText(""); @@ -601,12 +601,12 @@ hnameEdit = new QLineEdit(dialog); hnameEdit->setObjectName(QString::fromUtf8("hnameEdit")); - hnameEdit->setText(product->hops.at(product->hops_row).h_name); + hnameEdit->setText(product->hops.at(product->hops_row).name); hnameEdit->setGeometry(QRect(160, 10, 511, 23)); hnameEdit->setReadOnly(true); horiginEdit = new QLineEdit(dialog); horiginEdit->setObjectName(QString::fromUtf8("horiginEdit")); - horiginEdit->setText(product->hops.at(product->hops_row).h_origin); + horiginEdit->setText(product->hops.at(product->hops_row).origin); horiginEdit->setGeometry(QRect(160, 40, 511, 23)); horiginEdit->setReadOnly(true); hamountEdit = new QDoubleSpinBox(dialog); @@ -617,18 +617,18 @@ hamountEdit->setDecimals(1); hamountEdit->setMaximum(1000000.0); hamountEdit->setSingleStep(0.5); - hamountEdit->setValue(product->hops.at(product->hops_row).h_amount * 1000.0); + hamountEdit->setValue(product->hops.at(product->hops_row).amount * 1000.0); htimeEdit = new QSpinBox(dialog); htimeEdit->setObjectName(QString::fromUtf8("htimeEdit")); htimeEdit->setGeometry(QRect(160, 130, 121, 24)); htimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); htimeEdit->setAccelerated(true); htimeEdit->setMaximum(10000.0); - if (product->hops.at(product->hops_row).h_useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).h_useat == HOP_USEAT_WHIRLPOOL) { - htimeEdit->setValue(product->hops.at(product->hops_row).h_time); + if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) { + htimeEdit->setValue(product->hops.at(product->hops_row).time); htimeEdit->setReadOnly(false); - } else if (product->hops.at(product->hops_row).h_useat == HOP_USEAT_DRY_HOP) { - htimeEdit->setValue(product->hops.at(product->hops_row).h_time / 1440); + } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) { + htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440); htimeEdit->setReadOnly(false); } else { htimeEdit->setReadOnly(true); @@ -642,7 +642,7 @@ useatEdit->addItem(tr("Aroma")); useatEdit->addItem(tr("Whirlpool")); useatEdit->addItem(tr("Dry hop")); - useatEdit->setCurrentIndex(product->hops.at(product->hops_row).h_useat); + useatEdit->setCurrentIndex(product->hops.at(product->hops_row).useat); hinstockEdit = new QCheckBox(dialog); hinstockEdit->setObjectName(QString::fromUtf8("hinstockEdit")); @@ -656,9 +656,9 @@ ibuEdit->setReadOnly(true); ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); ibuEdit->setDecimals(1); - double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, - product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, - product->hops.at(product->hops_row).h_alpha, product->ibu_method, + double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, + product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, + product->hops.at(product->hops_row).alpha, product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); ibuEdit->setValue(ibu); @@ -679,11 +679,11 @@ product->hops[product->hops_row] = backup; } else { /* Clear time if hop is not used for boil, whirlpool or dry-hop. */ - if (! (product->hops.at(product->hops_row).h_useat == HOP_USEAT_BOIL || - product->hops.at(product->hops_row).h_useat == HOP_USEAT_WHIRLPOOL || - product->hops.at(product->hops_row).h_useat == HOP_USEAT_DRY_HOP)) { - if (product->hops.at(product->hops_row).h_time) { - product->hops[product->hops_row].h_time = 0; + if (! (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || + product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL || + product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP)) { + if (product->hops.at(product->hops_row).time) { + product->hops[product->hops_row].time = 0; is_changed(); } } @@ -708,8 +708,8 @@ return; for (int i = 0; i < product->hops.size(); i++) { - amount = product->hops.at(i).h_amount * factor; - product->hops[i].h_amount = amount; + amount = product->hops.at(i).amount * factor; + product->hops[i].amount = amount; } }