src/EditProductTab7.cpp

Thu, 18 Aug 2022 20:34:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 18 Aug 2022 20:34:15 +0200
changeset 401
583148eb6e01
parent 307
afd711e37f68
child 411
c78f8cf11849
permissions
-rw-r--r--

Init est_carb field for new products.

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 qDebug() << "refreshMashs" << product->mashs.size();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 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
32 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
33 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
34 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
35
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 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
37 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
38
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
39 ui->mashsTable->setColumnCount(16);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 ui->mashsTable->setColumnWidth(0, 189); /* Step name */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 ui->mashsTable->setColumnWidth(1, 100); /* Type */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 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
43 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
44 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
45 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
46 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
47 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
48 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
49 ui->mashsTable->setColumnWidth(9, 80); /* W/G ratio */
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
50 ui->mashsTable->setColumnWidth(10, 50); /* SG */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
51 ui->mashsTable->setColumnWidth(11, 50); /* pH */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
52 ui->mashsTable->setColumnWidth(12, 30); /* Up button */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
53 ui->mashsTable->setColumnWidth(13, 30); /* Down button */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
54 ui->mashsTable->setColumnWidth(14, 30); /* Delete */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
55 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
56 ui->mashsTable->setHorizontalHeaderLabels(labels);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 ui->mashsTable->verticalHeader()->hide();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 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
59
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 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
61
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 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
63
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 287
diff changeset
64 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
65 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
66 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
67
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 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
69 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
70 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
71
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 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
73 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
74 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
75
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 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
77 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ui->mashsTable->setItem(i, 4, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 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
81 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 ui->mashsTable->setItem(i, 5, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 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
85 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
86 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
87 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
88 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
89 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 ui->mashsTable->setItem(i, 7, item);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 ui->mashsTable->removeCellWidget(i, 6);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 ui->mashsTable->removeCellWidget(i, 7);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 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
97 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
98 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
99
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 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
101 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
102 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
103
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
104 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
105 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
106 ui->mashsTable->setItem(i, 10, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
107
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
108 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
109 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
110 ui->mashsTable->setItem(i, 11, item);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
111
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 if (i > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 pWidget = new QWidget();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 QPushButton* btn_up = new QPushButton();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 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
116 btn_up->setIcon(up_icon);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 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
118 pLayout = new QHBoxLayout(pWidget);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 pLayout->addWidget(btn_up);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 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
121 pWidget->setLayout(pLayout);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
122 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
123 } else {
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
124 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
125 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 if (i < (product->mashs.size() - 1)) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 pWidget = new QWidget();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 QPushButton* btn_down = new QPushButton();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 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
131 btn_down->setIcon(down_icon);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 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
133 pLayout = new QHBoxLayout(pWidget);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 pLayout->addWidget(btn_down);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 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
136 pWidget->setLayout(pLayout);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
137 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
138 } else {
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
139 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
140 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 pWidget = new QWidget();
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
143 QToolButton* btn_dele = new QToolButton();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
145 btn_dele->setIcon(del_icon);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 pLayout = new QHBoxLayout(pWidget);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 pLayout->addWidget(btn_dele);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 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
150 pWidget->setLayout(pLayout);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
151 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
152
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 pWidget = new QWidget();
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
154 QToolButton* btn_edit = new QToolButton();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
156 btn_edit->setIcon(ed_icon);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 pLayout = new QHBoxLayout(pWidget);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 pLayout->addWidget(btn_edit);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 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
161 pWidget->setLayout(pLayout);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
162 ui->mashsTable->setCellWidget(i, 15, pWidget);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165
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 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
168 {
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
169 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
170 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
171 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
172
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 if (vol < 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 vol = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 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
176 return vol;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 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
181 {
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
182 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
183 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
184 double vol = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 if (b > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 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
188 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
189 return vol;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 void EditProduct::calcMash()
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 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
196 int i, j, n;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 double lasttemp = 18.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 double graintemp = 18.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 double tuntemp = 18.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 product->mashs_time = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 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
204 qDebug() << "calcMash()";
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 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
207 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
208 if (i == 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 // 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
210 n = 20; // tun is preheated.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 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
212 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
213 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
214 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
215 (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
216 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
217 product->mashs_kg * SpecificHeatMalt) -
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 SlakingHeat * product->mashs_kg;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 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
220 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
221 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 temp = 99;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 tuntemp += (temp - tuntemp) / 2;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 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
226 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 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
228 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 // Calculate amount of infusion water.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 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
231 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
232 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
233 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 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
235 } 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
236 if (i > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 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
238 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
239 } 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
240 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
241 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
242 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 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
244 //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
245 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
246 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
247 if (i > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 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
249 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
250 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252
180
bbf0f06a5e72 Show total mash volume.
Michiel Broek <mbroek@mbse.eu>
parents: 177
diff changeset
253 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
254 /* 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
255 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
256
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
257 /* 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
258 product->brew_sparge_est =
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
259 round((product->boil_size - infused + (product->mashs_kg * my_grain_absorbtion) + product->eq_lauter_deadspace) * 1.03 * 1000) / 1000;
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 180
diff changeset
260 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
261 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 void EditProduct::addMashRow_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 {
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
266 MashSteps newm;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 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
269 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
270 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
271 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 newm.step_name = "Name me";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 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
275 newm.step_time = 20;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 newm.ramp_time = 10;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 if (product->mashs.size()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 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
279 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
280 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
281 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 newm.step_volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 newm.step_wg_ratio = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 newm.step_type = 1;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 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
287
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 product->mashs.append(newm);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 void EditProduct::deleteMashRow_clicked()
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 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
297 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
299 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
300 int row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 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
302
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 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
304 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
305 if (rc == QMessageBox::No)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 product->mashs.removeAt(row);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 void EditProduct::upMashRow_clicked()
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 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
317 return;
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 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
320 int row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 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
322
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
323 MashSteps temp;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 temp = product->mashs[row - 1];
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 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
326 product->mashs[row] = temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 void EditProduct::downMashRow_clicked()
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 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
335 return;
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 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
338 int row = pb->objectName().toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 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
340
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
341 MashSteps temp;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 temp = product->mashs[row + 1];
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 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
344 product->mashs[row] = temp;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 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
351 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 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
353 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
354 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 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
359 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 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
361
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 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
363 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
364 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
365 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
366 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
367 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 void EditProduct::step_temp_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 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
375 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
376 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
377 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
378 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
379 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 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
385 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 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
387 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
388 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
389 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
390 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
391 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 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
397 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 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
399 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
400 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
401 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
402 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
403 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 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
409 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410 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
411 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
412 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
413 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
414 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
415 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 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
421 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422 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
423 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
424 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
425 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
426 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
427
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 * Recalculate water volumes
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 double volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 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
433 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
434 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
435 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 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
437 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 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
439 product->wg_amount = volume;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 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
441
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
442 check_waters();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
448 void EditProduct::stepph_changed(double val)
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
449 {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
450 qDebug() << "stepph_changed" << product->mashs_row << val;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
451
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
452 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
453 if (product->mashs_row == 0) {
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 * Jump start at 5.0pH
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
456 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
457 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
458 } else {
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 * Start with pH from previous step.
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
461 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
462 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
463 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
464 const QSignalBlocker blocker1(stepphEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
465 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
466 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
467 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
468 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
469
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
470 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
471 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
472 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
473 is_changed();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
474 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
475
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
476
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
477 void EditProduct::stepsg_changed(double val)
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 qDebug() << "stepsg_changed" << product->mashs_row << val;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
480
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
481 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
482 if (product->mashs_row > 0) {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
483 /* Start with value from previous step. */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
484 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
485 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
486 /* Start at 1.001 */
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 = 1.001;
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
488 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
489 const QSignalBlocker blocker1(stepsgEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
490 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
491 } else {
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
492 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
493 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
494 const QSignalBlocker blocker2(brixEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
495 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
496 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
497 else
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
498 brixEdit->setValue(0);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
499 qDebug() << "brix" << brixEdit->value();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
500
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
501 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
502 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
503 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
504 is_changed();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
505 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
506
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
507
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
508 void EditProduct::stepbrix_changed(double val)
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 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
511
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
512 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
513 /* 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
514 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
515 const QSignalBlocker blocker2(brixEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
516 brixEdit->setValue(val);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
517 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
518 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
519 const QSignalBlocker blocker1(stepsgEdit);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
520 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
521
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
522 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
523 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
524 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
525 is_changed();
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
526 }
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
527
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
528
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
529 void EditProduct::editMashRow_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
531 QSqlQuery query;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
533 if (product->locked)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
534 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
535
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
536 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
537 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
538 qDebug() << "Edit mash row" << product->mashs_row;
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
539 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
540
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
541 QDialog* dialog = new QDialog(this);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
542 dialog->resize(738, 290);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
543 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
544 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
545 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
546 buttonBox->setLayoutDirection(Qt::LeftToRight);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 buttonBox->setOrientation(Qt::Horizontal);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
548 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
549 buttonBox->setCenterButtons(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 QLabel *nameLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
552 nameLabel->setObjectName(QString::fromUtf8("nameLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
553 nameLabel->setText(tr("Step name:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
554 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
555 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
556 stepnameEdit = new QLineEdit(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
557 stepnameEdit->setObjectName(QString::fromUtf8("stepnameEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
558 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
559 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
560
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 QLabel *typeLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
562 typeLabel->setObjectName(QString::fromUtf8("typeLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
563 typeLabel->setText(tr("Step type:"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 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
565 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
566 QComboBox *typeEdit = new QComboBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 typeEdit->setObjectName(QString::fromUtf8("typeEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568 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
569 typeEdit->addItem(tr("Infusion"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 typeEdit->addItem(tr("Temperature"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
571 typeEdit->addItem(tr("Decoction"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 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
573
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
574 QLabel *tempLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
575 tempLabel->setObjectName(QString::fromUtf8("tempLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576 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
577 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
578 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
579 steptempEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 steptempEdit->setObjectName(QString::fromUtf8("steptempEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
581 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
582 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
583 steptempEdit->setDecimals(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 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
585
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
586 QLabel *endLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
587 endLabel->setObjectName(QString::fromUtf8("endLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
588 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
589 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
590 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
591 endtempEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 endtempEdit->setObjectName(QString::fromUtf8("endtempEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 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
594 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
595 endtempEdit->setDecimals(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596 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
597
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 QLabel *timeLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599 timeLabel->setObjectName(QString::fromUtf8("timeLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 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
601 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
602 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
603 steptimeEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
604 steptimeEdit->setObjectName(QString::fromUtf8("steptimeEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 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
606 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
607 steptimeEdit->setDecimals(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 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
609
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 QLabel *rampLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 rampLabel->setObjectName(QString::fromUtf8("rampLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
612 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
613 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
614 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
615 ramptimeEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616 ramptimeEdit->setObjectName(QString::fromUtf8("ramptimeEdit"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617 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
618 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
619 ramptimeEdit->setDecimals(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
620 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
621
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
622 QLabel *phLabel = new QLabel(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
623 phLabel->setObjectName(QString::fromUtf8("phLabel"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
624 phLabel->setText(tr("Measured pH:"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
625 phLabel->setGeometry(QRect(10, 130, 141, 20));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
626 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
627 stepphEdit = new QDoubleSpinBox(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
628 stepphEdit->setObjectName(QString::fromUtf8("phEdit"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
629 stepphEdit->setGeometry(QRect(160, 130, 121, 24));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
630 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
631 stepphEdit->setDecimals(2);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
632 stepphEdit->setMaximum(14.0);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
633 stepphEdit->setAccelerated(true);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
634 stepphEdit->setSingleStep(0.1);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
635 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
636
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
637 /*
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
638 * 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
639 */
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
640 QLabel *brixLabel = new QLabel(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
641 brixLabel->setObjectName(QString::fromUtf8("brixLabel"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
642 brixLabel->setText(tr("Measured Brix:"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
643 brixLabel->setGeometry(QRect(360, 130, 141, 20));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
644 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
645 brixEdit = new QDoubleSpinBox(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
646 brixEdit->setObjectName(QString::fromUtf8("brixEdit"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
647 brixEdit->setGeometry(QRect(510, 130, 121, 24));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
648 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
649 brixEdit->setDecimals(1);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
650 brixEdit->setMaximum(32);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
651 brixEdit->setAccelerated(true);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
652 brixEdit->setSingleStep(0.1);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
653
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
654 QLabel *sgLabel = new QLabel(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
655 sgLabel->setObjectName(QString::fromUtf8("sgLabel"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
656 sgLabel->setText(tr("Measured SG:"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
657 sgLabel->setGeometry(QRect(360, 160, 141, 20));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
658 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
659 stepsgEdit = new QDoubleSpinBox(dialog);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
660 stepsgEdit->setObjectName(QString::fromUtf8("sgEdit"));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
661 stepsgEdit->setGeometry(QRect(510, 160, 121, 24));
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
662 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
663 stepsgEdit->setDecimals(3);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
664 stepsgEdit->setMaximum(1.5);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
665 stepsgEdit->setAccelerated(true);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
666 stepsgEdit->setSingleStep(0.001);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
667 /* 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
668 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
669 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
670
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
671 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
672 * Only used for Infusion steps.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
673 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
674 ivolLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
675 ivolLabel->setObjectName(QString::fromUtf8("ivolLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
676 ivolLabel->setText(tr("Infusion volume:"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
677 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
678 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
679 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
680 stepivolEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
681 stepivolEdit->setObjectName(QString::fromUtf8("stepivolEdit"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
682 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
683 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
684 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
685 stepivolEdit->setDecimals(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
686 stepivolEdit->setAccelerated(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
687 stepivolEdit->setMaximum(100000.0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
688 stepivolEdit->setSingleStep(0.5);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
689 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
690
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691 itmpLabel = new QLabel(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692 itmpLabel->setObjectName(QString::fromUtf8("itmpLabel"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
693 itmpLabel->setText(tr("Infusion Temperature:"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
694 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
695 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
696 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
697 stepitmpEdit = new QDoubleSpinBox(dialog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 stepitmpEdit->setObjectName(QString::fromUtf8("stepitmpEdit"));
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
699 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
700 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
701 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
702 stepitmpEdit->setDecimals(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
703 stepitmpEdit->setReadOnly(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
704 stepitmpEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
705 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
706
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
707 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
708 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
709 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
710 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
711 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
712 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
713 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
714 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
715 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
716 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
717 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
718 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
719
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 dialog->setModal(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 dialog->exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
722 if (dialog->result() == QDialog::Rejected) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 qDebug() << "reject and rollback";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
724 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
725 /* Rollback water volumes too */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
726 double volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
727 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
728 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
729 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
730 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 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
732 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 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
734 product->wg_amount = volume;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 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
736 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 disconnect(stepnameEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 disconnect(steptempEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 disconnect(endtempEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 disconnect(steptimeEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 disconnect(ramptimeEdit, nullptr, nullptr, nullptr);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743 disconnect(stepivolEdit, nullptr, nullptr, nullptr);
202
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
744 disconnect(stepphEdit, nullptr, nullptr, nullptr);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
745 disconnect(stepsgEdit, nullptr, nullptr, nullptr);
49ec4fdee5a6 Added mash steps pH and SG values.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
746 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
747 disconnect(buttonBox, nullptr, nullptr, nullptr);
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 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753 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
754 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755 qDebug() << "mash_name_changed" << name;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756 product->mash_name = name;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 }
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 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
762 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 QSqlQuery query;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 int i;
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_select_changed" << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
767
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 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
769 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
770 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
771 query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 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
773 query.next();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
774 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
775
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776 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
777 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
778
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 QJsonParseError parseError;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780 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
781 if (!json.trimmed().isEmpty()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
782 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
783 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
784
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785 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
786 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
787 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
789 * 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
790 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 double infuse = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792 if (product->mashs.size()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 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
794 product->mashs.clear();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
795 ui->mashsTable->clear();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
796 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
797 if (newsteps.isArray()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
798 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
799 QJsonObject obj = newsteps.array().at(i).toObject();
287
83e66c6b6e07 Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
800 MashSteps m;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 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
802 if (obj["step_type"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 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
804 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
805 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
806 m.step_volume = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
807 m.step_infuse_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
808 m.step_infuse_temp = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
809 if (obj["step_temp"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
810 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
811 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
812 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
813 if (obj["step_time"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 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
815 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
816 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
817 if (obj["ramp_time"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818 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
819 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
820 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
821 if (obj["end_temp"].isString())
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
822 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
823 else
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
824 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
825 m.step_wg_ratio = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
826 product->mashs.append(m);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 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
830 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
831 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
832 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
835 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
836
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837

mercurial