Thu, 05 May 2022 17:20:06 +0200
The framework to calculate yeast starters added.
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * EditProduct.cpp is part of bmsapp. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * tab 6, yeasts. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * bmsapp is free software: you can redistribute it and/or modify |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * it under the terms of the GNU General Public License as published by |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * the Free Software Foundation, either version 3 of the License, or |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * (at your option) any later version. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * bmsapp is distributed in the yeaste that it will be useful, |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * GNU General Public License for more details. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | bool EditProduct::yeast_sort_test(const Yeasts &D1, const Yeasts &D2) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | if (D1.y_use > D2.y_use) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | return false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | if (D1.y_use < D2.y_use) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | return true; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | return (D1.y_amount > D2.y_amount); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | void EditProduct::refreshYeasts() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | QString w; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | QWidget* pWidget; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | QHBoxLayout* pLayout; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | qDebug() << "refreshYeasts" << product->yeasts.size(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | std::sort(product->yeasts.begin(), product->yeasts.end(), yeast_sort_test); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
41 | const QStringList labels({tr("Yeast"), tr("Laboratory"), tr("Code"), tr("Type"), tr("Use for"), tr("Min."), tr("Max."), |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
42 | tr("Tol."), tr("Attn."), tr("Amount"), tr("Stock"), tr("Delete"), tr("Edit") }); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
44 | ui->yeastsTable->setColumnCount(13); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | ui->yeastsTable->setColumnWidth(0, 200); /* Yeast */ |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
46 | ui->yeastsTable->setColumnWidth(1, 115); /* Laboratory */ |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | ui->yeastsTable->setColumnWidth(2, 80); /* Code */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | ui->yeastsTable->setColumnWidth(3, 80); /* Type */ |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
49 | ui->yeastsTable->setColumnWidth(4, 80); /* Usage */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
50 | ui->yeastsTable->setColumnWidth(5, 50); /* Min. */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
51 | ui->yeastsTable->setColumnWidth(6, 50); /* Max. */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
52 | ui->yeastsTable->setColumnWidth(7, 50); /* Tolerance */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
53 | ui->yeastsTable->setColumnWidth(8, 50); /* Attenuation */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
54 | ui->yeastsTable->setColumnWidth(9, 80); /* Amount */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
55 | ui->yeastsTable->setColumnWidth(10, 80); /* Stock */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
56 | ui->yeastsTable->setColumnWidth(11, 80); /* Delete */ |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
57 | ui->yeastsTable->setColumnWidth(12, 80); /* Edit */ |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | ui->yeastsTable->setHorizontalHeaderLabels(labels); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | ui->yeastsTable->verticalHeader()->hide(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | ui->yeastsTable->setRowCount(product->yeasts.size()); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | for (int i = 0; i < product->yeasts.size(); i++) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(product->yeasts.at(i).y_name)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(product->yeasts.at(i).y_laboratory)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(product->yeasts.at(i).y_product_id)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | item = new QTableWidgetItem(yeast_forms[product->yeasts.at(i).y_form]); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | ui->yeastsTable->setItem(i, 3, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | item = new QTableWidgetItem(yeast_use[product->yeasts.at(i).y_use]); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | ui->yeastsTable->setItem(i, 4, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
76 | item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).y_min_temperature, 2, 'f', 1, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | ui->yeastsTable->setItem(i, 5, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
80 | item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).y_max_temperature, 2, 'f', 1, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | ui->yeastsTable->setItem(i, 6, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
84 | item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).y_tolerance, 2, 'f', 1, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | ui->yeastsTable->setItem(i, 7, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
88 | item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).y_attenuation, 2, 'f', 1, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | ui->yeastsTable->setItem(i, 8, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
92 | if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).y_amount, 1, 'f', 0, '0')); |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
94 | else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | else |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | ui->yeastsTable->setItem(i, 9, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
101 | if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
102 | item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).y_inventory, 1, 'f', 0, '0')); |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
103 | else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
104 | item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).y_inventory * 1000.0, 3, 'f', 2, '0')); |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
105 | else |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
106 | item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).y_inventory * 1000.0, 3, 'f', 2, '0')); |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
107 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
108 | if (product->yeasts.at(i).y_inventory < product->yeasts.at(i).y_amount) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
109 | item->setForeground(QBrush(QColor(Qt::red))); |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
110 | ui->yeastsTable->setItem(i, 10, item); |
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
111 | |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | pWidget = new QWidget(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | QPushButton* btn_dele = new QPushButton(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | btn_dele->setText(tr("Delete")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteYeastRow_clicked())); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | pLayout = new QHBoxLayout(pWidget); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | pLayout->addWidget(btn_dele); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | pLayout->setContentsMargins(5, 0, 5, 0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | pWidget->setLayout(pLayout); |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
121 | ui->yeastsTable->setCellWidget(i, 11, pWidget); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | pWidget = new QWidget(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | QPushButton* btn_edit = new QPushButton(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | btn_edit->setText(tr("Edit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(editYeastRow_clicked())); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | pLayout = new QHBoxLayout(pWidget); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | pLayout->addWidget(btn_edit); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | pLayout->setContentsMargins(5, 0, 5, 0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | pWidget->setLayout(pLayout); |
179
512f492358e3
Miscs updates the current inventory during recipe load. Yeasts updates the current inventory during recipe load and does a better job for the fields to upgrade.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
132 | ui->yeastsTable->setCellWidget(i, 12, pWidget); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
137 | void EditProduct::initYeast() |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
138 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
139 | ui->est_og4Edit->setValue(product->est_og); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
140 | ui->est_fg3Edit->setValue(product->est_fg); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
141 | ui->est_abv2Edit->setValue(product->est_abv); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
142 | ui->productionEdit->setText(product->yeast_prod_date.toString("dd MMM yyyy")); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
143 | ui->conditionShow->setValue(product->starter_viability); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
144 | ui->startersgEdit->setValue(product->starter_sg); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
145 | ui->pitchrateEdit->setValue(product->yeast_pitchrate); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
146 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
147 | ui->yeastsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
148 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
149 | for (int i = 0; i < starters.size(); i++) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
150 | ui->stmethodEdit->addItem(starters[i]); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
151 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
152 | ui->stmethodEdit->setCurrentIndex(product->starter_type); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
153 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
154 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
155 | |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | /* |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
157 | * Calculate the needed yeast for this batch. |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | void EditProduct::calcYeast() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | { |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
161 | double sg = product->brew_fermenter_sg; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
162 | double use_cells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
163 | double needed = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
164 | double initcells = 0; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | bool maybe_starter = false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | qDebug() << "calcYeast()"; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | ui->yeastProcedure->setCurrentIndex(0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
170 | if (sg <= 1.0001 && product->fg > 1.000) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
171 | sg = product->fg; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
172 | else if (sg <= 1.0001) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
173 | sg = product->est_og; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
174 | double plato = Utils::sg_to_plato(sg); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
175 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
176 | double volume = product->brew_fermenter_volume; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
177 | if (volume > 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
178 | if (product->brew_fermenter_extrawater > 0) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
179 | volume += product->brew_fermenter_extrawater; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
180 | } else { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
181 | volume = product->batch_size - product->eq_trub_chiller_loss; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
182 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
183 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
184 | // Also in calcFermentables() |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
185 | //$('#yeast_cells').val(initcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
186 | |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | if (product->yeasts.size() == 0) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
188 | return; // No yeast in product. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
189 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
190 | for (int i = 0; i < product->yeasts.size(); i++) { |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
191 | if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { // Primary |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
192 | if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | * Dry yeast, build the formule with the yeast parameters. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
195 | * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
196 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | ui->yeastProcedure->setCurrentIndex(2); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
198 | ui->lo_gr_hlEdit->setValue(product->yeasts.at(i).y_gr_hl_lo); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
199 | ui->hi_gr_hlEdit->setValue(product->yeasts.at(i).y_gr_hl_hi); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
200 | ui->lo_sgEdit->setValue(product->yeasts.at(i).y_sg_lo); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | ui->hi_sgEdit->setValue(product->yeasts.at(i).y_sg_hi); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
202 | double og = product->yeasts.at(i).y_sg_lo; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
203 | double f1 = product->yeasts.at(i).y_gr_hl_lo / 100.0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
204 | double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
205 | double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
206 | qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
207 | double yeast_grams = round(volume * multiplier * 100.0) / 100.0; // * (100 / dataRecord.starter_viability), 2); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | ui->need_grEdit->setValue(yeast_grams); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | ui->pitch_grEdit->setValue(yeast_gr_hl); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | qDebug() << " need" << yeast_grams << "grams, gr/hl:" << yeast_gr_hl; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
213 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
214 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
215 | * Liquid, slant, culture etc. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | * pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | * and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
218 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | ui->yeastProcedure->setCurrentIndex(1); |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
220 | if (product->yeast_pitchrate == 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
221 | /* |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
222 | * No pitchrate yet, do a educated guess .. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
223 | */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
224 | if (product->yeasts.at(i).y_type == YEAST_TYPES_LAGER) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
225 | product->yeast_pitchrate = 1.5; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
226 | if (sg > 1.060) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
227 | product->yeast_pitchrate = 2.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
228 | } else if (product->yeasts.at(i).y_type == YEAST_TYPES_KVEIK) { // Real Kveik |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
229 | product->yeast_pitchrate = 0.075; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
230 | } else { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
231 | product->yeast_pitchrate = 0.75; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
232 | if (sg > 1.060) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
233 | product->yeast_pitchrate = 1.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
234 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
235 | is_changed(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
236 | ui->pitchrateEdit->setValue(product->yeast_pitchrate); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
237 | } |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
238 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
239 | initcells = (product->yeasts.at(i).y_cells / 1000000) * product->yeasts.at(i).y_amount * 0.97; // cells / ml. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
240 | if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
241 | initcells = (product->yeasts.at(i).y_cells / 1000000000) * product->yeasts.at(i).y_amount * 0.97; // 97% viability assumed. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
242 | |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
243 | needed = round(product->yeast_pitchrate * volume * plato * 10.0) / 10.0; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
244 | if (needed > initcells) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
245 | maybe_starter = true; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
246 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
247 | |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
248 | qDebug() << " pitchrate:" << product->yeast_pitchrate << "needed:" << needed << "initcells:" << initcells << "starter" << maybe_starter; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
249 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
250 | break; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
251 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
252 | } |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
253 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
254 | if (maybe_starter != product->starter_enable) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
255 | product->starter_enable = maybe_starter; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
256 | qDebug() << " Set starter enable" << maybe_starter; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
257 | is_changed(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
258 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
259 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
260 | if (product->starter_enable) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
261 | qDebug() << " Starter calculate.."; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
262 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
263 | const QStringList labels({tr("Method"), tr("Volume"), tr("Inj. factor"), tr("New cells"), tr("Total cells"), tr("Grow factor"), "" }); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
264 | ui->starterTable->show(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
265 | ui->starterTable->setEditTriggers(QAbstractItemView::NoEditTriggers); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
266 | ui->starterTable->clear(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
267 | ui->starterTable->setColumnCount(7); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
268 | ui->starterTable->setRowCount(0); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
269 | ui->starterTable->setColumnWidth(0, 130); /* Method */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
270 | ui->starterTable->setColumnWidth(1, 90); /* Volume */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
271 | ui->starterTable->setColumnWidth(2, 90); /* Inj. factor */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
272 | ui->starterTable->setColumnWidth(3, 90); /* New cells */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
273 | ui->starterTable->setColumnWidth(4, 90); /* Total cells */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
274 | ui->starterTable->setColumnWidth(5, 90); /* Grow factor */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
275 | ui->starterTable->setColumnWidth(6, 30); /* Edit button */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
276 | ui->starterTable->setHorizontalHeaderLabels(labels); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
277 | calcSteps(product->starter_type, initcells, needed); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
278 | } else { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
279 | ui->starterTable->hide(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
280 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
281 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
282 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
283 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
284 | /* |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
285 | * http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
286 | * |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
287 | * stype: 0=stirred, 1=shaken, 2=simple |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
288 | * totcells: initial cells |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
289 | * egrams: gram extract |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
290 | */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
291 | double EditProduct::getGrowthRate(int stype, double totcells, double egrams) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
292 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
293 | /* Cells per grams extract (B/g) */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
294 | double cpe = totcells / egrams; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
295 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
296 | if (cpe > 3.5) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
297 | return 0; // no growth |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
298 | if (stype == STARTERS_SIMPLE) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
299 | return 0.4; // simple starter |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
300 | if (stype == STARTERS_SHAKEN) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
301 | return 0.62; // shaken starter |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
302 | if (cpe <= 1.4) // stirred starter |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
303 | return 1.4; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
304 | return 2.33 - (.67 * cpe); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
305 | }; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
306 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
307 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
308 | StepResult EditProduct::calcStep(double svol, int stype, double start) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
309 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
310 | StepResult res; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
311 | double gperpoint = 2.72715; //number of grams of extract per point of starter gravity per liter |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
312 | double irate = round(start / svol * 10000.0) / 10.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
313 | double egrams = (product->starter_sg - 1) * svol * gperpoint; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
314 | double grate = getGrowthRate(stype, start, egrams); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
315 | double ncells = round(egrams * grate * 10.0) / 10.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
316 | double totcells = ncells + start; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
317 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
318 | res.svol = svol; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
319 | res.irate = irate; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
320 | res.ncells = ncells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
321 | res.totcells = totcells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
322 | res.growf = round((ncells / start) * 100.0) / 100.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
323 | qDebug() << " calcStep(" << svol << "," << stype << "," << start << ") irate" << irate |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
324 | << "ncells" << res.ncells << "totcells" << res.totcells << "growf" << res.growf; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
325 | return res; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
326 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
327 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
328 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
329 | /* |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
330 | * Calculate all starter steps. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
331 | * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
332 | * start: initial cells in billions |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
333 | * needed: needed cells in billions |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
334 | * |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
335 | * result: all values updated. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
336 | */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
337 | void EditProduct::calcSteps(int stype, double start, double needed) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
338 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
339 | int i, step, svol; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
340 | int lasti = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
341 | /* Erlenmeyer sizes */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
342 | const int uvols[] { 20, 40, 60, 80, 100, 150, 200, 250, 375, 500, 625, 750, 875, 1000, 1250, 1500, 2000, 2500, 3000, 4000, 5000 }; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
343 | int mvols = sizeof(uvols); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
344 | StepResult result; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
345 | QTableWidgetItem *item; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
346 | QWidget* pWidget; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
347 | QHBoxLayout* pLayout; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
348 | double tcells = start; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
349 | QIcon iconT; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
350 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
351 | iconT.addFile(QString::fromUtf8(":/icons/silk/pencil.png"), QSize(), QIcon::Normal, QIcon::Off); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
352 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
353 | if ((product->prop1_volume + product->prop2_volume + product->prop3_volume + product->prop4_volume) == 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
354 | /* |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
355 | * Auto calculate the starter. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
356 | */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
357 | qDebug() << " calcSteps() auto"; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
358 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
359 | if (start > needed) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
360 | return; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
361 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
362 | for (step = 1; step < 5; step++) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
363 | qDebug() << " step" << step; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
364 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
365 | for (i = lasti; i <= mvols; i++) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
366 | lasti = i; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
367 | svol = uvols[lasti]; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
368 | result = calcStep(svol, stype, tcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
369 | if (result.irate < 25) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
370 | // inocculation rate too low, backup one step and break out. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
371 | lasti = i - 1; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
372 | svol = uvols[lasti]; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
373 | result = calcStep(svol, stype, tcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
374 | break; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
375 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
376 | if (result.totcells > needed || i == mvols) { // hit the target or loops done |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
377 | break; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
378 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
379 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
380 | ui->starterTable->setRowCount(step); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
381 | item = new QTableWidgetItem(starters[stype]); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
382 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
383 | ui->starterTable->setItem(step -1, 0, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
384 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
385 | item = new QTableWidgetItem(QString("%1").arg(result.svol / 1000.0, 4, 'f', 3, '0')); // To liters |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
386 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
387 | ui->starterTable->setItem(step -1, 1, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
388 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
389 | item = new QTableWidgetItem(QString("%1").arg(result.irate, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
390 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
391 | ui->starterTable->setItem(step -1, 2, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
392 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
393 | item = new QTableWidgetItem(QString("%1").arg(result.ncells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
394 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
395 | ui->starterTable->setItem(step -1, 3, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
396 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
397 | item = new QTableWidgetItem(QString("%1").arg(result.totcells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
398 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
399 | ui->starterTable->setItem(step -1, 4, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
400 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
401 | item = new QTableWidgetItem(QString("%1").arg(result.growf, 3, 'f', 2, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
402 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
403 | ui->starterTable->setItem(step -1, 5, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
404 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
405 | pWidget = new QWidget(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
406 | QToolButton* btn_edit = new QToolButton(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
407 | btn_edit->setObjectName(QString("%1").arg(step - 1)); /* Send row with the button */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
408 | btn_edit->setIcon(iconT); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
409 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(yeast_starter_edit_clicked())); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
410 | pLayout = new QHBoxLayout(pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
411 | pLayout->addWidget(btn_edit); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
412 | pLayout->setContentsMargins(5, 0, 5, 0); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
413 | pWidget->setLayout(pLayout); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
414 | ui->starterTable->setCellWidget(step -1, 6, pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
415 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
416 | if (step == 1) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
417 | product->prop1_type = product->starter_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
418 | product->prop1_volume = result.svol / 1000.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
419 | } else if (step == 2) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
420 | product->prop2_type = product->starter_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
421 | product->prop2_volume = result.svol / 1000.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
422 | } else if (step == 3) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
423 | product->prop3_type = product->starter_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
424 | product->prop3_volume = result.svol / 1000.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
425 | } else if (step == 4) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
426 | product->prop4_type = product->starter_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
427 | product->prop4_volume = result.svol / 1000.0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
428 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
429 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
430 | tcells = result.totcells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
431 | if (result.totcells > needed) // Hit the target |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
432 | return; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
433 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
434 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
435 | } else { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
436 | /* |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
437 | * Recalculate the starter. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
438 | */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
439 | qDebug() << " calcSteps() recalculate"; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
440 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
441 | if (product->prop1_volume > 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
442 | result = calcStep(product->prop1_volume * 1000, product->prop1_type, tcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
443 | ui->starterTable->setRowCount(1); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
444 | item = new QTableWidgetItem(starters[product->prop1_type]); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
445 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
446 | ui->starterTable->setItem(0, 0, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
447 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
448 | item = new QTableWidgetItem(QString("%1").arg(result.svol / 1000.0, 4, 'f', 3, '0')); // To liters |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
449 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
450 | ui->starterTable->setItem(0, 1, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
451 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
452 | item = new QTableWidgetItem(QString("%1").arg(result.irate, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
453 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
454 | ui->starterTable->setItem(0, 2, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
455 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
456 | item = new QTableWidgetItem(QString("%1").arg(result.ncells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
457 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
458 | ui->starterTable->setItem(0, 3, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
459 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
460 | item = new QTableWidgetItem(QString("%1").arg(result.totcells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
461 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
462 | ui->starterTable->setItem(0, 4, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
463 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
464 | item = new QTableWidgetItem(QString("%1").arg(result.growf, 3, 'f', 2, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
465 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
466 | ui->starterTable->setItem(0, 5, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
467 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
468 | pWidget = new QWidget(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
469 | QToolButton* btn_edit = new QToolButton(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
470 | btn_edit->setObjectName(QString("0")); /* Send row with the button */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
471 | btn_edit->setIcon(iconT); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
472 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(yeast_starter_edit_clicked())); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
473 | pLayout = new QHBoxLayout(pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
474 | pLayout->addWidget(btn_edit); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
475 | pLayout->setContentsMargins(5, 0, 5, 0); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
476 | pWidget->setLayout(pLayout); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
477 | ui->starterTable->setCellWidget(0, 6, pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
478 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
479 | tcells = result.totcells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
480 | if (result.totcells > needed) { // Hit the target |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
481 | product->prop2_volume = product->prop3_volume = product->prop4_volume = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
482 | product->prop2_type = product->prop3_type = product->prop4_type = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
483 | return; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
484 | } else if (product->prop2_volume == 0) { // Extra step needed, start with the same size. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
485 | product->prop2_volume = product->prop1_volume; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
486 | product->prop2_type = product->prop1_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
487 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
488 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
489 | if (product->prop2_volume > 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
490 | result = calcStep(product->prop2_volume * 1000, product->prop2_type, tcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
491 | ui->starterTable->setRowCount(2); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
492 | item = new QTableWidgetItem(starters[product->prop2_type]); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
493 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
494 | ui->starterTable->setItem(1, 0, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
495 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
496 | item = new QTableWidgetItem(QString("%1").arg(result.svol / 1000.0, 4, 'f', 3, '0')); // To liters |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
497 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
498 | ui->starterTable->setItem(1, 1, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
499 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
500 | item = new QTableWidgetItem(QString("%1").arg(result.irate, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
501 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
502 | ui->starterTable->setItem(1, 2, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
503 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
504 | item = new QTableWidgetItem(QString("%1").arg(result.ncells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
505 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
506 | ui->starterTable->setItem(1, 3, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
507 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
508 | item = new QTableWidgetItem(QString("%1").arg(result.totcells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
509 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
510 | ui->starterTable->setItem(1, 4, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
511 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
512 | item = new QTableWidgetItem(QString("%1").arg(result.growf, 3, 'f', 2, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
513 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
514 | ui->starterTable->setItem(1, 5, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
515 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
516 | pWidget = new QWidget(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
517 | QToolButton* btn_edit = new QToolButton(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
518 | btn_edit->setObjectName(QString("1")); /* Send row with the button */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
519 | btn_edit->setIcon(iconT); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
520 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(yeast_starter_edit_clicked())); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
521 | pLayout = new QHBoxLayout(pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
522 | pLayout->addWidget(btn_edit); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
523 | pLayout->setContentsMargins(5, 0, 5, 0); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
524 | pWidget->setLayout(pLayout); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
525 | ui->starterTable->setCellWidget(1, 6, pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
526 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
527 | tcells = result.totcells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
528 | if (result.totcells > needed) { // Hit the target |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
529 | product->prop3_volume = product->prop4_volume = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
530 | product->prop3_type = product->prop4_type = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
531 | return; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
532 | } else if (product->prop3_volume == 0) { // Extra step needed, start with the same size. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
533 | product->prop3_volume = product->prop2_volume; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
534 | product->prop3_type = product->prop2_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
535 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
536 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
537 | if (product->prop3_volume > 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
538 | result = calcStep(product->prop3_volume * 1000, product->prop3_type, tcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
539 | ui->starterTable->setRowCount(3); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
540 | item = new QTableWidgetItem(starters[product->prop3_type]); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
541 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
542 | ui->starterTable->setItem(2, 0, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
543 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
544 | item = new QTableWidgetItem(QString("%1").arg(result.svol / 1000.0, 4, 'f', 3, '0')); // To liters |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
545 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
546 | ui->starterTable->setItem(2, 1, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
547 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
548 | item = new QTableWidgetItem(QString("%1").arg(result.irate, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
549 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
550 | ui->starterTable->setItem(2, 2, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
551 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
552 | item = new QTableWidgetItem(QString("%1").arg(result.ncells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
553 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
554 | ui->starterTable->setItem(2, 3, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
555 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
556 | item = new QTableWidgetItem(QString("%1").arg(result.totcells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
557 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
558 | ui->starterTable->setItem(2, 4, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
559 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
560 | item = new QTableWidgetItem(QString("%1").arg(result.growf, 3, 'f', 2, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
561 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
562 | ui->starterTable->setItem(2, 5, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
563 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
564 | pWidget = new QWidget(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
565 | QToolButton* btn_edit = new QToolButton(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
566 | btn_edit->setObjectName(QString("2")); /* Send row with the button */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
567 | btn_edit->setIcon(iconT); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
568 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(yeast_starter_edit_clicked())); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
569 | pLayout = new QHBoxLayout(pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
570 | pLayout->addWidget(btn_edit); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
571 | pLayout->setContentsMargins(5, 0, 5, 0); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
572 | pWidget->setLayout(pLayout); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
573 | ui->starterTable->setCellWidget(2, 6, pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
574 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
575 | tcells = result.totcells; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
576 | if (result.totcells > needed) { // Hit the target |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
577 | product->prop4_volume = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
578 | product->prop4_type = 0; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
579 | return; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
580 | } else if (product->prop4_volume == 0) { // Extra step needed, start with the same size. |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
581 | product->prop4_volume = product->prop3_volume; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
582 | product->prop4_type = product->prop3_type; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
583 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
584 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
585 | if (product->prop4_volume > 0) { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
586 | result = calcStep(product->prop4_volume * 1000, product->prop4_type, tcells); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
587 | ui->starterTable->setRowCount(4); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
588 | item = new QTableWidgetItem(starters[product->prop4_type]); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
589 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
590 | ui->starterTable->setItem(3, 0, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
591 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
592 | item = new QTableWidgetItem(QString("%1").arg(result.svol / 1000.0, 4, 'f', 3, '0')); // To liters |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
593 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
594 | ui->starterTable->setItem(3, 1, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
595 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
596 | item = new QTableWidgetItem(QString("%1").arg(result.irate, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
597 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
598 | ui->starterTable->setItem(3, 2, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
599 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
600 | item = new QTableWidgetItem(QString("%1").arg(result.ncells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
601 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
602 | ui->starterTable->setItem(3, 3, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
603 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
604 | item = new QTableWidgetItem(QString("%1").arg(result.totcells, 2, 'f', 1, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
605 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
606 | ui->starterTable->setItem(3, 4, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
607 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
608 | item = new QTableWidgetItem(QString("%1").arg(result.growf, 3, 'f', 2, '0')); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
609 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
610 | ui->starterTable->setItem(3, 5, item); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
611 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
612 | pWidget = new QWidget(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
613 | QToolButton* btn_edit = new QToolButton(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
614 | btn_edit->setObjectName(QString("3")); /* Send row with the button */ |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
615 | btn_edit->setIcon(iconT); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
616 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(yeast_starter_edit_clicked())); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
617 | pLayout = new QHBoxLayout(pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
618 | pLayout->addWidget(btn_edit); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
619 | pLayout->setContentsMargins(5, 0, 5, 0); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
620 | pWidget->setLayout(pLayout); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
621 | ui->starterTable->setCellWidget(3, 6, pWidget); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
622 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
623 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
624 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
625 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
626 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
627 | void EditProduct::yeast_prod_date_clicked() |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
628 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
629 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
630 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
631 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
632 | void EditProduct::yeast_method_changed(int val) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
633 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
634 | qDebug() << "yeast_method_changed" << val; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
635 | product->starter_type = val; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
636 | calcYeast(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
637 | is_changed(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
638 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
639 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
640 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
641 | void EditProduct::yeast_starter_sg_changed(double val) |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
642 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
643 | qDebug() << "yeast_starter_sg_changed" << val; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
644 | product->starter_sg = val; |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
645 | calcYeast(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
646 | is_changed(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
647 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
648 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
649 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
650 | void EditProduct::yeast_pitchrate_button_clicked() |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
651 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
652 | } |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
653 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
654 | |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
655 | void EditProduct::yeast_starter_edit_clicked() |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
656 | { |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
657 | QToolButton *pb = qobject_cast<QToolButton *>(QObject::sender()); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
658 | int row = pb->objectName().toInt(); |
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
659 | qDebug() << "yeast_starter_edit_clicked" << row; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
660 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
661 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
662 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
663 | void EditProduct::addYeastRow_clicked() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
664 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
665 | Yeasts newy; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
666 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
667 | qDebug() << "Add yeast row"; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
668 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
669 | for (int i = 0; i < product->yeasts.size(); i++) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
670 | if (product->yeasts.at(i).y_amount == 0) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
671 | return; // Add only one at a time. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
672 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
673 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
674 | newy.y_name = "Select one"; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
675 | newy.y_laboratory = ""; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
676 | newy.y_product_id = ""; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
677 | newy.y_amount = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
678 | newy.y_type = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
679 | newy.y_form = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
680 | newy.y_min_temperature = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
681 | newy.y_max_temperature = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
682 | newy.y_flocculation = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
683 | newy.y_attenuation = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
684 | newy.y_cells = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
685 | newy.y_tolerance = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
686 | newy.y_inventory = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
687 | newy.y_use = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
688 | newy.y_sta1 = false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
689 | newy.y_bacteria = false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
690 | newy.y_harvest_top = false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
691 | newy.y_harvest_time = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
692 | newy.y_pitch_temperature = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
693 | newy.y_pofpos = false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
694 | newy.y_zymocide = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
695 | newy.y_gr_hl_lo = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
696 | newy.y_sg_lo = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
697 | newy.y_gr_hl_hi = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
698 | newy.y_sg_hi = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
699 | newy.y_cost = 0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
700 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
701 | product->yeasts.append(newy); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
702 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
703 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
704 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
705 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
706 | void EditProduct::deleteYeastRow_clicked() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
707 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
708 | if (product->locked || product->yeasts.size() < 1) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
709 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
710 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
711 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
712 | int row = pb->objectName().toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
713 | qDebug() << "Delete yeast row" << row << product->yeasts.size(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
714 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
715 | int rc = QMessageBox::warning(this, tr("Delete yeast"), tr("Delete %1").arg(product->yeasts.at(row).y_name), |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
716 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
717 | if (rc == QMessageBox::No) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
718 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
719 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
720 | product->yeasts.removeAt(row); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
721 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
722 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
723 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
724 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
725 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
726 | void EditProduct::yeast_amount_changed(double val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
727 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
728 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
729 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
730 | qDebug() << "yeast_amount_changed()" << product->yeasts_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
731 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
732 | if (product->yeasts.at(product->yeasts_row).y_form == 0) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
733 | product->yeasts[product->yeasts_row].y_amount = val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
734 | item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
735 | } else if (product->yeasts.at(product->yeasts_row).y_form == 1) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
736 | product->yeasts[product->yeasts_row].y_amount = val / 1000.0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
737 | item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
738 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
739 | product->yeasts[product->yeasts_row].y_amount = val / 1000.0; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
740 | item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
741 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
742 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
743 | ui->yeastsTable->setItem(product->yeasts_row, 9, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
744 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
745 | calcYeast(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
746 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
747 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
748 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
749 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
750 | void EditProduct::yeast_select_changed(int val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
751 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
752 | QSqlQuery query; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
753 | bool instock = yinstockEdit->isChecked(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
754 | QString w; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
755 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
756 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
757 | if (val < 1) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
758 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
759 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
760 | qDebug() << "yeast_select_changed()" << product->yeasts_row << val << instock; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
761 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
762 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
763 | * Search the yeast pointed by the index and instock flag. |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
764 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
765 | QString sql = "SELECT name,laboratory,product_id,type,form,min_temperature,max_temperature,flocculation,attenuation," |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
766 | "cells,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide," |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
767 | "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost FROM inventory_yeasts "; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
768 | if (instock) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
769 | sql.append("WHERE inventory > 0 "); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
770 | sql.append("ORDER BY laboratory,product_id,name"); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
771 | query.prepare(sql); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
772 | query.exec(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
773 | query.first(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
774 | for (int i = 0; i < (val - 1); i++) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
775 | query.next(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
776 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
777 | qDebug() << "found" << query.value(0).toString() << query.value(2).toString(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
778 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
779 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
780 | * Replace the yeast record contents |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
781 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
782 | product->yeasts[product->yeasts_row].y_name = query.value(0).toString(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
783 | product->yeasts[product->yeasts_row].y_laboratory = query.value(1).toString(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
784 | product->yeasts[product->yeasts_row].y_product_id = query.value(2).toString(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
785 | product->yeasts[product->yeasts_row].y_type = query.value(3).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
786 | product->yeasts[product->yeasts_row].y_form = query.value(4).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
787 | product->yeasts[product->yeasts_row].y_min_temperature = query.value(5).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
788 | product->yeasts[product->yeasts_row].y_max_temperature = query.value(6).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
789 | product->yeasts[product->yeasts_row].y_flocculation = query.value(7).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
790 | product->yeasts[product->yeasts_row].y_attenuation = query.value(8).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
791 | product->yeasts[product->yeasts_row].y_cells = query.value(9).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
792 | product->yeasts[product->yeasts_row].y_tolerance = query.value(10).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
793 | product->yeasts[product->yeasts_row].y_sta1 = query.value(11).toInt() ? true:false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
794 | product->yeasts[product->yeasts_row].y_bacteria = query.value(12).toInt() ? true:false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
795 | product->yeasts[product->yeasts_row].y_harvest_top = query.value(13).toInt() ? true:false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
796 | product->yeasts[product->yeasts_row].y_harvest_time = query.value(14).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
797 | product->yeasts[product->yeasts_row].y_pitch_temperature = query.value(15).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
798 | product->yeasts[product->yeasts_row].y_pofpos = query.value(16).toInt() ? true:false; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
799 | product->yeasts[product->yeasts_row].y_zymocide = query.value(17).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
800 | product->yeasts[product->yeasts_row].y_gr_hl_lo = query.value(18).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
801 | product->yeasts[product->yeasts_row].y_sg_lo = query.value(19).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
802 | product->yeasts[product->yeasts_row].y_gr_hl_hi = query.value(20).toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
803 | product->yeasts[product->yeasts_row].y_sg_hi = query.value(21).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
804 | product->yeasts[product->yeasts_row].y_cost = query.value(22).toDouble(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
805 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
806 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
807 | * Update the visible fields |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
808 | */ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
809 | ynameEdit->setText(product->yeasts.at(product->yeasts_row).y_name); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
810 | ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).y_laboratory); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
811 | yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).y_product_id); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
812 | if (product->yeasts.at(product->yeasts_row).y_form == 0) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
813 | yamountEdit->setDecimals(0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
814 | yamountEdit->setSingleStep(1.0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
815 | yamountLabel->setText(tr("Total packs:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
816 | } else if (product->yeasts.at(product->yeasts_row).y_form == 1) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
817 | yamountEdit->setDecimals(1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
818 | yamountEdit->setSingleStep(0.5); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
819 | yamountLabel->setText(tr("Amount in gr:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
820 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
821 | yamountEdit->setDecimals(1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
822 | yamountEdit->setSingleStep(0.5); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
823 | yamountLabel->setText(tr("Amount in ml:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
824 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
825 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
826 | ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_name)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
827 | ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_laboratory)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
828 | ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_product_id)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
829 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
830 | item = new QTableWidgetItem(yeast_forms[product->yeasts.at(product->yeasts_row).y_form]); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
831 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
832 | ui->yeastsTable->setItem(product->yeasts_row, 3, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
833 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
834 | item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_min_temperature, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
835 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
836 | ui->yeastsTable->setItem(product->yeasts_row, 5, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
837 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
838 | item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_max_temperature, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
839 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
840 | ui->yeastsTable->setItem(product->yeasts_row, 6, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
841 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
842 | item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_tolerance, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
843 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
844 | ui->yeastsTable->setItem(product->yeasts_row, 7, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
845 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
846 | item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_attenuation, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
847 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
848 | ui->yeastsTable->setItem(product->yeasts_row, 8, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
849 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
850 | calcYeast(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
851 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
852 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
853 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
854 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
855 | void EditProduct::yeast_instock_changed(bool val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
856 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
857 | QSqlQuery query; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
858 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
859 | qDebug() << "yeast_instock_changed()" << product->yeasts_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
860 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
861 | this->yselectEdit->setCurrentIndex(-1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
862 | this->yselectEdit->clear(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
863 | QString sql = "SELECT name,laboratory,product_id,inventory FROM inventory_yeasts "; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
864 | if (val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
865 | sql.append("WHERE inventory > 0 "); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
866 | sql.append("ORDER BY laboratory,product_id,name"); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
867 | query.prepare(sql); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
868 | query.exec(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
869 | query.first(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
870 | this->yselectEdit->addItem(""); // Start with empty value |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
871 | for (int i = 0; i < query.size(); i++) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
872 | this->yselectEdit->addItem(query.value(1).toString()+" - "+query.value(2).toString()+" "+query.value(0).toString() + |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
873 | QString(" (%1 gr)").arg(query.value(3).toDouble() * 1000.0, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
874 | query.next(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
875 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
876 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
877 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
878 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
879 | void EditProduct::yeast_useat_changed(int val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
880 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
881 | qDebug() << "yeast_useat_changed()" << product->yeasts_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
882 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
883 | product->yeasts[product->yeasts_row].y_use = val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
884 | QTableWidgetItem *item = new QTableWidgetItem(yeast_use[val]); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
885 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
886 | ui->yeastsTable->setItem(product->yeasts_row, 5, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
887 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
888 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
889 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
890 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
891 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
892 | void EditProduct::editYeastRow_clicked() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
893 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
894 | QSqlQuery query; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
895 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
896 | if (product->locked) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
897 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
898 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
899 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
900 | product->yeasts_row = pb->objectName().toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
901 | qDebug() << "Edit yeast row" << product->yeasts_row; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
902 | Yeasts backup = product->yeasts.at(product->yeasts_row); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
903 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
904 | QDialog* dialog = new QDialog(this); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
905 | dialog->resize(738, 260); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
906 | QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
907 | buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
908 | buttonBox->setGeometry(QRect(30, 210, 671, 32)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
909 | buttonBox->setLayoutDirection(Qt::LeftToRight); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
910 | buttonBox->setOrientation(Qt::Horizontal); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
911 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
912 | buttonBox->setCenterButtons(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
913 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
914 | QLabel *nameLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
915 | nameLabel->setObjectName(QString::fromUtf8("nameLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
916 | nameLabel->setText(tr("Yeast name:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
917 | nameLabel->setGeometry(QRect(10, 10, 141, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
918 | nameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
919 | QLabel *laboratoryLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
920 | laboratoryLabel->setObjectName(QString::fromUtf8("laboratoryLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
921 | laboratoryLabel->setText(tr("Laboratory:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
922 | laboratoryLabel->setGeometry(QRect(10, 40, 141, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
923 | laboratoryLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
924 | QLabel *product_idLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
925 | product_idLabel->setObjectName(QString::fromUtf8("product_idLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
926 | product_idLabel->setText(tr("Laboratory:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
927 | product_idLabel->setGeometry(QRect(10, 70, 141, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
928 | product_idLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
929 | QLabel *selectLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
930 | selectLabel->setObjectName(QString::fromUtf8("selectLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
931 | selectLabel->setText(tr("Select yeast:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
932 | selectLabel->setGeometry(QRect(10,100, 141, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
933 | selectLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
934 | QLabel *instockLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
935 | instockLabel->setObjectName(QString::fromUtf8("instockLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
936 | instockLabel->setText(tr("In stock:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
937 | instockLabel->setGeometry(QRect(525,100, 121, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
938 | instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
939 | yamountLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
940 | yamountLabel->setObjectName(QString::fromUtf8("amountLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
941 | if (product->yeasts.at(product->yeasts_row).y_form == 0) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
942 | yamountLabel->setText(tr("Total packs:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
943 | else if (product->yeasts.at(product->yeasts_row).y_form == 1) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
944 | yamountLabel->setText(tr("Amount in gr:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
945 | else |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
946 | yamountLabel->setText(tr("Amount in ml:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
947 | yamountLabel->setGeometry(QRect(10, 130, 141, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
948 | yamountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
949 | QLabel *useatLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
950 | useatLabel->setObjectName(QString::fromUtf8("useatLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
951 | useatLabel->setText(tr("Use at:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
952 | useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
953 | useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
954 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
955 | ynameEdit = new QLineEdit(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
956 | ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
957 | ynameEdit->setText(product->yeasts.at(product->yeasts_row).y_name); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
958 | ynameEdit->setGeometry(QRect(160, 10, 511, 23)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
959 | ynameEdit->setReadOnly(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
960 | ylaboratoryEdit = new QLineEdit(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
961 | ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
962 | ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).y_laboratory); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
963 | ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
964 | ylaboratoryEdit->setReadOnly(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
965 | yproduct_idEdit = new QLineEdit(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
966 | yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
967 | yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).y_product_id); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
968 | yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
969 | yproduct_idEdit->setReadOnly(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
970 | yselectEdit = new QComboBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
971 | yselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
972 | yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
973 | yinstockEdit = new QCheckBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
974 | yinstockEdit->setObjectName(QString::fromUtf8("yinstockEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
975 | yinstockEdit->setGeometry(QRect(655,100, 85, 21)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
976 | yinstockEdit->setChecked(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
977 | yamountEdit = new QDoubleSpinBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
978 | yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
979 | yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
980 | yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
981 | yamountEdit->setAccelerated(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
982 | if (product->yeasts.at(product->yeasts_row).y_form == 0) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
983 | yamountEdit->setDecimals(0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
984 | yamountEdit->setSingleStep(1.0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
985 | yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
986 | } else if (product->yeasts.at(product->yeasts_row).y_form == 1) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
987 | yamountEdit->setDecimals(1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
988 | yamountEdit->setSingleStep(0.5); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
989 | yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
990 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
991 | yamountEdit->setDecimals(1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
992 | yamountEdit->setSingleStep(0.5); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
993 | yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
994 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
995 | yamountEdit->setMaximum(1000000000.0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
996 | useatEdit = new QComboBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
997 | useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
998 | useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
999 | useatEdit->addItem(tr("Primary")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1000 | useatEdit->addItem(tr("Secondary")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1001 | useatEdit->addItem(tr("Tertiary")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1002 | useatEdit->addItem(tr("Bottle")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1003 | useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).y_use); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1004 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1005 | yeast_instock_changed(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1006 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1007 | connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_select_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1008 | connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_amount_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1009 | connect(useatEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_useat_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1010 | connect(yinstockEdit, &QCheckBox::stateChanged, this, &EditProduct::yeast_instock_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1011 | connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1012 | connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1013 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1014 | dialog->setModal(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1015 | dialog->exec(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1016 | if (dialog->result() == QDialog::Rejected) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1017 | qDebug() << "reject and rollback"; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1018 | product->yeasts[product->yeasts_row] = backup; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1019 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1020 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1021 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1022 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1023 | disconnect(yselectEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1024 | disconnect(yamountEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1025 | disconnect(useatEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1026 | disconnect(yinstockEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1027 | disconnect(buttonBox, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1028 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1029 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1030 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1031 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1032 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1033 | void EditProduct::adjustYeasts(double factor) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1034 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1035 | double amount; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1036 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1037 | if (product->yeasts.size() == 0) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1038 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1039 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1040 | for (int i = 0; i < product->yeasts.size(); i++) { |
195
9887278c4fbe
The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
1041 | if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { // Only adjust dry yeast |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1042 | amount = product->yeasts.at(i).y_amount * factor; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1043 | product->yeasts[i].y_amount = amount; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1044 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1045 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1046 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1047 |