Mon, 30 Jan 2023 17:05:13 +0100
Added yeastpack editor. Expanded the database upgrade. On startup, recount the yeastpack used fields.
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 4, hops |
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 hope 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 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | bool EditProduct::hop_sort_test(const Hops &D1, const Hops &D2) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | { |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
24 | if (D1.useat > D2.useat) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | return false; |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
26 | if (D1.useat < D2.useat) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | return true; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | /* Same useat moments, test time. */ |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
29 | if (D1.time < D2.time) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | return false; |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
31 | if (D1.time > D2.time) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | return true; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | /* Finally consider the amounts */ |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
34 | return (D1.amount > D2.amount); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | |
305
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
38 | bool EditProduct::block_hop(int stage, int useat) |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
39 | { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
40 | if (stage > PROD_STAGE_BREW && useat < HOP_USEAT_DRY_HOP) |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
41 | return true; |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
42 | return false; |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
43 | } |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
44 | |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
45 | |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | void EditProduct::refreshHops() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | QString w; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | QWidget* pWidget; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | QHBoxLayout* pLayout; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | std::sort(product->hops.begin(), product->hops.end(), hop_sort_test); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | const QStringList labels({tr("Origin"), tr("Hop"), tr("Type"), tr("Form"), tr("Alpha"), tr("Use at"), tr("Time"), |
178
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
56 | tr("IBU"), 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
|
57 | |
178
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
58 | ui->hopsTable->setColumnCount(12); |
464
1fed3ff9a64e
Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
454
diff
changeset
|
59 | ui->hopsTable->setColumnWidth(0, 150); /* Origin */ |
1fed3ff9a64e
Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
454
diff
changeset
|
60 | ui->hopsTable->setColumnWidth(1, 245); /* Hop */ |
178
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
61 | ui->hopsTable->setColumnWidth(2, 74); /* Type */ |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | ui->hopsTable->setColumnWidth(3, 84); /* Form */ |
178
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
63 | ui->hopsTable->setColumnWidth(4, 55); /* Alpha% */ |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | ui->hopsTable->setColumnWidth(5, 75); /* Added */ |
178
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
65 | ui->hopsTable->setColumnWidth(6, 65); /* Time */ |
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
66 | ui->hopsTable->setColumnWidth(7, 50); /* IBU */ |
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
67 | ui->hopsTable->setColumnWidth(8, 80); /* Amount */ |
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
68 | ui->hopsTable->setColumnWidth(9, 80); /* Stock */ |
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
69 | ui->hopsTable->setColumnWidth(10, 80); /* Delete */ |
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
70 | ui->hopsTable->setColumnWidth(11, 80); /* Edit */ |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | ui->hopsTable->setHorizontalHeaderLabels(labels); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | ui->hopsTable->verticalHeader()->hide(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | ui->hopsTable->setRowCount(product->hops.size()); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | for (int i = 0; i < product->hops.size(); i++) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
77 | ui->hopsTable->setItem(i, 0, new QTableWidgetItem(product->hops.at(i).origin)); |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
78 | ui->hopsTable->setItem(i, 1, new QTableWidgetItem(product->hops.at(i).name)); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
80 | item = new QTableWidgetItem(QCoreApplication::translate("HopTypes", g_hop_types[product->hops.at(i).type])); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | 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
|
82 | ui->hopsTable->setItem(i, 2, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
84 | item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[product->hops.at(i).form])); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | 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
|
86 | ui->hopsTable->setItem(i, 3, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
88 | item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(i).alpha, 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->hopsTable->setItem(i, 4, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
92 | item = new QTableWidgetItem(QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat])); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | 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
|
94 | ui->hopsTable->setItem(i, 5, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
96 | if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4) { // Boil or whirlpool |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
97 | item = new QTableWidgetItem(QString("%1 min.").arg(product->hops.at(i).time, 1, 'f', 0, '0')); |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
98 | } else if (product->hops.at(i).useat == 5) { // Dry-hop |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
99 | item = new QTableWidgetItem(QString("%1 days.").arg(product->hops.at(i).time / 1440, 1, 'f', 0, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | item = new QTableWidgetItem(QString("")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | 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
|
104 | ui->hopsTable->setItem(i, 6, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
106 | double ibu = Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->est_og3, product->batch_size, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
107 | product->hops.at(i).amount, product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
108 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
109 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
110 | product->hops.at(i).utilisation, product->hops.at(i).bu_factor); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | 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
|
113 | ui->hopsTable->setItem(i, 7, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
115 | if (product->hops.at(i).amount < 1.0) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
116 | item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(i).amount * 1000.0, 2, 'f', 1, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | } else { |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
118 | item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(i).amount, 4, 'f', 3, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | 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
|
121 | ui->hopsTable->setItem(i, 8, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
305
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
123 | if (block_hop(product->stage, product->hops.at(i).useat)) { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
124 | item = new QTableWidgetItem(QString("")); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
125 | } else { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
126 | if (product->hops.at(i).inventory < 1.0) { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
127 | item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(i).inventory * 1000.0, 2, 'f', 1, '0')); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
128 | } else { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
129 | item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(i).inventory, 4, 'f', 3, '0')); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
130 | } |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
131 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
132 | if (product->hops.at(i).inventory < product->hops.at(i).amount) |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
133 | item->setForeground(QBrush(QColor(Qt::red))); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
134 | } |
178
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
135 | ui->hopsTable->setItem(i, 9, item); |
1091fd9feffe
Add hops inventory update during product load.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
136 | |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | /* Add the Delete row button */ |
305
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
138 | if (block_hop(product->stage, product->hops.at(i).useat)) { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
139 | item = new QTableWidgetItem(""); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
140 | item->setToolTip(tr("Hop already used")); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
141 | ui->hopsTable->setItem(i, 10, item); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
142 | item = new QTableWidgetItem(""); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
143 | item->setToolTip(tr("Hop already used")); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
144 | ui->hopsTable->setItem(i, 11, item); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
145 | } else { |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
146 | pWidget = new QWidget(); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
147 | QPushButton* btn_dele = new QPushButton(); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
148 | btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
149 | btn_dele->setText(tr("Delete")); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
150 | connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteHopRow_clicked())); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
151 | pLayout = new QHBoxLayout(pWidget); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
152 | pLayout->addWidget(btn_dele); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
153 | pLayout->setContentsMargins(5, 0, 5, 0); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
154 | pWidget->setLayout(pLayout); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
155 | ui->hopsTable->setCellWidget(i, 10, pWidget); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | |
305
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
157 | pWidget = new QWidget(); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
158 | QPushButton* btn_edit = new QPushButton(); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
159 | btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
160 | btn_edit->setText(tr("Edit")); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
161 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(editHopRow_clicked())); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
162 | pLayout = new QHBoxLayout(pWidget); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
163 | pLayout->addWidget(btn_edit); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
164 | pLayout->setContentsMargins(5, 0, 5, 0); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
165 | pWidget->setLayout(pLayout); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
166 | ui->hopsTable->setCellWidget(i, 11, pWidget); |
35ce719998e1
Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
167 | } |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | void EditProduct::hop_Flavour_valueChanged(int value) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | if (value < 20) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | ui->hop_tasteShow->setStyleSheet(bar_20); |
230
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
176 | ui->hop_tasteShow->setFormat(tr("Very low")); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | } else { |
230
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
178 | double s1 = 20.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
179 | if (value < 40) { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
180 | ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
181 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #008C00, stop: 1 #008C00);}").arg(s1).arg(s1)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
182 | ui->hop_tasteShow->setFormat(tr("Low")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
183 | } else { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
184 | double s2 = 40.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
185 | if (value < 60) { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
186 | ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
187 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: 1 #008C00" |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
188 | ");}").arg(s1).arg(s1).arg(s2).arg(s2)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
189 | ui->hop_tasteShow->setFormat(tr("Moderate")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
190 | } else { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
191 | double s3 = 60.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
192 | if (value < 80) { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
193 | ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
194 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
195 | "stop: %6 #00AC00, stop: 1 #00AC00" |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
196 | ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
197 | ui->hop_tasteShow->setFormat(tr("High")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
198 | } else { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
199 | double s4 = 80.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
200 | ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
201 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
202 | "stop: %6 #00AC00, stop: %7 #00AC00, stop: %8 #00CC00, stop: 1 #00CC00" |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
203 | ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3).arg(s4).arg(s4)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
204 | ui->hop_tasteShow->setFormat(tr("Very high")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
205 | } |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
206 | } |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
207 | } |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | void EditProduct::hop_Aroma_valueChanged(int value) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
213 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
214 | if (value < 20) { |
230
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
215 | ui->hop_aromaShow->setStyleSheet(bar_20); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | ui->hop_aromaShow->setFormat(tr("Very low")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | } else { |
230
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
218 | double s1 = 20.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
219 | if (value < 40) { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
220 | ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
221 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #008C00, stop: 1 #008C00);}").arg(s1).arg(s1)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
222 | ui->hop_aromaShow->setFormat(tr("Low")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
223 | } else { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
224 | double s2 = 40.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
225 | if (value < 60) { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
226 | ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
227 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: 1 #008C00" |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
228 | ");}").arg(s1).arg(s1).arg(s2).arg(s2)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
229 | ui->hop_aromaShow->setFormat(tr("Moderate")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
230 | } else { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
231 | double s3 = 60.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
232 | if (value < 80) { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
233 | ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
234 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
235 | "stop: %6 #00AC00, stop: 1 #00AC00" |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
236 | ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
237 | ui->hop_aromaShow->setFormat(tr("High")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
238 | } else { |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
239 | double s4 = 80.0 / value; |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
240 | ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
241 | "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, " |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
242 | "stop: %6 #00AC00, stop: %7 #00AC00, stop: %8 #00CC00, stop: 1 #00CC00" |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
243 | ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3).arg(s4).arg(s4)); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
244 | ui->hop_aromaShow->setFormat(tr("Very high")); |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
245 | } |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
246 | } |
b68c0c61d261
Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents:
215
diff
changeset
|
247 | } |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
248 | } |
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 | |
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 | void EditProduct::calcIBUs() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
253 | { |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
254 | double hop_flavour = 0, hop_aroma = 0, ibus = 0, ferm_ibus = 0; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
255 | |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
256 | product->hops_ok = true; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
257 | for (int i = 0; i < product->hops.size(); i++) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
258 | |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
259 | ibus += Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->est_og3, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
260 | product->batch_size, product->hops.at(i).amount, |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
261 | product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
262 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
263 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
264 | product->hops.at(i).utilisation, product->hops.at(i).bu_factor); |
398
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
265 | if (product->stage > PROD_STAGE_BREW) |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
266 | ferm_ibus += Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->brew_preboil_sg, product->brew_fermenter_sg, |
413
8ea791d4cab6
Version 0.2.28. Use calculated hop absorption during boil to correct the volume to the fermenter.
Michiel Broek <mbroek@mbse.eu>
parents:
399
diff
changeset
|
267 | product->brew_fermenter_volume + product->brew_fermenter_tcloss + product->boil_absorb, product->hops.at(i).amount, |
398
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
268 | product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
269 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
270 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
271 | product->hops.at(i).utilisation, product->hops.at(i).bu_factor); |
398
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
272 | else |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
273 | ferm_ibus += Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->est_og3, |
413
8ea791d4cab6
Version 0.2.28. Use calculated hop absorption during boil to correct the volume to the fermenter.
Michiel Broek <mbroek@mbse.eu>
parents:
399
diff
changeset
|
274 | product->brew_fermenter_volume + product->brew_fermenter_tcloss + product->boil_absorb, product->hops.at(i).amount, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
275 | product->hops.at(i).time, product->hops.at(i).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
276 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
277 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
278 | product->hops.at(i).utilisation, product->hops.at(i).bu_factor); |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
279 | |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
280 | hop_flavour += Utils::hopFlavourContribution(product->hops.at(i).time, product->batch_size, product->hops.at(i).useat, |
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
281 | product->hops.at(i).amount, product->hops.at(i).form); |
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
282 | hop_aroma += Utils::hopAromaContribution(product->hops.at(i).time, product->batch_size, product->hops.at(i).useat, |
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
283 | product->hops.at(i).amount, product->hops.at(i).form); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
284 | if ((((product->inventory_reduced <= PROD_STAGE_BREW) && (product->hops.at(i).useat <= HOP_USEAT_WHIRLPOOL)) || |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
285 | ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->hops.at(i).useat == HOP_USEAT_DRY_HOP))) && |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
286 | (product->hops.at(i).inventory < product->hops.at(i).amount)) |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
287 | product->hops_ok = false; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
288 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
289 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
290 | hop_flavour = round(hop_flavour * 1000.0 / 5.0) / 10; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
291 | hop_aroma = round(hop_aroma * 1000.0 / 6.0) / 10; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
292 | if (hop_flavour > 100) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
293 | hop_flavour = 100; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
294 | if (hop_aroma > 100) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
295 | hop_aroma = 100; |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
296 | qDebug() << "ibu" << product->est_ibu << ibus << "flavour" << hop_flavour << "aroma" << hop_aroma << "method" << product->ibu_method |
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
297 | << "fermenter" << ferm_ibus << "supplies" << product->hops_ok; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
298 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
299 | product->est_ibu = ibus; |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
300 | product->brew_fermenter_ibu = ferm_ibus; |
398
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
301 | if (product->stage > PROD_STAGE_BREW) { |
399
4b9aaf86094e
Prompts corrections and updated translations. Minor layout changes so the prompts will fit.
Michiel Broek <mbroek@mbse.eu>
parents:
398
diff
changeset
|
302 | ui->est_ibuLabel->setText(tr("Final IBU:")); |
398
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
303 | ui->est_ibuEdit->setValue(product->brew_fermenter_ibu); |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
304 | ui->est_ibuShow->setValue(product->brew_fermenter_ibu); |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
305 | } else { |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
306 | ui->est_ibuEdit->setValue(product->est_ibu); |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
307 | ui->est_ibuShow->setValue(product->est_ibu); |
49cf387e9070
After brewing show final IBU on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents:
380
diff
changeset
|
308 | } |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
309 | ui->est_ibu2Edit->setValue(product->est_ibu); |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
310 | ui->brew_fermentibuShow->setValue(product->brew_fermenter_ibu); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
311 | ui->hop_tasteShow->setValue(hop_flavour); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
312 | ui->hop_aromaShow->setValue(hop_aroma); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
313 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
314 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
315 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
316 | void EditProduct::addHopRow_clicked() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
317 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
318 | Hops newh; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
319 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
320 | qDebug() << "Add hop row"; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
321 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
322 | for (int i = 0; i < product->hops.size(); i++) { |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
323 | if (product->hops.at(i).amount == 0 && product->hops.at(i).alpha == 0) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
324 | 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
|
325 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
326 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
327 | newh.name = "Select one"; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
328 | newh.origin = ""; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
329 | newh.amount = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
330 | newh.cost = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
331 | newh.type = HOP_TYPE_BITTERING; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
332 | newh.form = HOP_FORMS_PELLET; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
333 | newh.useat = HOP_USEAT_BOIL; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
334 | newh.time = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
335 | newh.alpha = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
336 | newh.beta = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
337 | newh.hsi = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
338 | newh.humulene = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
339 | newh.caryophyllene = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
340 | newh.cohumulone = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
341 | newh.myrcene = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
342 | newh.total_oil = 0; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
343 | newh.inventory = 0; |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
344 | newh.utilisation = my_ut_pellet; |
375
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
345 | newh.bu_factor = 1; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
346 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
347 | product->hops.append(newh); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
348 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
349 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
350 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
351 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
352 | void EditProduct::deleteHopRow_clicked() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
353 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
354 | if (product->locked || product->hops.size() < 1) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
355 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
356 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
357 | 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
|
358 | int row = pb->objectName().toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
359 | qDebug() << "Delete hop row" << row << product->hops.size(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
360 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
361 | int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(product->hops.at(row).name), |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
362 | 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
|
363 | if (rc == QMessageBox::No) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
364 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
365 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
366 | product->hops.removeAt(row); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
367 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
368 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
369 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
370 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
371 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
372 | void EditProduct::hop_amount_changed(double val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
373 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
374 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
375 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
376 | qDebug() << "hop_amount_changed()" << product->hops_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
377 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
378 | product->hops[product->hops_row].amount = val / 1000.0; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
379 | item = new QTableWidgetItem(QString("%1 gr").arg(val, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
380 | 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
|
381 | ui->hopsTable->setItem(product->hops_row, 8, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
382 | |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
383 | double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, product->est_og3, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
384 | product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
385 | product->hops.at(product->hops_row).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
386 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
387 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
388 | product->hops.at(product->hops_row).utilisation, product->hops.at(product->hops_row).bu_factor); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
389 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
390 | ibuEdit->setValue(ibu); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
391 | item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
392 | 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
|
393 | ui->hopsTable->setItem(product->hops_row, 7, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
394 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
395 | calcIBUs(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
396 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
397 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
398 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
399 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
400 | void EditProduct::hop_time_changed(int val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
401 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
402 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
403 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
404 | qDebug() << "hop_time_changed()" << product->hops_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
405 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
406 | if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) { |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
407 | item = new QTableWidgetItem(QString("%1 min.").arg(val, 1, 'f', 0, '0')); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
408 | product->hops[product->hops_row].time = val; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
409 | } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) { |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
410 | item = new QTableWidgetItem(QString("%1 days.").arg(val, 1, 'f', 0, '0')); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
411 | product->hops[product->hops_row].time = val * 1440; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
412 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
413 | item = new QTableWidgetItem(QString("")); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
414 | product->hops[product->hops_row].time = val; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
415 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
416 | 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
|
417 | ui->hopsTable->setItem(product->hops_row, 6, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
418 | |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
419 | double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, product->est_og3, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
420 | product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
421 | product->hops.at(product->hops_row).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
422 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
423 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
424 | product->hops.at(product->hops_row).utilisation, product->hops.at(product->hops_row).bu_factor); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
425 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
426 | ibuEdit->setValue(ibu); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
427 | item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
428 | 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
|
429 | ui->hopsTable->setItem(product->hops_row, 7, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
430 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
431 | calcIBUs(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
432 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
433 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
434 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
435 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
436 | void EditProduct::hop_select_changed(int val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
437 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
438 | QSqlQuery query; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
439 | bool instock = hinstockEdit->isChecked(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
440 | QString w; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
441 | QTableWidgetItem *item; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
442 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
443 | if (val < 1) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
444 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
445 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
446 | qDebug() << "hop_select_changed()" << product->fermentables_row << val << instock; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
447 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
448 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
449 | * Search the hop 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
|
450 | */ |
375
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
451 | QString sql = "SELECT * FROM inventory_hops "; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
452 | if (instock) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
453 | sql.append("WHERE inventory > 0 "); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
454 | sql.append("ORDER BY origin,name"); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
455 | query.prepare(sql); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
456 | query.exec(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
457 | query.first(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
458 | 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
|
459 | query.next(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
460 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
461 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
462 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
463 | * Replace the hop record contents |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
464 | */ |
375
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
465 | product->hops[product->hops_row].name = query.value("name").toString(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
466 | product->hops[product->hops_row].origin = query.value("origin").toString(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
467 | product->hops[product->hops_row].alpha = query.value("alpha").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
468 | product->hops[product->hops_row].beta = query.value("beta").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
469 | product->hops[product->hops_row].humulene = query.value("humulene").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
470 | product->hops[product->hops_row].caryophyllene = query.value("caryophyllene").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
471 | product->hops[product->hops_row].cohumulone = query.value("cohumulone").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
472 | product->hops[product->hops_row].myrcene = query.value("myrcene").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
473 | product->hops[product->hops_row].hsi = query.value("hsi").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
474 | product->hops[product->hops_row].total_oil = query.value("total_oil").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
475 | product->hops[product->hops_row].type = query.value("type").toInt(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
476 | product->hops[product->hops_row].form = query.value("form").toInt(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
477 | product->hops[product->hops_row].cost = query.value("cost").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
478 | product->hops[product->hops_row].inventory = query.value("inventory").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
479 | product->hops[product->hops_row].utilisation = query.value("utilisation").toDouble(); |
c21567bfd703
Final set the default utilisation to 20. Selecting another hop in a product now sets the new utilisation and bu_factor too. Removed experimental CO2 extract calculation and let it handle by the Tinseth formula. The Tinseth formula uses the Utilisation value in the final calculation. Moved the ISO extract formula for extract at bottling to the main toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
480 | product->hops[product->hops_row].bu_factor = query.value("bu_factor").toDouble(); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
481 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
482 | /* |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
483 | * Update the visible fields |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
484 | */ |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
485 | hnameEdit->setText(product->hops.at(product->hops_row).name); |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
486 | horiginEdit->setText(product->hops.at(product->hops_row).origin); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
487 | |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
488 | double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, product->est_og3, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
489 | product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
490 | product->hops.at(product->hops_row).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
491 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
492 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
493 | product->hops.at(product->hops_row).utilisation, product->hops.at(product->hops_row).bu_factor); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
494 | ibuEdit->setValue(ibu); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
495 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
496 | ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).origin)); |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
497 | ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).name)); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
498 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
499 | QString hoptype = QCoreApplication::translate("HopTypes", g_hop_types[product->hops.at(product->hops_row).type]); |
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
500 | item = new QTableWidgetItem(hoptype); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
501 | 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
|
502 | ui->hopsTable->setItem(product->hops_row, 2, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
503 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
504 | |
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
505 | item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[product->hops.at(product->hops_row).form])); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
506 | 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
|
507 | ui->hopsTable->setItem(product->hops_row, 3, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
508 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
509 | item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(product->hops_row).alpha, 2, 'f', 1, '0')); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
510 | 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
|
511 | ui->hopsTable->setItem(product->hops_row, 4, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
512 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
513 | item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0')); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
514 | 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
|
515 | ui->hopsTable->setItem(product->hops_row, 7, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
516 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
517 | if (product->hops.at(product->hops_row).inventory < 1.0) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
518 | item = new QTableWidgetItem(QString("%1 gr").arg(product->hops.at(product->hops_row).inventory * 1000.0, 2, 'f', 1, '0')); |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
519 | } else { |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
520 | item = new QTableWidgetItem(QString("%1 kg").arg(product->hops.at(product->hops_row).inventory, 4, 'f', 3, '0')); |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
521 | } |
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
522 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
523 | if (product->hops.at(product->hops_row).inventory < product->hops.at(product->hops_row).amount) |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
524 | item->setForeground(QBrush(QColor(Qt::red))); |
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
525 | ui->hopsTable->setItem(product->hops_row, 9, item); |
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
526 | |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
527 | calcIBUs(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
528 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
529 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
530 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
531 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
532 | void EditProduct::hop_instock_changed(bool val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
533 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
534 | QSqlQuery query; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
535 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
536 | qDebug() << "hop_instock_changed()" << product->hops_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
537 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
538 | this->hselectEdit->setCurrentIndex(-1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
539 | this->hselectEdit->clear(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
540 | QString sql = "SELECT origin,name,alpha,inventory FROM inventory_hops "; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
541 | if (val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
542 | sql.append("WHERE inventory > 0 "); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
543 | sql.append("ORDER BY origin,name"); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
544 | query.prepare(sql); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
545 | query.exec(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
546 | query.first(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
547 | this->hselectEdit->addItem(""); // Start with empty value |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
548 | 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
|
549 | this->hselectEdit->addItem(query.value(0).toString()+" - "+query.value(1).toString()+" ("+query.value(2).toString()+"%) "+ |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
550 | 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
|
551 | query.next(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
552 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
553 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
554 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
555 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
556 | void EditProduct::hop_useat_changed(int val) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
557 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
558 | qDebug() << "hop_useat_changed()" << product->hops_row << val; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
559 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
560 | product->hops[product->hops_row].useat = val; |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
300
diff
changeset
|
561 | QTableWidgetItem *item = new QTableWidgetItem(QCoreApplication::translate("HopUse", g_hop_useat[val])); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
562 | 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
|
563 | ui->hopsTable->setItem(product->hops_row, 5, item); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
564 | |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
565 | if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) { |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
566 | htimeLabel->setText(tr("Time in minutes:")); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
567 | htimeEdit->setValue(product->hops.at(product->hops_row).time); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
568 | htimeLabel->show(); |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
569 | htimeEdit->show(); |
191
7446ee2fb427
Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents:
178
diff
changeset
|
570 | } else if (val == HOP_USEAT_DRY_HOP) { |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
571 | htimeLabel->setText(tr("Time in days:")); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
572 | htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
573 | htimeLabel->show(); |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
574 | htimeEdit->show(); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
575 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
576 | htimeEdit->setValue(0); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
577 | htimeLabel->hide(); |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
578 | htimeEdit->hide(); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
579 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
580 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
581 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
582 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
583 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
584 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
585 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
586 | void EditProduct::editHopRow_clicked() |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
587 | { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
588 | QSqlQuery query; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
589 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
590 | if (product->locked) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
591 | return; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
592 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
593 | 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
|
594 | product->hops_row = pb->objectName().toInt(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
595 | qDebug() << "Edit hop row" << product->hops_row; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
596 | Hops backup = product->hops.at(product->hops_row); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
597 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
598 | QDialog* dialog = new QDialog(this); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
599 | dialog->resize(738, 260); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
600 | QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
601 | buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
602 | 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
|
603 | buttonBox->setLayoutDirection(Qt::LeftToRight); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
604 | buttonBox->setOrientation(Qt::Horizontal); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
605 | 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
|
606 | buttonBox->setCenterButtons(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
607 | QLabel *nameLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
608 | nameLabel->setObjectName(QString::fromUtf8("nameLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
609 | nameLabel->setText(tr("Current hop:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
610 | 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
|
611 | 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
|
612 | QLabel *originLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
613 | originLabel->setObjectName(QString::fromUtf8("originLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
614 | originLabel->setText(tr("Origin:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
615 | originLabel->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
|
616 | originLabel->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
|
617 | QLabel *amountLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
618 | amountLabel->setObjectName(QString::fromUtf8("amountLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
619 | amountLabel->setText(tr("Amount in gr:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
620 | amountLabel->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
|
621 | amountLabel->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
|
622 | htimeLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
623 | htimeLabel->setObjectName(QString::fromUtf8("htimeLabel")); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
624 | if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
625 | htimeLabel->setText(tr("Time in days:")); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
626 | else |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
627 | htimeLabel->setText(tr("Time in minutes:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
628 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
629 | htimeLabel->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
|
630 | htimeLabel->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
|
631 | QLabel *useatLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
632 | useatLabel->setObjectName(QString::fromUtf8("useatLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
633 | useatLabel->setText(tr("Use at:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
634 | 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
|
635 | 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
|
636 | QLabel *selectLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
637 | selectLabel->setObjectName(QString::fromUtf8("selectLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
638 | selectLabel->setText(tr("Select hop:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
639 | selectLabel->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
|
640 | 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
|
641 | QLabel *instockLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
642 | instockLabel->setObjectName(QString::fromUtf8("instockLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
643 | instockLabel->setText(tr("In stock:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
644 | instockLabel->setGeometry(QRect(525, 70, 121, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
645 | 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
|
646 | QLabel *ibuLabel = new QLabel(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
647 | ibuLabel->setObjectName(QString::fromUtf8("maxLabel")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
648 | ibuLabel->setText(tr("Bitterness IBU:")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
649 | ibuLabel->setGeometry(QRect(420, 130, 121, 20)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
650 | ibuLabel->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
|
651 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
652 | hselectEdit = new QComboBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
653 | hselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
654 | hselectEdit->setGeometry(QRect(160, 70, 371, 23)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
655 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
656 | hnameEdit = new QLineEdit(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
657 | hnameEdit->setObjectName(QString::fromUtf8("hnameEdit")); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
658 | hnameEdit->setText(product->hops.at(product->hops_row).name); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
659 | hnameEdit->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
|
660 | hnameEdit->setReadOnly(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
661 | horiginEdit = new QLineEdit(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
662 | horiginEdit->setObjectName(QString::fromUtf8("horiginEdit")); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
663 | horiginEdit->setText(product->hops.at(product->hops_row).origin); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
664 | horiginEdit->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
|
665 | horiginEdit->setReadOnly(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
666 | hamountEdit = new QDoubleSpinBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
667 | hamountEdit->setObjectName(QString::fromUtf8("hamountEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
668 | hamountEdit->setGeometry(QRect(160, 100, 121, 24)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
669 | hamountEdit->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
|
670 | hamountEdit->setAccelerated(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
671 | hamountEdit->setDecimals(1); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
672 | hamountEdit->setMaximum(1000000.0); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
673 | hamountEdit->setSingleStep(0.5); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
674 | hamountEdit->setValue(product->hops.at(product->hops_row).amount * 1000.0); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
675 | htimeEdit = new QSpinBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
676 | htimeEdit->setObjectName(QString::fromUtf8("htimeEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
677 | htimeEdit->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
|
678 | htimeEdit->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
|
679 | htimeEdit->setAccelerated(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
680 | htimeEdit->setMaximum(10000.0); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
681 | if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
682 | htimeEdit->setValue(product->hops.at(product->hops_row).time); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
683 | htimeLabel->show(); |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
684 | htimeEdit->show(); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
685 | } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
686 | htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
687 | htimeLabel->show(); |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
688 | htimeEdit->show(); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
689 | } else { |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
690 | htimeLabel->hide(); |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
691 | htimeEdit->hide(); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
692 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
693 | useatEdit = new QComboBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
694 | useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
695 | useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
380
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
696 | for (int i = 0; i < 7; i++) |
8f5c03ed4321
Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
697 | useatEdit->addItem(QCoreApplication::translate("HopUse", g_hop_useat[i])); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
698 | useatEdit->setCurrentIndex(product->hops.at(product->hops_row).useat); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
699 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
700 | hinstockEdit = new QCheckBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
701 | hinstockEdit->setObjectName(QString::fromUtf8("hinstockEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
702 | hinstockEdit->setGeometry(QRect(655, 70, 85, 21)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
703 | hinstockEdit->setChecked(true); |
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 | ibuEdit = new QDoubleSpinBox(dialog); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
706 | ibuEdit->setObjectName(QString::fromUtf8("ibuEdit")); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
707 | ibuEdit->setGeometry(QRect(550, 130, 121, 24)); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
708 | ibuEdit->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
|
709 | ibuEdit->setReadOnly(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
710 | ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
711 | ibuEdit->setDecimals(1); |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
712 | double ibu = Utils::toIBU(product->hops.at(product->hops_row).useat, product->hops.at(product->hops_row).form, product->preboil_sg, product->est_og3, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
713 | product->batch_size, product->hops.at(product->hops_row).amount, product->hops.at(product->hops_row).time, |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
714 | product->hops.at(product->hops_row).alpha, product->ibu_method, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
305
diff
changeset
|
715 | product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
716 | product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
717 | product->hops.at(product->hops_row).utilisation, product->hops.at(product->hops_row).bu_factor); |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
718 | ibuEdit->setValue(ibu); |
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 | hop_instock_changed(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
721 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
722 | connect(hselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::hop_select_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
723 | connect(hamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::hop_amount_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
724 | connect(htimeEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditProduct::hop_time_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
725 | connect(useatEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::hop_useat_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
726 | connect(hinstockEdit, &QCheckBox::stateChanged, this, &EditProduct::hop_instock_changed); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
727 | 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
|
728 | 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
|
729 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
730 | dialog->setModal(true); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
731 | dialog->exec(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
732 | if (dialog->result() == QDialog::Rejected) { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
733 | qDebug() << "reject and rollback"; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
734 | product->hops[product->hops_row] = backup; |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
735 | } else { |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
736 | /* Clear time if hop is not used for boil, whirlpool or dry-hop. */ |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
737 | if (! (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
738 | product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL || |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
739 | product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP)) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
740 | if (product->hops.at(product->hops_row).time) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
741 | product->hops[product->hops_row].time = 0; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
742 | is_changed(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
743 | } |
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 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
746 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
747 | disconnect(hselectEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
748 | disconnect(hamountEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
749 | disconnect(htimeEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
750 | disconnect(useatEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
751 | disconnect(hinstockEdit, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
752 | disconnect(buttonBox, nullptr, nullptr, nullptr); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
753 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
754 | emit refreshAll(); |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
755 | } |
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 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
758 | void EditProduct::adjustHops(double factor) |
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 | double amount; |
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 | if (product->hops.size() == 0) |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
763 | return; |
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 | for (int i = 0; i < product->hops.size(); i++) { |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
766 | amount = product->hops.at(i).amount * factor; |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
230
diff
changeset
|
767 | product->hops[i].amount = amount; |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
768 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
769 | } |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
770 | |
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
771 |