77 ui->fermentablesTable->verticalHeader()->hide(); |
77 ui->fermentablesTable->verticalHeader()->hide(); |
78 ui->fermentablesTable->setRowCount(product->fermentables.size()); |
78 ui->fermentablesTable->setRowCount(product->fermentables.size()); |
79 |
79 |
80 for (int i = 0; i < product->fermentables.size(); i++) { |
80 for (int i = 0; i < product->fermentables.size(); i++) { |
81 |
81 |
82 ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(product->fermentables.at(i).f_supplier)); |
82 ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(product->fermentables.at(i).supplier)); |
83 ui->fermentablesTable->setItem(i, 1, new QTableWidgetItem(product->fermentables.at(i).f_name)); |
83 ui->fermentablesTable->setItem(i, 1, new QTableWidgetItem(product->fermentables.at(i).name)); |
84 |
84 |
85 w = QString("%1").arg(product->fermentables.at(i).f_color, 1, 'f', 0, '0'); |
85 w = QString("%1").arg(product->fermentables.at(i).color, 1, 'f', 0, '0'); |
86 item = new QTableWidgetItem(w); |
86 item = new QTableWidgetItem(w); |
87 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
87 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
88 ui->fermentablesTable->setItem(i, 2, item); |
88 ui->fermentablesTable->setItem(i, 2, item); |
89 |
89 |
90 item = new QTableWidgetItem(fermentable_types[product->fermentables.at(i).f_type]); |
90 item = new QTableWidgetItem(fermentable_types[product->fermentables.at(i).type]); |
91 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
91 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
92 ui->fermentablesTable->setItem(i, 3, item); |
92 ui->fermentablesTable->setItem(i, 3, item); |
93 |
93 |
94 item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(i).f_graintype]); |
94 item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(i).graintype]); |
95 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
95 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
96 ui->fermentablesTable->setItem(i, 4, item); |
96 ui->fermentablesTable->setItem(i, 4, item); |
97 |
97 |
98 item = new QTableWidgetItem(fermentable_added[product->fermentables.at(i).f_added]); |
98 item = new QTableWidgetItem(fermentable_added[product->fermentables.at(i).added]); |
99 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
99 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
100 ui->fermentablesTable->setItem(i, 5, item); |
100 ui->fermentablesTable->setItem(i, 5, item); |
101 |
101 |
102 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).f_yield, 2, 'f', 1, '0')); |
102 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).yield, 2, 'f', 1, '0')); |
103 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
103 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
104 ui->fermentablesTable->setItem(i, 6, item); |
104 ui->fermentablesTable->setItem(i, 6, item); |
105 |
105 |
106 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).f_amount, 4, 'f', 3, '0')); |
106 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).amount, 4, 'f', 3, '0')); |
107 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
107 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
108 ui->fermentablesTable->setItem(i, 7, item); |
108 ui->fermentablesTable->setItem(i, 7, item); |
109 |
109 |
110 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).f_inventory, 4, 'f', 3, '0')); |
110 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(i).inventory, 4, 'f', 3, '0')); |
111 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
111 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
112 if (product->fermentables.at(i).f_inventory < product->fermentables.at(i).f_amount) |
112 if (product->fermentables.at(i).inventory < product->fermentables.at(i).amount) |
113 item->setForeground(QBrush(QColor(Qt::red))); |
113 item->setForeground(QBrush(QColor(Qt::red))); |
114 ui->fermentablesTable->setItem(i, 8, item); |
114 ui->fermentablesTable->setItem(i, 8, item); |
115 |
115 |
116 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { |
116 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { |
117 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).f_percentage, 2, 'f', 1, '0')); |
117 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(i).percentage, 2, 'f', 1, '0')); |
118 } else { |
118 } else { |
119 item = new QTableWidgetItem(QString("")); // Blank for bottling and kegging. |
119 item = new QTableWidgetItem(QString("")); // Blank for bottling and kegging. |
120 } |
120 } |
121 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
121 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
122 ui->fermentablesTable->setItem(i, 9, item); |
122 ui->fermentablesTable->setItem(i, 9, item); |
123 |
123 |
124 to100Fermentables(i); |
124 to100Fermentables(i); |
125 |
125 |
126 /* Add the Delete row button */ |
126 /* Add the Delete row button */ |
127 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { |
127 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { |
128 pWidget = new QWidget(); |
128 pWidget = new QWidget(); |
129 QPushButton* btn_dele = new QPushButton(); |
129 QPushButton* btn_dele = new QPushButton(); |
130 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
130 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
131 btn_dele->setText(tr("Delete")); |
131 btn_dele->setText(tr("Delete")); |
132 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteFermentRow_clicked())); |
132 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteFermentRow_clicked())); |
241 qDebug() << " adjust to 100" << product->fermentables_use100; |
241 qDebug() << " adjust to 100" << product->fermentables_use100; |
242 |
242 |
243 product->fermentables_ok = true; |
243 product->fermentables_ok = true; |
244 product->mashs_kg = 0; |
244 product->mashs_kg = 0; |
245 for (i = 0; i < product->fermentables.size(); i++) { |
245 for (i = 0; i < product->fermentables.size(); i++) { |
246 if (product->fermentables.at(i).f_type == FERMENTABLE_TYPE_SUGAR && product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) |
246 if (product->fermentables.at(i).type == FERMENTABLE_TYPE_SUGAR && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) |
247 psugar += product->fermentables.at(i).f_percentage; |
247 psugar += product->fermentables.at(i).percentage; |
248 if (product->fermentables.at(i).f_graintype == FERMENTABLE_GRAINTYPE_CRYSTAL && product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) |
248 if (product->fermentables.at(i).graintype == FERMENTABLE_GRAINTYPE_CRYSTAL && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) |
249 pcara += product->fermentables.at(i).f_percentage; |
249 pcara += product->fermentables.at(i).percentage; |
250 d = product->fermentables.at(i).f_amount * (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); |
250 d = product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); |
251 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { |
251 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { |
252 if (mvol > 0) { // If mash volume is known |
252 if (mvol > 0) { // If mash volume is known |
253 mvol += product->fermentables.at(i).f_amount * product->fermentables.at(i).f_moisture / 100; |
253 mvol += product->fermentables.at(i).amount * product->fermentables.at(i).moisture / 100; |
254 s += d; |
254 s += d; |
255 } |
255 } |
256 d = product->efficiency / 100 * d; |
256 d = product->efficiency / 100 * d; |
257 sugarsm += d; |
257 sugarsm += d; |
258 product->mashs_kg += product->fermentables.at(i).f_amount; |
258 product->mashs_kg += product->fermentables.at(i).amount; |
259 } |
259 } |
260 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH || product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOIL) |
260 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH || product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) |
261 sugarsf += d; |
261 sugarsf += d; |
262 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION || product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING) { |
262 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION || product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) { |
263 x = (product->fermentables.at(i).f_yield / 100) * (1 - product->fermentables.at(i).f_moisture / 100); |
263 x = (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100); |
264 addedS += product->fermentables.at(i).f_amount * x; |
264 addedS += product->fermentables.at(i).amount * x; |
265 addedmass += product->fermentables.at(i).f_amount; |
265 addedmass += product->fermentables.at(i).amount; |
266 vol += (x * sugardensity + (1 - x) * 1) * product->fermentables.at(i).f_amount; |
266 vol += (x * sugardensity + (1 - x) * 1) * product->fermentables.at(i).amount; |
267 } |
267 } |
268 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH && |
268 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH && |
269 (product->fermentables.at(i).f_type == FERMENTABLE_TYPE_GRAIN || product->fermentables.at(i).f_type == FERMENTABLE_TYPE_ADJUCT) && |
269 (product->fermentables.at(i).type == FERMENTABLE_TYPE_GRAIN || product->fermentables.at(i).type == FERMENTABLE_TYPE_ADJUCT) && |
270 product->fermentables.at(i).f_color < 50) { |
270 product->fermentables.at(i).color < 50) { |
271 lintner += product->fermentables.at(i).f_diastatic_power * product->fermentables.at(i).f_amount; |
271 lintner += product->fermentables.at(i).diastatic_power * product->fermentables.at(i).amount; |
272 } |
272 } |
273 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { |
273 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { |
274 colort += product->fermentables.at(i).f_amount * Utils::ebc_to_srm(product->fermentables.at(i).f_color); |
274 colort += product->fermentables.at(i).amount * Utils::ebc_to_srm(product->fermentables.at(i).color); |
275 colorh += product->fermentables.at(i).f_amount * product->fermentables.at(i).f_color * Utils::get_kt(product->fermentables.at(i).f_color); |
275 colorh += product->fermentables.at(i).amount * product->fermentables.at(i).color * Utils::get_kt(product->fermentables.at(i).color); |
276 colorn += (product->fermentables.at(i).f_percentage / 100) * product->fermentables.at(i).f_color; // For 8.6 Pt wort. |
276 colorn += (product->fermentables.at(i).percentage / 100) * product->fermentables.at(i).color; // For 8.6 Pt wort. |
277 } |
277 } |
278 /* Check supplies */ |
278 /* Check supplies */ |
279 if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->fermentables.at(i).f_added <= FERMENTABLE_ADDED_BOIL)) || |
279 if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->fermentables.at(i).added <= FERMENTABLE_ADDED_BOIL)) || |
280 ((product->inventory_reduced <= PROD_STAGE_PRIMARY) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION)) || |
280 ((product->inventory_reduced <= PROD_STAGE_PRIMARY) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION)) || |
281 ((product->inventory_reduced <= PROD_STAGE_TERTIARY) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING)) || |
281 ((product->inventory_reduced <= PROD_STAGE_TERTIARY) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING)) || |
282 ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE)) || |
282 ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE)) || |
283 ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS))) && |
283 ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS))) && |
284 product->fermentables.at(i).f_inventory < product->fermentables.at(i).f_amount) { |
284 product->fermentables.at(i).inventory < product->fermentables.at(i).amount) { |
285 product->fermentables_ok = false; |
285 product->fermentables_ok = false; |
286 } |
286 } |
287 } |
287 } |
288 qDebug() << " supplies" << product->fermentables_ok; |
288 qDebug() << " supplies" << product->fermentables_ok; |
289 qDebug() << " colort" << colort << "colorh" << colorh << "colorn" << colorn; |
289 qDebug() << " colort" << colort << "colorh" << colorh << "colorn" << colorn; |
482 double d, amount; |
482 double d, amount; |
483 double efficiency = product->efficiency; |
483 double efficiency = product->efficiency; |
484 double sug = Utils::sg_to_plato(og) * product->batch_size * og / 100.0; // total amount of sugars in kg. |
484 double sug = Utils::sg_to_plato(og) * product->batch_size * og / 100.0; // total amount of sugars in kg. |
485 |
485 |
486 for (i = 0; i < product->fermentables.size(); i++) { |
486 for (i = 0; i < product->fermentables.size(); i++) { |
487 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { |
487 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { |
488 d = product->fermentables.at(i).f_percentage / 100.0 * |
488 d = product->fermentables.at(i).percentage / 100.0 * |
489 (product->fermentables.at(i).f_yield / 100.0) * |
489 (product->fermentables.at(i).yield / 100.0) * |
490 (1 - product->fermentables.at(i).f_moisture / 100.0); |
490 (1 - product->fermentables.at(i).moisture / 100.0); |
491 if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) |
491 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) |
492 d = efficiency / 100.0 * d; |
492 d = efficiency / 100.0 * d; |
493 tot += d; |
493 tot += d; |
494 } |
494 } |
495 } |
495 } |
496 if (tot) |
496 if (tot) |
497 totmass = round((sug / tot) * 1000.0) / 1000.0; |
497 totmass = round((sug / tot) * 1000.0) / 1000.0; |
498 |
498 |
499 if (totmass) { |
499 if (totmass) { |
500 for (i = 0; i < product->fermentables.size(); i++) { |
500 for (i = 0; i < product->fermentables.size(); i++) { |
501 amount = round(product->fermentables.at(i).f_percentage * 10.0 * totmass) / 1000.0; |
501 amount = round(product->fermentables.at(i).percentage * 10.0 * totmass) / 1000.0; |
502 product->fermentables[i].f_amount = amount; |
502 product->fermentables[i].amount = amount; |
503 } |
503 } |
504 } |
504 } |
505 } |
505 } |
506 |
506 |
507 |
507 |
576 Fermentables newf; |
576 Fermentables newf; |
577 |
577 |
578 qDebug() << "Add fermentable row"; |
578 qDebug() << "Add fermentable row"; |
579 |
579 |
580 for (int i = 0; i < product->fermentables.size(); i++) { |
580 for (int i = 0; i < product->fermentables.size(); i++) { |
581 if (product->fermentables.at(i).f_amount == 0 && product->fermentables.at(i).f_color == 0) |
581 if (product->fermentables.at(i).amount == 0 && product->fermentables.at(i).color == 0) |
582 return; // Add only one at a time. |
582 return; // Add only one at a time. |
583 } |
583 } |
584 |
584 |
585 newf.f_name = "Select one"; |
585 newf.name = "Select one"; |
586 newf.f_origin = ""; |
586 newf.origin = ""; |
587 newf.f_supplier = ""; |
587 newf.supplier = ""; |
588 newf.f_amount = 0; |
588 newf.amount = 0; |
589 newf.f_cost = 0; |
589 newf.cost = 0; |
590 newf.f_type = FERMENTABLE_TYPE_GRAIN; |
590 newf.type = FERMENTABLE_TYPE_GRAIN; |
591 newf.f_yield = 0; |
591 newf.yield = 0; |
592 newf.f_color = 0; |
592 newf.color = 0; |
593 newf.f_coarse_fine_diff = 0; |
593 newf.coarse_fine_diff = 0; |
594 newf.f_moisture = 0; |
594 newf.moisture = 0; |
595 newf.f_diastatic_power = 0; |
595 newf.diastatic_power = 0; |
596 newf.f_protein = 0; |
596 newf.protein = 0; |
597 newf.f_dissolved_protein = 0; |
597 newf.dissolved_protein = 0; |
598 newf.f_max_in_batch = 100; |
598 newf.max_in_batch = 100; |
599 newf.f_graintype = FERMENTABLE_GRAINTYPE_BASE; |
599 newf.graintype = FERMENTABLE_GRAINTYPE_BASE; |
600 newf.f_added = FERMENTABLE_ADDED_MASH; |
600 newf.added = FERMENTABLE_ADDED_MASH; |
601 newf.f_recommend_mash = true; |
601 newf.recommend_mash = true; |
602 newf.f_add_after_boil = false; |
602 newf.add_after_boil = false; |
603 newf.f_adjust_to_total_100 = false; |
603 newf.adjust_to_total_100 = false; |
604 newf.f_percentage = 0; |
604 newf.percentage = 0; |
605 newf.f_di_ph = 0; |
605 newf.di_ph = 0; |
606 newf.f_acid_to_ph_57 = 0; |
606 newf.acid_to_ph_57 = 0; |
607 |
607 |
608 product->fermentables.append(newf); |
608 product->fermentables.append(newf); |
609 emit refreshAll(); |
609 emit refreshAll(); |
610 } |
610 } |
611 |
611 |
648 void EditProduct::ferment_amount_changed(double val) |
648 void EditProduct::ferment_amount_changed(double val) |
649 { |
649 { |
650 QTableWidgetItem *item; |
650 QTableWidgetItem *item; |
651 double total = 0, perc; |
651 double total = 0, perc; |
652 |
652 |
653 if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE) |
653 if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE) |
654 return; |
654 return; |
655 |
655 |
656 qDebug() << "ferment_amount_changed()" << product->fermentables_row << val; |
656 qDebug() << "ferment_amount_changed()" << product->fermentables_row << val; |
657 |
657 |
658 product->fermentables[product->fermentables_row].f_amount = val; |
658 product->fermentables[product->fermentables_row].amount = val; |
659 item = new QTableWidgetItem(QString("%1 Kg").arg(val, 4, 'f', 3, '0')); |
659 item = new QTableWidgetItem(QString("%1 Kg").arg(val, 4, 'f', 3, '0')); |
660 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
660 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
661 ui->fermentablesTable->setItem(product->fermentables_row, 7, item); |
661 ui->fermentablesTable->setItem(product->fermentables_row, 7, item); |
662 |
662 |
663 for (int i = 0; i < product->fermentables.size(); i++) |
663 for (int i = 0; i < product->fermentables.size(); i++) |
664 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging |
664 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging |
665 total += product->fermentables.at(i).f_amount; |
665 total += product->fermentables.at(i).amount; |
666 /* |
666 /* |
667 * Recalculate the percentages |
667 * Recalculate the percentages |
668 */ |
668 */ |
669 for (int i = 0; i < product->fermentables.size(); i++) { |
669 for (int i = 0; i < product->fermentables.size(); i++) { |
670 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) { |
670 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) { |
671 perc = product->fermentables.at(i).f_amount / total * 100; |
671 perc = product->fermentables.at(i).amount / total * 100; |
672 product->fermentables[i].f_percentage = perc; |
672 product->fermentables[i].percentage = perc; |
673 item = new QTableWidgetItem(QString("%1%").arg(perc, 2, 'f', 1, '0')); |
673 item = new QTableWidgetItem(QString("%1%").arg(perc, 2, 'f', 1, '0')); |
674 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
674 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
675 ui->fermentablesTable->setItem(i, 8, item); |
675 ui->fermentablesTable->setItem(i, 8, item); |
676 if (i == product->fermentables_row) |
676 if (i == product->fermentables_row) |
677 this->pctEdit->setValue(perc); |
677 this->pctEdit->setValue(perc); |
693 /* |
693 /* |
694 * Since we have arrived here, adjust_to_100 is active and |
694 * Since we have arrived here, adjust_to_100 is active and |
695 * this is not the entry to be adjusted to 100. |
695 * this is not the entry to be adjusted to 100. |
696 */ |
696 */ |
697 for (int i = 0; i < product->fermentables.size(); i++) { |
697 for (int i = 0; i < product->fermentables.size(); i++) { |
698 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging |
698 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging |
699 total += product->fermentables.at(i).f_amount; |
699 total += product->fermentables.at(i).amount; |
700 if (product->fermentables.at(i).f_adjust_to_total_100) |
700 if (product->fermentables.at(i).adjust_to_total_100) |
701 row100 = i; |
701 row100 = i; |
702 } |
702 } |
703 double oldperc = product->fermentables.at(product->fermentables_row).f_percentage; |
703 double oldperc = product->fermentables.at(product->fermentables_row).percentage; |
704 double diffp = val - oldperc; |
704 double diffp = val - oldperc; |
705 double diffw = (diffp / 100) * total; |
705 double diffw = (diffp / 100) * total; |
706 qDebug() << "row100" << row100 << "total" << total << "diff kg" << diffw << "diff %" << diffp; |
706 qDebug() << "row100" << row100 << "total" << total << "diff kg" << diffw << "diff %" << diffp; |
707 |
707 |
708 product->fermentables[product->fermentables_row].f_percentage += diffp; |
708 product->fermentables[product->fermentables_row].percentage += diffp; |
709 product->fermentables[product->fermentables_row].f_amount += diffw; |
709 product->fermentables[product->fermentables_row].amount += diffw; |
710 product->fermentables[row100].f_percentage -= diffp; |
710 product->fermentables[row100].percentage -= diffp; |
711 product->fermentables[row100].f_amount -= diffw; |
711 product->fermentables[row100].amount -= diffw; |
712 |
712 |
713 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[product->fermentables_row].f_amount, 4, 'f', 3, '0')); |
713 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[product->fermentables_row].amount, 4, 'f', 3, '0')); |
714 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
714 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
715 ui->fermentablesTable->setItem(product->fermentables_row, 7, item); |
715 ui->fermentablesTable->setItem(product->fermentables_row, 7, item); |
716 this->famountEdit->setValue(product->fermentables[product->fermentables_row].f_amount); |
716 this->famountEdit->setValue(product->fermentables[product->fermentables_row].amount); |
717 |
717 |
718 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[product->fermentables_row].f_percentage, 2, 'f', 1, '0')); |
718 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[product->fermentables_row].percentage, 2, 'f', 1, '0')); |
719 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
719 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
720 ui->fermentablesTable->setItem(product->fermentables_row, 8, item); |
720 ui->fermentablesTable->setItem(product->fermentables_row, 8, item); |
721 |
721 |
722 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[row100].f_amount, 4, 'f', 3, '0')); |
722 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables[row100].amount, 4, 'f', 3, '0')); |
723 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
723 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
724 ui->fermentablesTable->setItem(row100, 7, item); |
724 ui->fermentablesTable->setItem(row100, 7, item); |
725 |
725 |
726 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[row100].f_percentage, 2, 'f', 1, '0')); |
726 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables[row100].percentage, 2, 'f', 1, '0')); |
727 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
727 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
728 ui->fermentablesTable->setItem(row100, 8, item); |
728 ui->fermentablesTable->setItem(row100, 8, item); |
729 |
729 |
730 is_changed(); |
730 is_changed(); |
731 } |
731 } |
749 * 3. There is another one selected, deselect and select this one. |
749 * 3. There is another one selected, deselect and select this one. |
750 */ |
750 */ |
751 if (! product->fermentables_use100 && val) { |
751 if (! product->fermentables_use100 && val) { |
752 /* Scenario 1. */ |
752 /* Scenario 1. */ |
753 product->fermentables_use100 = true; |
753 product->fermentables_use100 = true; |
754 product->fermentables[product->fermentables_row].f_adjust_to_total_100 = true; |
754 product->fermentables[product->fermentables_row].adjust_to_total_100 = true; |
755 pctEdit->setReadOnly(false); |
755 pctEdit->setReadOnly(false); |
756 famountEdit->setReadOnly(true); |
756 famountEdit->setReadOnly(true); |
757 } else if (product->fermentables_use100 && product->fermentables[product->fermentables_row].f_adjust_to_total_100 && ! val) { |
757 } else if (product->fermentables_use100 && product->fermentables[product->fermentables_row].adjust_to_total_100 && ! val) { |
758 /* Scenario 2. */ |
758 /* Scenario 2. */ |
759 product->fermentables[product->fermentables_row].f_adjust_to_total_100 = false; |
759 product->fermentables[product->fermentables_row].adjust_to_total_100 = false; |
760 product->fermentables_use100 = false; |
760 product->fermentables_use100 = false; |
761 pctEdit->setReadOnly(true); |
761 pctEdit->setReadOnly(true); |
762 famountEdit->setReadOnly(false); |
762 famountEdit->setReadOnly(false); |
763 } else if (product->fermentables_use100 && ! product->fermentables[product->fermentables_row].f_adjust_to_total_100 && val) { |
763 } else if (product->fermentables_use100 && ! product->fermentables[product->fermentables_row].adjust_to_total_100 && val) { |
764 /* Scenario 3. */ |
764 /* Scenario 3. */ |
765 for (int i = 0; i < product->fermentables.size(); i++) { |
765 for (int i = 0; i < product->fermentables.size(); i++) { |
766 product->fermentables[i].f_adjust_to_total_100 = false; |
766 product->fermentables[i].adjust_to_total_100 = false; |
767 } |
767 } |
768 product->fermentables[product->fermentables_row].f_adjust_to_total_100 = true; |
768 product->fermentables[product->fermentables_row].adjust_to_total_100 = true; |
769 } else { |
769 } else { |
770 qDebug() << "bug"; |
770 qDebug() << "bug"; |
771 return; |
771 return; |
772 } |
772 } |
773 |
773 |
806 } |
806 } |
807 |
807 |
808 /* |
808 /* |
809 * Replace the fermentable record contents |
809 * Replace the fermentable record contents |
810 */ |
810 */ |
811 product->fermentables[product->fermentables_row].f_name = query.value(0).toString(); |
811 product->fermentables[product->fermentables_row].name = query.value(0).toString(); |
812 product->fermentables[product->fermentables_row].f_origin = query.value(1).toString(); |
812 product->fermentables[product->fermentables_row].origin = query.value(1).toString(); |
813 product->fermentables[product->fermentables_row].f_supplier = query.value(2).toString(); |
813 product->fermentables[product->fermentables_row].supplier = query.value(2).toString(); |
814 product->fermentables[product->fermentables_row].f_cost = query.value(3).toDouble(); |
814 product->fermentables[product->fermentables_row].cost = query.value(3).toDouble(); |
815 product->fermentables[product->fermentables_row].f_type = query.value(4).toInt(); |
815 product->fermentables[product->fermentables_row].type = query.value(4).toInt(); |
816 product->fermentables[product->fermentables_row].f_yield = query.value(5).toDouble(); |
816 product->fermentables[product->fermentables_row].yield = query.value(5).toDouble(); |
817 product->fermentables[product->fermentables_row].f_color = query.value(6).toDouble(); |
817 product->fermentables[product->fermentables_row].color = query.value(6).toDouble(); |
818 product->fermentables[product->fermentables_row].f_coarse_fine_diff = query.value(7).toDouble(); |
818 product->fermentables[product->fermentables_row].coarse_fine_diff = query.value(7).toDouble(); |
819 product->fermentables[product->fermentables_row].f_moisture = query.value(8).toDouble(); |
819 product->fermentables[product->fermentables_row].moisture = query.value(8).toDouble(); |
820 product->fermentables[product->fermentables_row].f_diastatic_power = query.value(9).toDouble(); |
820 product->fermentables[product->fermentables_row].diastatic_power = query.value(9).toDouble(); |
821 product->fermentables[product->fermentables_row].f_protein = query.value(10).toDouble(); |
821 product->fermentables[product->fermentables_row].protein = query.value(10).toDouble(); |
822 product->fermentables[product->fermentables_row].f_dissolved_protein = query.value(11).toDouble(); |
822 product->fermentables[product->fermentables_row].dissolved_protein = query.value(11).toDouble(); |
823 product->fermentables[product->fermentables_row].f_max_in_batch = query.value(12).toDouble(); |
823 product->fermentables[product->fermentables_row].max_in_batch = query.value(12).toDouble(); |
824 product->fermentables[product->fermentables_row].f_graintype = query.value(13).toInt(); |
824 product->fermentables[product->fermentables_row].graintype = query.value(13).toInt(); |
825 product->fermentables[product->fermentables_row].f_recommend_mash = query.value(14).toInt() ? true:false; |
825 product->fermentables[product->fermentables_row].recommend_mash = query.value(14).toInt() ? true:false; |
826 product->fermentables[product->fermentables_row].f_add_after_boil = query.value(15).toInt() ? true:false; |
826 product->fermentables[product->fermentables_row].add_after_boil = query.value(15).toInt() ? true:false; |
827 product->fermentables[product->fermentables_row].f_di_ph = query.value(16).toDouble(); |
827 product->fermentables[product->fermentables_row].di_ph = query.value(16).toDouble(); |
828 product->fermentables[product->fermentables_row].f_acid_to_ph_57 = query.value(17).toDouble(); |
828 product->fermentables[product->fermentables_row].acid_to_ph_57 = query.value(17).toDouble(); |
829 product->fermentables[product->fermentables_row].f_inventory = query.value(18).toDouble(); |
829 product->fermentables[product->fermentables_row].inventory = query.value(18).toDouble(); |
830 |
830 |
831 /* |
831 /* |
832 * Update the visible fields |
832 * Update the visible fields |
833 */ |
833 */ |
834 fnameEdit->setText(product->fermentables.at(product->fermentables_row).f_name); |
834 fnameEdit->setText(product->fermentables.at(product->fermentables_row).name); |
835 fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).f_supplier); |
835 fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).supplier); |
836 fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).f_max_in_batch); |
836 fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).max_in_batch); |
837 |
837 |
838 ui->fermentablesTable->setItem(product->fermentables_row, 0, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).f_supplier)); |
838 ui->fermentablesTable->setItem(product->fermentables_row, 0, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).supplier)); |
839 ui->fermentablesTable->setItem(product->fermentables_row, 1, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).f_name)); |
839 ui->fermentablesTable->setItem(product->fermentables_row, 1, new QTableWidgetItem(product->fermentables.at(product->fermentables_row).name)); |
840 |
840 |
841 w = QString("%1").arg(product->fermentables.at(product->fermentables_row).f_color, 1, 'f', 0, '0'); |
841 w = QString("%1").arg(product->fermentables.at(product->fermentables_row).color, 1, 'f', 0, '0'); |
842 item = new QTableWidgetItem(w); |
842 item = new QTableWidgetItem(w); |
843 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
843 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
844 ui->fermentablesTable->setItem(product->fermentables_row, 2, item); |
844 ui->fermentablesTable->setItem(product->fermentables_row, 2, item); |
845 |
845 |
846 item = new QTableWidgetItem(fermentable_types[product->fermentables.at(product->fermentables_row).f_type]); |
846 item = new QTableWidgetItem(fermentable_types[product->fermentables.at(product->fermentables_row).type]); |
847 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
847 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
848 ui->fermentablesTable->setItem(product->fermentables_row, 3, item); |
848 ui->fermentablesTable->setItem(product->fermentables_row, 3, item); |
849 |
849 |
850 item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(product->fermentables_row).f_graintype]); |
850 item = new QTableWidgetItem(fermentable_graintypes[product->fermentables.at(product->fermentables_row).graintype]); |
851 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
851 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
852 ui->fermentablesTable->setItem(product->fermentables_row, 4, item); |
852 ui->fermentablesTable->setItem(product->fermentables_row, 4, item); |
853 |
853 |
854 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(product->fermentables_row).f_yield, 2, 'f', 1, '0')); |
854 item = new QTableWidgetItem(QString("%1%").arg(product->fermentables.at(product->fermentables_row).yield, 2, 'f', 1, '0')); |
855 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
855 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
856 ui->fermentablesTable->setItem(product->fermentables_row, 6, item); |
856 ui->fermentablesTable->setItem(product->fermentables_row, 6, item); |
857 |
857 |
858 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(product->fermentables_row).f_inventory, 4, 'f', 3, '0')); |
858 item = new QTableWidgetItem(QString("%1 Kg").arg(product->fermentables.at(product->fermentables_row).inventory, 4, 'f', 3, '0')); |
859 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
859 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
860 if (product->fermentables.at(product->fermentables_row).f_inventory < product->fermentables.at(product->fermentables_row).f_amount) |
860 if (product->fermentables.at(product->fermentables_row).inventory < product->fermentables.at(product->fermentables_row).amount) |
861 item->setForeground(QBrush(QColor(Qt::red))); |
861 item->setForeground(QBrush(QColor(Qt::red))); |
862 ui->fermentablesTable->setItem(product->fermentables_row, 8, item); |
862 ui->fermentablesTable->setItem(product->fermentables_row, 8, item); |
863 |
863 |
864 calcFermentables(); |
864 calcFermentables(); |
865 is_changed(); |
865 is_changed(); |
892 |
892 |
893 void EditProduct::ferment_added_changed(int val) |
893 void EditProduct::ferment_added_changed(int val) |
894 { |
894 { |
895 qDebug() << "ferment_added_changed()" << product->fermentables_row << val; |
895 qDebug() << "ferment_added_changed()" << product->fermentables_row << val; |
896 |
896 |
897 product->fermentables[product->fermentables_row].f_added = val; |
897 product->fermentables[product->fermentables_row].added = val; |
898 QTableWidgetItem *item = new QTableWidgetItem(fermentable_added[val]); |
898 QTableWidgetItem *item = new QTableWidgetItem(fermentable_added[val]); |
899 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
899 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
900 ui->fermentablesTable->setItem(product->fermentables_row, 5, item); |
900 ui->fermentablesTable->setItem(product->fermentables_row, 5, item); |
901 |
901 |
902 famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE); |
902 famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE); |
903 pctEdit->setReadOnly(! (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE)); |
903 pctEdit->setReadOnly(! (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE)); |
904 |
904 |
905 double total = 0; |
905 double total = 0; |
906 for (int i = 0; i < product->fermentables.size(); i++) |
906 for (int i = 0; i < product->fermentables.size(); i++) |
907 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging |
907 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) // Only before bottle/kegging |
908 total += product->fermentables.at(i).f_amount; |
908 total += product->fermentables.at(i).amount; |
909 for (int i = 0; i < product->fermentables.size(); i++) |
909 for (int i = 0; i < product->fermentables.size(); i++) |
910 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) |
910 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) |
911 product->fermentables[i].f_percentage = product->fermentables.at(i).f_amount / total * 100; |
911 product->fermentables[i].percentage = product->fermentables.at(i).amount / total * 100; |
912 |
912 |
913 is_changed(); |
913 is_changed(); |
914 emit refreshAll(); |
914 emit refreshAll(); |
915 } |
915 } |
916 |
916 |
986 fselectEdit->setObjectName(QString::fromUtf8("fselectEdit")); |
986 fselectEdit->setObjectName(QString::fromUtf8("fselectEdit")); |
987 fselectEdit->setGeometry(QRect(160, 70, 371, 23)); |
987 fselectEdit->setGeometry(QRect(160, 70, 371, 23)); |
988 |
988 |
989 fnameEdit = new QLineEdit(dialog); |
989 fnameEdit = new QLineEdit(dialog); |
990 fnameEdit->setObjectName(QString::fromUtf8("fnameEdit")); |
990 fnameEdit->setObjectName(QString::fromUtf8("fnameEdit")); |
991 fnameEdit->setText(product->fermentables.at(product->fermentables_row).f_name); |
991 fnameEdit->setText(product->fermentables.at(product->fermentables_row).name); |
992 fnameEdit->setGeometry(QRect(160, 10, 511, 23)); |
992 fnameEdit->setGeometry(QRect(160, 10, 511, 23)); |
993 fnameEdit->setReadOnly(true); |
993 fnameEdit->setReadOnly(true); |
994 fsupplierEdit = new QLineEdit(dialog); |
994 fsupplierEdit = new QLineEdit(dialog); |
995 fsupplierEdit->setObjectName(QString::fromUtf8("fsupplierEdit")); |
995 fsupplierEdit->setObjectName(QString::fromUtf8("fsupplierEdit")); |
996 fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).f_supplier); |
996 fsupplierEdit->setText(product->fermentables.at(product->fermentables_row).supplier); |
997 fsupplierEdit->setGeometry(QRect(160, 40, 511, 23)); |
997 fsupplierEdit->setGeometry(QRect(160, 40, 511, 23)); |
998 fsupplierEdit->setReadOnly(true); |
998 fsupplierEdit->setReadOnly(true); |
999 famountEdit = new QDoubleSpinBox(dialog); |
999 famountEdit = new QDoubleSpinBox(dialog); |
1000 famountEdit->setObjectName(QString::fromUtf8("famountEdit")); |
1000 famountEdit->setObjectName(QString::fromUtf8("famountEdit")); |
1001 famountEdit->setGeometry(QRect(160, 100, 121, 24)); |
1001 famountEdit->setGeometry(QRect(160, 100, 121, 24)); |
1002 famountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1002 famountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1003 famountEdit->setAccelerated(true); |
1003 famountEdit->setAccelerated(true); |
1004 famountEdit->setDecimals(3); |
1004 famountEdit->setDecimals(3); |
1005 famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < 4); |
1005 famountEdit->setReadOnly(product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < 4); |
1006 famountEdit->setMaximum(100000.0); |
1006 famountEdit->setMaximum(100000.0); |
1007 famountEdit->setSingleStep(0.0010); |
1007 famountEdit->setSingleStep(0.0010); |
1008 famountEdit->setValue(product->fermentables.at(product->fermentables_row).f_amount); |
1008 famountEdit->setValue(product->fermentables.at(product->fermentables_row).amount); |
1009 |
1009 |
1010 pctEdit = new QDoubleSpinBox(dialog); |
1010 pctEdit = new QDoubleSpinBox(dialog); |
1011 pctEdit->setObjectName(QString::fromUtf8("pctEdit")); |
1011 pctEdit->setObjectName(QString::fromUtf8("pctEdit")); |
1012 pctEdit->setGeometry(QRect(160, 130, 121, 24)); |
1012 pctEdit->setGeometry(QRect(160, 130, 121, 24)); |
1013 pctEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1013 pctEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1014 pctEdit->setAccelerated(true); |
1014 pctEdit->setAccelerated(true); |
1015 pctEdit->setDecimals(1); |
1015 pctEdit->setDecimals(1); |
1016 if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).f_added < FERMENTABLE_ADDED_BOTTLE) { |
1016 if (product->fermentables_use100 && product->fermentables.at(product->fermentables_row).added < FERMENTABLE_ADDED_BOTTLE) { |
1017 if (product->fermentables.at(product->fermentables_row).f_adjust_to_total_100) |
1017 if (product->fermentables.at(product->fermentables_row).adjust_to_total_100) |
1018 pctEdit->setReadOnly(true); |
1018 pctEdit->setReadOnly(true); |
1019 else |
1019 else |
1020 pctEdit->setReadOnly(false); |
1020 pctEdit->setReadOnly(false); |
1021 } else { |
1021 } else { |
1022 pctEdit->setReadOnly(true); |
1022 pctEdit->setReadOnly(true); |
1023 } |
1023 } |
1024 pctEdit->setMaximum(100.0); |
1024 pctEdit->setMaximum(100.0); |
1025 pctEdit->setSingleStep(0.1); |
1025 pctEdit->setSingleStep(0.1); |
1026 pctEdit->setValue(product->fermentables.at(product->fermentables_row).f_percentage); |
1026 pctEdit->setValue(product->fermentables.at(product->fermentables_row).percentage); |
1027 |
1027 |
1028 faddedEdit = new QComboBox(dialog); |
1028 faddedEdit = new QComboBox(dialog); |
1029 faddedEdit->setObjectName(QString::fromUtf8("faddedEdit")); |
1029 faddedEdit->setObjectName(QString::fromUtf8("faddedEdit")); |
1030 faddedEdit->setGeometry(QRect(160, 190, 161, 23)); |
1030 faddedEdit->setGeometry(QRect(160, 190, 161, 23)); |
1031 faddedEdit->addItem(tr("Mash")); |
1031 faddedEdit->addItem(tr("Mash")); |
1032 faddedEdit->addItem(tr("Boil")); |
1032 faddedEdit->addItem(tr("Boil")); |
1033 faddedEdit->addItem(tr("Fermentation")); |
1033 faddedEdit->addItem(tr("Fermentation")); |
1034 faddedEdit->addItem(tr("Lagering")); |
1034 faddedEdit->addItem(tr("Lagering")); |
1035 faddedEdit->setCurrentIndex(product->fermentables.at(product->fermentables_row).f_added); |
1035 faddedEdit->setCurrentIndex(product->fermentables.at(product->fermentables_row).added); |
1036 |
1036 |
1037 to100Edit = new QCheckBox(dialog); |
1037 to100Edit = new QCheckBox(dialog); |
1038 to100Edit->setObjectName(QString::fromUtf8("to100Edit")); |
1038 to100Edit->setObjectName(QString::fromUtf8("to100Edit")); |
1039 to100Edit->setGeometry(QRect(160, 160, 85, 21)); |
1039 to100Edit->setGeometry(QRect(160, 160, 85, 21)); |
1040 to100Edit->setChecked(product->fermentables.at(product->fermentables_row).f_adjust_to_total_100); |
1040 to100Edit->setChecked(product->fermentables.at(product->fermentables_row).adjust_to_total_100); |
1041 |
1041 |
1042 finstockEdit = new QCheckBox(dialog); |
1042 finstockEdit = new QCheckBox(dialog); |
1043 finstockEdit->setObjectName(QString::fromUtf8("instockEdit")); |
1043 finstockEdit->setObjectName(QString::fromUtf8("instockEdit")); |
1044 finstockEdit->setGeometry(QRect(655, 70, 85, 21)); |
1044 finstockEdit->setGeometry(QRect(655, 70, 85, 21)); |
1045 finstockEdit->setChecked(true); |
1045 finstockEdit->setChecked(true); |
1049 fmaxEdit->setGeometry(QRect(550, 130, 121, 24)); |
1049 fmaxEdit->setGeometry(QRect(550, 130, 121, 24)); |
1050 fmaxEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1050 fmaxEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1051 fmaxEdit->setReadOnly(true); |
1051 fmaxEdit->setReadOnly(true); |
1052 fmaxEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
1052 fmaxEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
1053 fmaxEdit->setDecimals(1); |
1053 fmaxEdit->setDecimals(1); |
1054 fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).f_max_in_batch); |
1054 fmaxEdit->setValue(product->fermentables.at(product->fermentables_row).max_in_batch); |
1055 |
1055 |
1056 ferment_instock_changed(true); |
1056 ferment_instock_changed(true); |
1057 |
1057 |
1058 connect(fselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::ferment_select_changed); |
1058 connect(fselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::ferment_select_changed); |
1059 connect(famountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::ferment_amount_changed); |
1059 connect(famountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::ferment_amount_changed); |