src/EditProductTab7.cpp

Mon, 16 Jan 2023 16:55:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 16 Jan 2023 16:55:41 +0100
changeset 464
1fed3ff9a64e
parent 454
2dfead81c72f
permissions
-rw-r--r--

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.

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 7, mash.
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 void EditProduct::refreshMashs()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 QString w;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 QWidget* pWidget;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 QHBoxLayout* pLayout;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 QTableWidgetItem *item;
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
27 QIcon down_icon, up_icon, del_icon, ed_icon;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 down_icon.addFile(QString::fromUtf8(":/icons/silk/bullet_arrow_down.png"), QSize(), QIcon::Normal, QIcon::Off);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 up_icon.addFile(QString::fromUtf8(":/icons/silk/bullet_arrow_up.png"), QSize(), QIcon::Normal, QIcon::Off);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
31 del_icon.addFile(QString::fromUtf8(":/icons/silk/delete.png"), QSize(), QIcon::Normal, QIcon::Off);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
32 ed_icon.addFile(QString::fromUtf8(":/icons/silk/pencil.png"), QSize(), QIcon::Normal, QIcon::Off);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 const QStringList labels({tr("Step name"), tr("Type"), tr("Start"), tr("End"), tr("Rest"), tr("Ramp"),
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
35 tr("Inf/dec"), tr("Inf/dec"), tr("Volume"), tr("W/G ratio"), tr("SG"), tr("pH"), "", "", "", "" });
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
37 ui->mashsTable->setColumnCount(16);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 ui->mashsTable->setColumnWidth(0, 189); /* Step name */
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
39 ui->mashsTable->setColumnWidth(1, 110); /* Type */
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 ui->mashsTable->setColumnWidth(2, 70); /* Start temp */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 ui->mashsTable->setColumnWidth(3, 70); /* End temp */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 ui->mashsTable->setColumnWidth(4, 70); /* Rest time */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 ui->mashsTable->setColumnWidth(5, 70); /* Ramp time */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 ui->mashsTable->setColumnWidth(6, 70); /* Infusion vol */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 ui->mashsTable->setColumnWidth(7, 70); /* Infusion tmp */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 ui->mashsTable->setColumnWidth(8, 70); /* Volume */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 ui->mashsTable->setColumnWidth(9, 80); /* W/G ratio */
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
48 ui->mashsTable->setColumnWidth(10, 60); /* SG */
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
49 ui->mashsTable->setColumnWidth(11, 60); /* pH */
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
50 ui->mashsTable->setColumnWidth(12, 30); /* Up button */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
51 ui->mashsTable->setColumnWidth(13, 30); /* Down button */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
52 ui->mashsTable->setColumnWidth(14, 30); /* Delete */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
53 ui->mashsTable->setColumnWidth(15, 30); /* Edit */
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 ui->mashsTable->setHorizontalHeaderLabels(labels);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 ui->mashsTable->verticalHeader()->hide();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 ui->mashsTable->setRowCount(product->mashs.size());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 for (int i = 0; i < product->mashs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 ui->mashsTable->setItem(i, 0, new QTableWidgetItem(product->mashs.at(i).step_name));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 287
diff changeset
62 item = new QTableWidgetItem(QCoreApplication::translate("StepType", g_step_types[product->mashs.at(i).step_type]));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 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
64 ui->mashsTable->setItem(i, 1, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 item = new QTableWidgetItem(QString("%1 °C").arg(product->mashs.at(i).step_temp, 2, 'f', 1, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 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
68 ui->mashsTable->setItem(i, 2, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 item = new QTableWidgetItem(QString("%1 °C").arg(product->mashs.at(i).end_temp, 2, 'f', 1, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 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
72 ui->mashsTable->setItem(i, 3, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 item = new QTableWidgetItem(QString("%1 min").arg(product->mashs.at(i).step_time, 1, 'f', 0, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 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
76 ui->mashsTable->setItem(i, 4, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 item = new QTableWidgetItem(QString("%1 min").arg(product->mashs.at(i).ramp_time, 1, 'f', 0, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 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
80 ui->mashsTable->setItem(i, 5, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 if (product->mashs.at(i).step_infuse_amount > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 item = new QTableWidgetItem(QString("%1 L").arg(product->mashs.at(i).step_infuse_amount, 2, 'f', 1, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 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
85 ui->mashsTable->setItem(i, 6, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 item = new QTableWidgetItem(QString("%1 °C").arg(product->mashs.at(i).step_infuse_temp, 3, 'f', 2, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 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
88 ui->mashsTable->setItem(i, 7, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 ui->mashsTable->removeCellWidget(i, 6);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 ui->mashsTable->removeCellWidget(i, 7);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 item = new QTableWidgetItem(QString("%1 L").arg(product->mashs.at(i).step_volume, 2, 'f', 1, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 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
96 ui->mashsTable->setItem(i, 8, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 item = new QTableWidgetItem(QString("%1 L/kg").arg(product->mashs.at(i).step_wg_ratio, 3, 'f', 2, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 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
100 ui->mashsTable->setItem(i, 9, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
102 item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(i).step_sg, 4, 'f', 3, '0'));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
103 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
104 ui->mashsTable->setItem(i, 10, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
105
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
106 item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(i).step_ph, 3, 'f', 2, '0'));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
107 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
108 ui->mashsTable->setItem(i, 11, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
109
437
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
110 if (i > 0 && product->stage <= PROD_STAGE_BREW) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 pWidget = new QWidget();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 QPushButton* btn_up = new QPushButton();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 btn_up->setObjectName(QString("%1").arg(i)); /* Send row with the button */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 btn_up->setIcon(up_icon);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 connect(btn_up, SIGNAL(clicked()), this, SLOT(upMashRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 pLayout = new QHBoxLayout(pWidget);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 pLayout->addWidget(btn_up);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 pLayout->setContentsMargins(5, 0, 5, 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 pWidget->setLayout(pLayout);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
120 ui->mashsTable->setCellWidget(i, 12, pWidget);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 } else {
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
122 ui->mashsTable->removeCellWidget(i, 12);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124
437
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
125 if (i < (product->mashs.size() - 1) && product->stage <= PROD_STAGE_BREW) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 pWidget = new QWidget();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 QPushButton* btn_down = new QPushButton();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 btn_down->setObjectName(QString("%1").arg(i)); /* Send row with the button */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 btn_down->setIcon(down_icon);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 connect(btn_down, SIGNAL(clicked()), this, SLOT(downMashRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 pLayout = new QHBoxLayout(pWidget);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 pLayout->addWidget(btn_down);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 pLayout->setContentsMargins(5, 0, 5, 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 pWidget->setLayout(pLayout);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
135 ui->mashsTable->setCellWidget(i, 13, pWidget);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 } else {
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
137 ui->mashsTable->removeCellWidget(i, 13);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139
437
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
140 if (product->stage <= PROD_STAGE_BREW) {
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
141 pWidget = new QWidget();
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
142 QToolButton* btn_dele = new QToolButton();
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
143 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
144 btn_dele->setIcon(del_icon);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
145 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked()));
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
146 pLayout = new QHBoxLayout(pWidget);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
147 pLayout->addWidget(btn_dele);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
148 pLayout->setContentsMargins(5, 0, 5, 0);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
149 pWidget->setLayout(pLayout);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
150 ui->mashsTable->setCellWidget(i, 14, pWidget);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151
437
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
152 pWidget = new QWidget();
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
153 QToolButton* btn_edit = new QToolButton();
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
154 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
155 btn_edit->setIcon(ed_icon);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
156 connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked()));
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
157 pLayout = new QHBoxLayout(pWidget);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
158 pLayout->addWidget(btn_edit);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
159 pLayout->setContentsMargins(5, 0, 5, 0);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
160 pWidget->setLayout(pLayout);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
161 ui->mashsTable->setCellWidget(i, 15, pWidget);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
162 } else {
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
163 ui->mashsTable->removeCellWidget(i, 14);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
164 ui->mashsTable->removeCellWidget(i, 15);
e6b5510ca1d9 Disable manipulating mash steps when brewday is over.
Michiel Broek <mbroek@mbse.eu>
parents: 411
diff changeset
165 }
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 }
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 double EditProduct::infusionVol(double step_infused, double step_mashkg, double infuse_temp, double step_temp, double last_temp)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 {
177
62b8d701cd88 Fermentables inventory is updated during initial product load. Total mash volume is calculated against the used equipment profile. Display mash weight. Mash infuse temperatures are calculated against the used equipment profile.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
172 double a = last_temp * (product->eq_tun_weight * product->eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
62b8d701cd88 Fermentables inventory is updated during initial product load. Total mash volume is calculated against the used equipment profile. Display mash weight. Mash infuse temperatures are calculated against the used equipment profile.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
173 double b = step_temp * (product->eq_tun_weight * product->eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 double vol = round(((b - a) / ((infuse_temp - step_temp) * SpecificHeatWater)) * 100.0) / 100.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 if (vol < 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 vol = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 qDebug() << " infusionVol(" << step_infused << "," << step_mashkg << "," << infuse_temp <<"," << step_temp << "," << last_temp << "):" << vol;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 return vol;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 double EditProduct::decoctionVol(double step_volume, double step_temp, double prev_temp)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 {
177
62b8d701cd88 Fermentables inventory is updated during initial product load. Total mash volume is calculated against the used equipment profile. Display mash weight. Mash infuse temperatures are calculated against the used equipment profile.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
185 double a = (product->eq_tun_weight * product->eq_tun_specific_heat + step_volume * SpecificHeatWater) * (step_temp - prev_temp);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 double b = SpecificHeatWater * (99 - step_temp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 double vol = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 if (b > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 vol = round((a / b) * 1000000.0) / 1000000.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 qDebug() << " decoctionVol(" << step_volume << "," << step_temp << "," << prev_temp << "):" << vol;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 return vol;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 void EditProduct::calcMash()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 double infused = 0, vol, a, b, temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 int i, j, n;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 double lasttemp = 18.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 double graintemp = 18.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 double tuntemp = 18.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 product->mashs_time = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 if (product->mashs.size() && product->mashs_kg > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 qDebug() << "calcMash()";
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 for (i = 0; i < product->mashs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 if (product->mashs.at(i).step_type == 0) { // Infusion
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 if (i == 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 // First mash step, temperature from the mashtun and malt.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 n = 20; // tun is preheated.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 tuntemp = product->mashs.at(i).step_temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 for (j = 0; j < n; j++) {
177
62b8d701cd88 Fermentables inventory is updated during initial product load. Total mash volume is calculated against the used equipment profile. Display mash weight. Mash infuse temperatures are calculated against the used equipment profile.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
216 a = product->mashs_kg * graintemp * SpecificHeatMalt + product->eq_tun_weight * tuntemp * product->eq_tun_specific_heat;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 b = product->mashs[i].step_temp *
177
62b8d701cd88 Fermentables inventory is updated during initial product load. Total mash volume is calculated against the used equipment profile. Display mash weight. Mash infuse temperatures are calculated against the used equipment profile.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
218 (product->eq_tun_weight * product->eq_tun_specific_heat +
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 product->mashs.at(i).step_infuse_amount * SpecificHeatWater +
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 product->mashs_kg * SpecificHeatMalt) -
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 SlakingHeat * product->mashs_kg;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 if (product->mashs.at(i).step_infuse_amount > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 temp = (b - a) / (product->mashs.at(i).step_infuse_amount * SpecificHeatWater);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 temp = 99;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 tuntemp += (temp - tuntemp) / 2;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 product->mashs[i].step_infuse_temp = round(temp * 1000000.0) / 1000000.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 qDebug() << " init infuse temp:" << product->mashs.at(i).step_infuse_temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 // Calculate amount of infusion water.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 product->mashs[i].step_infuse_amount =
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 infusionVol(infused, product->mashs_kg, product->mashs.at(i).step_infuse_temp, product->mashs.at(i).step_temp, lasttemp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 qDebug() << i << " vol:" << product->mashs.at(i).step_infuse_amount << "temp:" << product->mashs.at(i).step_infuse_temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 infused += product->mashs.at(i).step_infuse_amount;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 } else if (product->mashs.at(i).step_type == 1) { // Temperature
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 if (i > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 product->mashs[i].step_infuse_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 product->mashs[i].step_infuse_temp = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 } else if (product->mashs.at(i).step_type == 2) { // Decoction
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 product->mashs[i].step_infuse_amount = decoctionVol(infused, product->mashs.at(i).step_temp, lasttemp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 product->mashs[i].step_infuse_temp = 99;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 product->mashs[i].step_volume = infused;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 //qDebug() << i << " type:" << product->mashs.at(i).step_type << "volume:" << product->mashs.at(i).step_infuse_amount << "temp:" << product->mashs.at(i).step_infuse_temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 lasttemp = product->mashs.at(i).step_temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 product->mashs_time += product->mashs.at(i).step_time;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 if (i > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 product->mashs_time += product->mashs.at(i).ramp_time;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 product->mashs[i].step_wg_ratio = round((infused / product->mashs_kg) * 1000000.0) / 1000000.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255
180
bbf0f06a5e72 Show total mash volume.
Michiel Broek <mbroek@mbse.eu>
parents: 177
diff changeset
256 ui->mash_volEdit->setValue(product->mashs_kg * MaltVolume + infused);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 /* Show the calculated total mash time. */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 ui->mash_timeEdit->setText(QString("%1:%2").arg(product->mashs_time / 60).arg(product->mashs_time % 60, 2, 'f', 0, '0'));
183
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
259
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
260 /* Estimated needed sparge water corrected for the temperature. */
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
261 product->brew_sparge_est =
411
c78f8cf11849 Fixed spelling error
Michiel Broek <mbroek@mbse.eu>
parents: 307
diff changeset
262 round((product->boil_size - infused + (product->mashs_kg * my_grain_absorption) + product->eq_lauter_deadspace) * 1.03 * 1000) / 1000;
183
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
263 ui->brew_spargeestShow->setValue(product->brew_sparge_est);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 void EditProduct::addMashRow_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 {
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
269 MashSteps newm;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 for (int i = 0; i < product->mashs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 if (product->mashs.at(i).step_time == 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 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
274 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 newm.step_name = "Name me";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 newm.step_temp = newm.end_temp = 67.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 newm.step_time = 20;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 newm.ramp_time = 10;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 if (product->mashs.size()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 newm.step_volume = product->mashs.at(product->mashs.size() - 1).step_volume;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 newm.step_wg_ratio = product->mashs.at(product->mashs.size() - 1).step_wg_ratio;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 newm.step_type = product->mashs.at(product->mashs.size() - 1).step_type;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 newm.step_volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 newm.step_wg_ratio = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 newm.step_type = 1;
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 newm.step_infuse_amount = newm.step_infuse_temp = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 product->mashs.append(newm);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 void EditProduct::deleteMashRow_clicked()
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 if (product->locked || product->mashs.size() < 1)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
302 QToolButton *pb = qobject_cast<QToolButton *>(QObject::sender());
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 int row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 qDebug() << "Delete mash row" << row << product->mashs.size();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 int rc = QMessageBox::warning(this, tr("Delete mash step"), tr("Delete %1").arg(product->mashs.at(row).step_name),
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 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
308 if (rc == QMessageBox::No)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 product->mashs.removeAt(row);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 emit refreshAll();
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 void EditProduct::upMashRow_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 if (product->locked || product->mashs.size() < 1)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 return;
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 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
323 int row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 qDebug() << "Move up mash row" << row << product->mashs.size();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
326 MashSteps temp;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 temp = product->mashs[row - 1];
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 product->mashs[row - 1] = product->mashs[row];
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 product->mashs[row] = temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 void EditProduct::downMashRow_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 if (product->locked || product->mashs.size() < 1)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 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
341 int row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 qDebug() << "Move down mash row" << row << product->mashs.size();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
344 MashSteps temp;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 temp = product->mashs[row + 1];
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 product->mashs[row + 1] = product->mashs[row];
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 product->mashs[row] = temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 emit refreshAll();
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 void EditProduct::step_name_changed(QString val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 product->mashs[product->mashs_row].step_name = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 ui->mashsTable->setItem(product->mashs_row, 0, new QTableWidgetItem(val));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 void EditProduct::step_type_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363 qDebug() << "step_type_changed" << product->mashs_row << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 product->mashs[product->mashs_row].step_type = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 ivolLabel->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 stepivolEdit->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 itmpLabel->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 stepitmpEdit->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 }
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 void EditProduct::step_temp_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 qDebug() << "step_temp_changed" << product->mashs_row << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 product->mashs[product->mashs_row].step_temp = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 QTableWidgetItem *item = new QTableWidgetItem(QString("%1 °C").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->mashsTable->setItem(product->mashs_row, 2, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 void EditProduct::end_temp_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 qDebug() << "end_temp_changed" << product->mashs_row << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 product->mashs[product->mashs_row].end_temp = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 QTableWidgetItem *item = new QTableWidgetItem(QString("%1 °C").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
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->mashsTable->setItem(product->mashs_row, 3, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 }
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 void EditProduct::step_time_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 qDebug() << "step_time_changed" << product->mashs_row << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 product->mashs[product->mashs_row].step_time = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 QTableWidgetItem *item = new QTableWidgetItem(QString("%1 min").arg(val, 1, 'f', 0, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 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
405 ui->mashsTable->setItem(product->mashs_row, 4, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 void EditProduct::ramp_time_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413 qDebug() << "ramp_time_changed" << product->mashs_row << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414 product->mashs[product->mashs_row].ramp_time = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
415 QTableWidgetItem *item = new QTableWidgetItem(QString("%1 min").arg(val, 1, 'f', 0, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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->mashsTable->setItem(product->mashs_row, 5, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423 void EditProduct::infuse_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425 qDebug() << "infuse_changed" << product->mashs_row << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426 product->mashs[product->mashs_row].step_infuse_amount = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
427 QTableWidgetItem *item = new QTableWidgetItem(QString("%1 L").arg(val, 1, 'f', 0, '0'));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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->mashsTable->setItem(product->mashs_row, 6, 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 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 * Recalculate water volumes
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 double volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
435 for (int i = 0; i < product->mashs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 if (product->mashs.at(i).step_type == 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
437 volume += product->mashs.at(i).step_infuse_amount;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 product->mashs[i].step_volume = volume;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 product->w1_amount = volume - product->w2_amount;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 product->wg_amount = volume;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 ui->w1_volEdit->setValue(product->w1_amount);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
445 check_waters();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 emit refreshAll();
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
451 void EditProduct::stepph_changed(double val)
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
452 {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
453 qDebug() << "stepph_changed" << product->mashs_row << val;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
454
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
455 if (product->mashs.at(product->mashs_row).step_ph == 0) {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
456 if (product->mashs_row == 0) {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
457 /*
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
458 * Jump start at 5.0pH
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
459 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
460 product->mashs[product->mashs_row].step_ph = 5.0;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
461 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
462 /*
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
463 * Start with pH from previous step.
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
464 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
465 product->mashs[product->mashs_row].step_ph = product->mashs.at(product->mashs_row - 1).step_ph;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
466 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
467 const QSignalBlocker blocker1(stepphEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
468 stepphEdit->setValue(product->mashs.at(product->mashs_row).step_ph);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
469 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
470 product->mashs[product->mashs_row].step_ph = val;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
471 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
472
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
473 QTableWidgetItem *item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(product->mashs_row).step_ph, 3, 'f', 2, '0'));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
474 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
475 ui->mashsTable->setItem(product->mashs_row, 11, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
476 is_changed();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
477 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
478
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
479
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
480 void EditProduct::stepsg_changed(double val)
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
481 {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
482 qDebug() << "stepsg_changed" << product->mashs_row << val;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
483
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
484 if (product->mashs.at(product->mashs_row).step_sg == 0) {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
485 if (product->mashs_row > 0) {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
486 /* Start with value from previous step. */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
487 product->mashs[product->mashs_row].step_sg = product->mashs.at(product->mashs_row - 1).step_sg;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
488 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
489 /* Start at 1.001 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
490 product->mashs[product->mashs_row].step_sg = 1.001;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
491 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
492 const QSignalBlocker blocker1(stepsgEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
493 stepsgEdit->setValue(product->mashs.at(product->mashs_row).step_sg);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
494 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
495 product->mashs[product->mashs_row].step_sg = val;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
496 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
497 const QSignalBlocker blocker2(brixEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
498 if (product->mashs.at(product->mashs_row).step_sg >= 1.000)
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
499 brixEdit->setValue(round(Utils::sg_to_brix(product->mashs.at(product->mashs_row).step_sg) * 10.0) / 10.0);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
500 else
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
501 brixEdit->setValue(0);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
502 qDebug() << "brix" << brixEdit->value();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
503
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
504 QTableWidgetItem *item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(product->mashs_row).step_sg, 4, 'f', 3, '0'));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
505 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
506 ui->mashsTable->setItem(product->mashs_row, 10, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
507 is_changed();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
508 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
509
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
510
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
511 void EditProduct::stepbrix_changed(double val)
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
512 {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
513 qDebug() << "stepbrix_changed" << product->mashs_row << val << "SG" << Utils::brix_to_sg(val);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
514
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
515 if ((product->mashs.at(product->mashs_row).step_sg == 0) && (product->mashs_row > 0)) {
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 202
diff changeset
516 /* If not the first step, and SG was not set, pickup previous step. */
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
517 val = Utils::sg_to_brix(product->mashs.at(product->mashs_row - 1).step_sg);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
518 const QSignalBlocker blocker2(brixEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
519 brixEdit->setValue(val);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
520 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
521 product->mashs[product->mashs_row].step_sg = Utils::brix_to_sg(val);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
522 const QSignalBlocker blocker1(stepsgEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
523 stepsgEdit->setValue(product->mashs.at(product->mashs_row).step_sg);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
524
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
525 QTableWidgetItem *item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(product->mashs_row).step_sg, 4, 'f', 3, '0'));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
526 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
527 ui->mashsTable->setItem(product->mashs_row, 10, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
528 is_changed();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
529 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
530
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
531
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532 void EditProduct::editMashRow_clicked()
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 if (product->locked)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
537 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
538
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
539 QToolButton *pb = qobject_cast<QToolButton *>(QObject::sender());
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
540 product->mashs_row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
541 qDebug() << "Edit mash row" << product->mashs_row;
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
542 MashSteps backup = product->mashs.at(product->mashs_row);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
543
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
544 QDialog* dialog = new QDialog(this);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
545 dialog->resize(738, 290);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
548 buttonBox->setGeometry(QRect(30, 240, 671, 32));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 buttonBox->setLayoutDirection(Qt::LeftToRight);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550 buttonBox->setOrientation(Qt::Horizontal);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 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
552 buttonBox->setCenterButtons(true);
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 QLabel *nameLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
555 nameLabel->setObjectName(QString::fromUtf8("nameLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
556 nameLabel->setText(tr("Step name:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
557 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
558 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
559 stepnameEdit = new QLineEdit(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
560 stepnameEdit->setObjectName(QString::fromUtf8("stepnameEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 stepnameEdit->setText(product->mashs.at(product->mashs_row).step_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
562 stepnameEdit->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
563
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 QLabel *typeLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565 typeLabel->setObjectName(QString::fromUtf8("typeLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
566 typeLabel->setText(tr("Step type:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 typeLabel->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
568 typeLabel->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
569 QComboBox *typeEdit = new QComboBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 typeEdit->setObjectName(QString::fromUtf8("typeEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
571 typeEdit->setGeometry(QRect(160, 40, 161, 23));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 typeEdit->addItem(tr("Infusion"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
573 typeEdit->addItem(tr("Temperature"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
574 typeEdit->addItem(tr("Decoction"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
575 typeEdit->setCurrentIndex(product->mashs.at(product->mashs_row).step_type);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
577 QLabel *tempLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
578 tempLabel->setObjectName(QString::fromUtf8("tempLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
579 tempLabel->setText(tr("Step start temp:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 tempLabel->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
581 tempLabel->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
582 steptempEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 steptempEdit->setObjectName(QString::fromUtf8("steptempEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 steptempEdit->setGeometry(QRect(160, 70, 121, 24));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 steptempEdit->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
586 steptempEdit->setDecimals(1);
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
587 steptempEdit->setAccelerated(true);
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
588 steptempEdit->setSingleStep(0.5);
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
589 steptempEdit->setMaximum(82);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
590 steptempEdit->setValue(product->mashs.at(product->mashs_row).step_temp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
591
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 QLabel *endLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 endLabel->setObjectName(QString::fromUtf8("endLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 endLabel->setText(tr("Step end temp:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 endLabel->setGeometry(QRect(360, 70, 141, 20));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596 endLabel->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
597 endtempEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 endtempEdit->setObjectName(QString::fromUtf8("endtempEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599 endtempEdit->setGeometry(QRect(510, 70, 121, 24));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 endtempEdit->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
601 endtempEdit->setDecimals(1);
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
602 endtempEdit->setAccelerated(true);
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
603 endtempEdit->setSingleStep(0.5);
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
604 endtempEdit->setMaximum(82);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 endtempEdit->setValue(product->mashs.at(product->mashs_row).end_temp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
607 QLabel *timeLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 timeLabel->setObjectName(QString::fromUtf8("timeLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
609 timeLabel->setText(tr("Step rest time:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 timeLabel->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
611 timeLabel->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 steptimeEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 steptimeEdit->setObjectName(QString::fromUtf8("steptimeEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
614 steptimeEdit->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
615 steptimeEdit->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
616 steptimeEdit->setDecimals(0);
452
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
617 steptimeEdit->setAccelerated(true);
c4c5d02131be Limit mash steptime to 240 minutes. Limit mash steps to 82 degrees celsius. In estimate_fg limit total mash time to 240 minutes and increased the water/grain ration from 5.5 to 6 l/kg.
Michiel Broek <mbroek@mbse.eu>
parents: 437
diff changeset
618 steptimeEdit->setMaximum(240.0);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619 steptimeEdit->setValue(product->mashs.at(product->mashs_row).step_time);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
620
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 QLabel *rampLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
622 rampLabel->setObjectName(QString::fromUtf8("rampLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
623 rampLabel->setText(tr("Step ramp time:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 rampLabel->setGeometry(QRect(360, 100, 141, 20));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
625 rampLabel->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
626 ramptimeEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
627 ramptimeEdit->setObjectName(QString::fromUtf8("ramptimeEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
628 ramptimeEdit->setGeometry(QRect(510, 100, 121, 24));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
629 ramptimeEdit->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
630 ramptimeEdit->setDecimals(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 ramptimeEdit->setValue(product->mashs.at(product->mashs_row).ramp_time);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
632
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
633 QLabel *phLabel = new QLabel(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
634 phLabel->setObjectName(QString::fromUtf8("phLabel"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
635 phLabel->setText(tr("Measured pH:"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
636 phLabel->setGeometry(QRect(10, 130, 141, 20));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
637 phLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
638 stepphEdit = new QDoubleSpinBox(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
639 stepphEdit->setObjectName(QString::fromUtf8("phEdit"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
640 stepphEdit->setGeometry(QRect(160, 130, 121, 24));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
641 stepphEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
642 stepphEdit->setDecimals(2);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
643 stepphEdit->setMaximum(14.0);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
644 stepphEdit->setAccelerated(true);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
645 stepphEdit->setSingleStep(0.1);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
646 stepphEdit->setValue(product->mashs.at(product->mashs_row).step_ph);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
647
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
648 /*
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
649 * SG or Brix, both can be used to enter the SG.
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
650 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
651 QLabel *brixLabel = new QLabel(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
652 brixLabel->setObjectName(QString::fromUtf8("brixLabel"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
653 brixLabel->setText(tr("Measured Brix:"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
654 brixLabel->setGeometry(QRect(360, 130, 141, 20));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
655 brixLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
656 brixEdit = new QDoubleSpinBox(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
657 brixEdit->setObjectName(QString::fromUtf8("brixEdit"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
658 brixEdit->setGeometry(QRect(510, 130, 121, 24));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
659 brixEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
660 brixEdit->setDecimals(1);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
661 brixEdit->setMaximum(32);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
662 brixEdit->setAccelerated(true);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
663 brixEdit->setSingleStep(0.1);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
664
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
665 QLabel *sgLabel = new QLabel(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
666 sgLabel->setObjectName(QString::fromUtf8("sgLabel"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
667 sgLabel->setText(tr("Measured SG:"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
668 sgLabel->setGeometry(QRect(360, 160, 141, 20));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
669 sgLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
670 stepsgEdit = new QDoubleSpinBox(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
671 stepsgEdit->setObjectName(QString::fromUtf8("sgEdit"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
672 stepsgEdit->setGeometry(QRect(510, 160, 121, 24));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
673 stepsgEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
674 stepsgEdit->setDecimals(3);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
675 stepsgEdit->setMaximum(1.5);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
676 stepsgEdit->setAccelerated(true);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
677 stepsgEdit->setSingleStep(0.001);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
678 /* Make it smart, if zero then start with the previous step value. */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
679 stepsgEdit->setValue(product->mashs.at(product->mashs_row).step_sg);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
680 brixEdit->setValue(Utils::sg_to_brix(product->mashs.at(product->mashs_row).step_sg));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
681
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
682 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
683 * Only used for Infusion steps.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
684 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
685 ivolLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
686 ivolLabel->setObjectName(QString::fromUtf8("ivolLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
687 ivolLabel->setText(tr("Infusion volume:"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
688 ivolLabel->setGeometry(QRect(10, 190, 141, 20));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
689 ivolLabel->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
690 ivolLabel->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691 stepivolEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692 stepivolEdit->setObjectName(QString::fromUtf8("stepivolEdit"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
693 stepivolEdit->setGeometry(QRect(160, 190, 121, 24));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
694 stepivolEdit->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
695 stepivolEdit->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
696 stepivolEdit->setDecimals(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
697 stepivolEdit->setAccelerated(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 stepivolEdit->setMaximum(100000.0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
699 stepivolEdit->setSingleStep(0.5);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
700 stepivolEdit->setValue(product->mashs.at(product->mashs_row).step_infuse_amount);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
701
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
702 itmpLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
703 itmpLabel->setObjectName(QString::fromUtf8("itmpLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
704 itmpLabel->setText(tr("Infusion Temperature:"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
705 itmpLabel->setGeometry(QRect(360, 190, 141, 20));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
706 itmpLabel->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
707 itmpLabel->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
708 stepitmpEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
709 stepitmpEdit->setObjectName(QString::fromUtf8("stepitmpEdit"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
710 stepitmpEdit->setGeometry(QRect(510, 190, 121, 24));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
711 stepitmpEdit->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
712 stepitmpEdit->setVisible(product->mashs.at(product->mashs_row).step_type == 0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713 stepitmpEdit->setDecimals(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 stepitmpEdit->setReadOnly(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
715 stepitmpEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716 stepitmpEdit->setValue(product->mashs.at(product->mashs_row).step_infuse_temp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
718 connect(stepnameEdit, &QLineEdit::textEdited, this, &EditProduct::step_name_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
719 connect(typeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::step_type_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 connect(steptempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::step_temp_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 connect(endtempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::end_temp_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
722 connect(steptimeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::step_time_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 connect(ramptimeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::ramp_time_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
724 connect(stepivolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::infuse_changed);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
725 connect(stepphEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::stepph_changed);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
726 connect(stepsgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::stepsg_changed);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
727 connect(brixEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::stepbrix_changed);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
728 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
729 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
730
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 dialog->setModal(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
732 dialog->exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 if (dialog->result() == QDialog::Rejected) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734 qDebug() << "reject and rollback";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 product->mashs[product->mashs_row] = backup;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
736 /* Rollback water volumes too */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 double volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 for (int i = 0; i < product->mashs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 if (product->mashs.at(i).step_type == 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 volume += product->mashs.at(i).step_infuse_amount;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 product->mashs[i].step_volume = volume;
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 product->w1_amount = volume - product->w2_amount;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745 product->wg_amount = volume;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746 ui->w1_volEdit->setValue(product->w1_amount);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
747 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
748
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 disconnect(stepnameEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750 disconnect(steptempEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751 disconnect(endtempEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 disconnect(steptimeEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753 disconnect(ramptimeEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754 disconnect(stepivolEdit, nullptr, nullptr, nullptr);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
755 disconnect(stepphEdit, nullptr, nullptr, nullptr);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
756 disconnect(stepsgEdit, nullptr, nullptr, nullptr);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
757 disconnect(brixEdit, nullptr, nullptr, nullptr);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 disconnect(buttonBox, nullptr, nullptr, nullptr);
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 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
762
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 void EditProduct::mash_name_changed(QString name)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
765 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
766 qDebug() << "mash_name_changed" << name;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
767 product->mash_name = name;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 is_changed();
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 void EditProduct::mash_select_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
774 QSqlQuery query;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
775 int i;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
777 qDebug() << "mash_select_changed" << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
778
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 const QSignalBlocker blocker1(ui->mash_nameEdit);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780 query.prepare("SELECT name,steps FROM profile_mash ORDER BY name");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
781 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
782 query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
783 for (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
784 query.next();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
786
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787 product->mash_name = query.value(0).toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 ui->mash_nameEdit->setText(product->mash_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
789
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
790 QJsonParseError parseError;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 const auto& json = query.value(1).toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792 if (!json.trimmed().isEmpty()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 const auto& formattedJson = QString("%1").arg(json);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
794 QJsonDocument newsteps = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
795
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
796 if (parseError.error != QJsonParseError::NoError) {
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
797 qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
798 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
799 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800 * Got the json data in the steps array, replace the product steps.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
802 double infuse = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 if (product->mashs.size()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
804 infuse = product->mashs.at(0).step_infuse_amount;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
805 product->mashs.clear();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
806 ui->mashsTable->clear();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
807 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
808 if (newsteps.isArray()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
809 for (i = 0; i < newsteps.array().size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
810 QJsonObject obj = newsteps.array().at(i).toObject();
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
811 MashSteps m;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
812 m.step_name = obj["step_name"].toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
813 if (obj["step_type"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 m.step_type = QString(obj["step_type"].toString()).toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
816 m.step_type = obj["step_type"].toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
817 m.step_volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818 m.step_infuse_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
819 m.step_infuse_temp = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
820 if (obj["step_temp"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
821 m.step_temp = QString(obj["step_temp"].toString()).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
822 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
823 m.step_temp = obj["step_temp"].toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
824 if (obj["step_time"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
825 m.step_time = QString(obj["step_time"].toString()).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
826 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 m.step_time = obj["step_time"].toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 if (obj["ramp_time"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 m.ramp_time = QString(obj["ramp_time"].toString()).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
831 m.ramp_time = obj["ramp_time"].toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
832 if (obj["end_temp"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833 m.end_temp = QString(obj["end_temp"].toString()).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
835 m.end_temp = obj["end_temp"].toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
836 m.step_wg_ratio = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837 product->mashs.append(m);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
838 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
839 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
840 if (product->mashs.at(0).step_type == 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841 product->mashs[0].step_infuse_amount = infuse; // Restore saved initial infusion
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
842 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
843 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
844 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
845 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
846 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
847
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
848

mercurial