94 item = new QTableWidgetItem(QString("")); |
94 item = new QTableWidgetItem(QString("")); |
95 } |
95 } |
96 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
96 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
97 ui->hopsTable->setItem(i, 6, item); |
97 ui->hopsTable->setItem(i, 6, item); |
98 |
98 |
99 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, |
99 double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size, |
100 product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, 0, product->hops.at(i).h_time, 0); |
100 product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, |
|
101 0, product->hops.at(i).h_time, 0, product->boil_time); |
101 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
102 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
102 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
103 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
103 ui->hopsTable->setItem(i, 7, item); |
104 ui->hopsTable->setItem(i, 7, item); |
104 |
105 |
105 if (product->hops.at(i).h_amount < 1.0) { |
106 if (product->hops.at(i).h_amount < 1.0) { |
196 for (int i = 0; i < product->hops.size(); i++) { |
197 for (int i = 0; i < product->hops.size(); i++) { |
197 |
198 |
198 ibus += Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, |
199 ibus += Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, |
199 product->batch_size, product->hops.at(i).h_amount, |
200 product->batch_size, product->hops.at(i).h_amount, |
200 product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, |
201 product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, |
201 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6); |
202 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
202 ferm_ibus += Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, |
203 ferm_ibus += Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, |
203 product->brew_fermenter_volume + product->brew_fermenter_tcloss, product->hops.at(i).h_amount, |
204 product->brew_fermenter_volume + product->brew_fermenter_tcloss, product->hops.at(i).h_amount, |
204 product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, |
205 product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, |
205 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6); |
206 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
206 |
207 |
207 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); |
208 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); |
208 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); |
209 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); |
209 if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->hops.at(i).h_useat <= HOP_USEAT_WHIRLPOOL)) || |
210 if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->hops.at(i).h_useat <= HOP_USEAT_WHIRLPOOL)) || |
210 ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP))) && |
211 ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP))) && |
297 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
298 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
298 ui->hopsTable->setItem(product->hops_row, 8, item); |
299 ui->hopsTable->setItem(product->hops_row, 8, item); |
299 |
300 |
300 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
301 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
301 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
302 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
302 product->hops.at(product->hops_row).h_alpha, product->ibu_method, 0, product->hops.at(product->hops_row).h_time, 0); |
303 product->hops.at(product->hops_row).h_alpha, product->ibu_method, 0, product->hops.at(product->hops_row).h_time, 0, |
|
304 product->boil_time); |
303 |
305 |
304 ibuEdit->setValue(ibu); |
306 ibuEdit->setValue(ibu); |
305 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
307 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
306 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
308 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
307 ui->hopsTable->setItem(product->hops_row, 7, item); |
309 ui->hopsTable->setItem(product->hops_row, 7, item); |
331 ui->hopsTable->setItem(product->hops_row, 6, item); |
333 ui->hopsTable->setItem(product->hops_row, 6, item); |
332 |
334 |
333 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
335 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
334 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
336 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
335 product->hops.at(product->hops_row).h_alpha, product->ibu_method, |
337 product->hops.at(product->hops_row).h_alpha, product->ibu_method, |
336 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6); |
338 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
337 |
339 |
338 ibuEdit->setValue(ibu); |
340 ibuEdit->setValue(ibu); |
339 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
341 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
340 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
342 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
341 ui->hopsTable->setItem(product->hops_row, 7, item); |
343 ui->hopsTable->setItem(product->hops_row, 7, item); |
396 horiginEdit->setText(product->hops.at(product->hops_row).h_origin); |
398 horiginEdit->setText(product->hops.at(product->hops_row).h_origin); |
397 |
399 |
398 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
400 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
399 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
401 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
400 product->hops.at(product->hops_row).h_alpha, product->ibu_method, |
402 product->hops.at(product->hops_row).h_alpha, product->ibu_method, |
401 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6); |
403 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
402 ibuEdit->setValue(ibu); |
404 ibuEdit->setValue(ibu); |
403 |
405 |
404 ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).h_origin)); |
406 ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).h_origin)); |
405 ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).h_name)); |
407 ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).h_name)); |
406 |
408 |
617 ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
619 ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
618 ibuEdit->setDecimals(1); |
620 ibuEdit->setDecimals(1); |
619 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
621 double ibu = Utils::toIBU(product->hops.at(product->hops_row).h_useat, product->hops.at(product->hops_row).h_form, product->preboil_sg, |
620 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
622 product->batch_size, product->hops.at(product->hops_row).h_amount, product->hops.at(product->hops_row).h_time, |
621 product->hops.at(product->hops_row).h_alpha, product->ibu_method, |
623 product->hops.at(product->hops_row).h_alpha, product->ibu_method, |
622 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6); |
624 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
623 ibuEdit->setValue(ibu); |
625 ibuEdit->setValue(ibu); |
624 |
626 |
625 hop_instock_changed(true); |
627 hop_instock_changed(true); |
626 |
628 |
627 connect(hselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::hop_select_changed); |
629 connect(hselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::hop_select_changed); |