Sat, 08 Oct 2022 16:02:25 +0200
Version 0.2.27
128 | 1 | /** |
2 | * EditRecipe.cpp is part of bmsapp. | |
3 | * | |
4 | * tab 6, mash. | |
5 | * | |
6 | * bmsapp is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * bmsapp is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | ||
21 | void EditRecipe::refreshMashs() | |
22 | { | |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
23 | QString w; |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
24 | QWidget* pWidget; |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
25 | QHBoxLayout* pLayout; |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
26 | QTableWidgetItem *item; |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
27 | QIcon down_icon, up_icon; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
28 | |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
29 | qDebug() << "refreshMashs" << recipe->mashs.size(); |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
30 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
31 | down_icon.addFile(QString::fromUtf8(":/icons/silk/bullet_arrow_down.png"), QSize(), QIcon::Normal, QIcon::Off); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
32 | up_icon.addFile(QString::fromUtf8(":/icons/silk/bullet_arrow_up.png"), QSize(), QIcon::Normal, QIcon::Off); |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
33 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
34 | const QStringList labels({tr("Step name"), tr("Type"), tr("Start"), tr("End"), tr("Rest"), tr("Ramp"), |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
35 | tr("Inf/dec"), tr("Inf/dec"), tr("Volume"), tr("W/G ratio"), "", "", tr("Delete"), tr("Edit") }); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
36 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
37 | ui->mashsTable->setColumnCount(14); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
38 | ui->mashsTable->setColumnWidth(0, 189); /* Step name */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
39 | ui->mashsTable->setColumnWidth(1, 100); /* Type */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
40 | ui->mashsTable->setColumnWidth(2, 70); /* Start temp */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
41 | ui->mashsTable->setColumnWidth(3, 70); /* End temp */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
42 | ui->mashsTable->setColumnWidth(4, 70); /* Rest time */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
43 | ui->mashsTable->setColumnWidth(5, 70); /* Ramp time */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
44 | ui->mashsTable->setColumnWidth(6, 70); /* Infusion vol */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
45 | ui->mashsTable->setColumnWidth(7, 70); /* Infusion tmp */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
46 | ui->mashsTable->setColumnWidth(8, 70); /* Volume */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
47 | ui->mashsTable->setColumnWidth(9, 80); /* W/G ratio */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
48 | ui->mashsTable->setColumnWidth(10, 30); /* Up button */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
49 | ui->mashsTable->setColumnWidth(11, 30); /* Down button */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
50 | ui->mashsTable->setColumnWidth(12, 80); /* Delete */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
51 | ui->mashsTable->setColumnWidth(13, 80); /* Edit */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
52 | ui->mashsTable->setHorizontalHeaderLabels(labels); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
53 | ui->mashsTable->verticalHeader()->hide(); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
54 | ui->mashsTable->setRowCount(recipe->mashs.size()); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
55 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
56 | for (int i = 0; i < recipe->mashs.size(); i++) { |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
57 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
58 | ui->mashsTable->setItem(i, 0, new QTableWidgetItem(recipe->mashs.at(i).step_name)); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
59 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
287
diff
changeset
|
60 | item = new QTableWidgetItem(QCoreApplication::translate("StepType", g_step_types[recipe->mashs.at(i).step_type])); |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
61 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
62 | ui->mashsTable->setItem(i, 1, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
63 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
64 | item = new QTableWidgetItem(QString("%1 °C").arg(recipe->mashs.at(i).step_temp, 2, 'f', 1, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
65 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
66 | ui->mashsTable->setItem(i, 2, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
67 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
68 | item = new QTableWidgetItem(QString("%1 °C").arg(recipe->mashs.at(i).end_temp, 2, 'f', 1, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
69 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
70 | ui->mashsTable->setItem(i, 3, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
71 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
72 | item = new QTableWidgetItem(QString("%1 min").arg(recipe->mashs.at(i).step_time, 1, 'f', 0, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
73 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
74 | ui->mashsTable->setItem(i, 4, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
75 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
76 | item = new QTableWidgetItem(QString("%1 min").arg(recipe->mashs.at(i).ramp_time, 1, 'f', 0, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
77 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
78 | ui->mashsTable->setItem(i, 5, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
79 | |
147 | 80 | if (recipe->mashs.at(i).step_infuse_amount > 0) { |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
81 | item = new QTableWidgetItem(QString("%1 L").arg(recipe->mashs.at(i).step_infuse_amount, 2, 'f', 1, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
82 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
83 | ui->mashsTable->setItem(i, 6, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
84 | item = new QTableWidgetItem(QString("%1 °C").arg(recipe->mashs.at(i).step_infuse_temp, 3, 'f', 2, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
85 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
86 | ui->mashsTable->setItem(i, 7, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
87 | } else { |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
88 | ui->mashsTable->removeCellWidget(i, 6); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
89 | ui->mashsTable->removeCellWidget(i, 7); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
90 | } |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
91 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
92 | item = new QTableWidgetItem(QString("%1 L").arg(recipe->mashs.at(i).step_volume, 2, 'f', 1, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
93 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
94 | ui->mashsTable->setItem(i, 8, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
95 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
96 | item = new QTableWidgetItem(QString("%1 L/kg").arg(recipe->mashs.at(i).step_wg_ratio, 3, 'f', 2, '0')); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
97 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
98 | ui->mashsTable->setItem(i, 9, item); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
99 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
100 | if (i > 0) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
101 | pWidget = new QWidget(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
102 | QPushButton* btn_up = new QPushButton(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
103 | btn_up->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
104 | btn_up->setIcon(up_icon); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
105 | connect(btn_up, SIGNAL(clicked()), this, SLOT(upMashRow_clicked())); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
106 | pLayout = new QHBoxLayout(pWidget); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
107 | pLayout->addWidget(btn_up); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
108 | pLayout->setContentsMargins(5, 0, 5, 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
109 | pWidget->setLayout(pLayout); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
110 | ui->mashsTable->setCellWidget(i, 10, pWidget); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
111 | } else { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
112 | ui->mashsTable->removeCellWidget(i, 10); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
113 | } |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
114 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
115 | if (i < (recipe->mashs.size() - 1)) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
116 | pWidget = new QWidget(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
117 | QPushButton* btn_down = new QPushButton(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
118 | btn_down->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
119 | btn_down->setIcon(down_icon); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
120 | connect(btn_down, SIGNAL(clicked()), this, SLOT(downMashRow_clicked())); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
121 | pLayout = new QHBoxLayout(pWidget); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
122 | pLayout->addWidget(btn_down); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
123 | pLayout->setContentsMargins(5, 0, 5, 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
124 | pWidget->setLayout(pLayout); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
125 | ui->mashsTable->setCellWidget(i, 11, pWidget); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
126 | } else { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
127 | ui->mashsTable->removeCellWidget(i, 11); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
128 | } |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
129 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
130 | pWidget = new QWidget(); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
131 | QPushButton* btn_dele = new QPushButton(); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
132 | btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
133 | btn_dele->setText(tr("Delete")); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
134 | connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked())); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
135 | pLayout = new QHBoxLayout(pWidget); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
136 | pLayout->addWidget(btn_dele); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
137 | pLayout->setContentsMargins(5, 0, 5, 0); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
138 | pWidget->setLayout(pLayout); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
139 | ui->mashsTable->setCellWidget(i, 12, pWidget); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
140 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
141 | pWidget = new QWidget(); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
142 | QPushButton* btn_edit = new QPushButton(); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
143 | btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
144 | btn_edit->setText(tr("Edit")); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
145 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked())); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
146 | pLayout = new QHBoxLayout(pWidget); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
147 | pLayout->addWidget(btn_edit); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
148 | pLayout->setContentsMargins(5, 0, 5, 0); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
149 | pWidget->setLayout(pLayout); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
150 | ui->mashsTable->setCellWidget(i, 13, pWidget); |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
151 | } |
128 | 152 | } |
153 | ||
154 | ||
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
155 | double EditRecipe::infusionVol(double step_infused, double step_mashkg, double infuse_temp, double step_temp, double last_temp) |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
156 | { |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
157 | double a = last_temp * (equip_tun_weight * equip_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt); |
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
158 | double b = step_temp * (equip_tun_weight * equip_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt); |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
159 | double vol = round(((b - a) / ((infuse_temp - step_temp) * SpecificHeatWater)) * 100.0) / 100.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
160 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
161 | if (vol < 0) |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
162 | vol = 0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
163 | qDebug() << " infusionVol(" << step_infused << "," << step_mashkg << "," << infuse_temp <<"," << step_temp << "," << last_temp << "):" << vol; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
164 | return vol; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
165 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
166 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
167 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
168 | double EditRecipe::decoctionVol(double step_volume, double step_temp, double prev_temp) |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
169 | { |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
170 | double a = (equip_tun_weight * equip_tun_specific_heat + step_volume * SpecificHeatWater) * (step_temp - prev_temp); |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
171 | double b = SpecificHeatWater * (99 - step_temp); |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
172 | double vol = 0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
173 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
174 | if (b > 0) |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
175 | vol = round((a / b) * 1000000.0) / 1000000.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
176 | qDebug() << " decoctionVol(" << step_volume << "," << step_temp << "," << prev_temp << "):" << vol; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
177 | return vol; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
178 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
179 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
180 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
181 | void EditRecipe::calcMash() |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
182 | { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
183 | double infused = 0, vol, a, b, temp; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
184 | int i, j, n; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
185 | double lasttemp = 18.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
186 | double graintemp = 18.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
187 | double tuntemp = 18.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
188 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
189 | recipe->mashs_time = 0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
190 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
191 | if (recipe->mashs.size() && recipe->mashs_kg > 0) { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
192 | qDebug() << "calcMash()"; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
193 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
194 | for (i = 0; i < recipe->mashs.size(); i++) { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
195 | if (recipe->mashs.at(i).step_type == 0) { // Infusion |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
196 | if (i == 0) { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
197 | // First mash step, temperature from the mashtun and malt. |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
198 | n = 20; // tun is preheated. |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
199 | tuntemp = recipe->mashs.at(i).step_temp; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
200 | for (j = 0; j < n; j++) { |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
201 | a = recipe->mashs_kg * graintemp * SpecificHeatMalt + equip_tun_weight * tuntemp * equip_tun_specific_heat; |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
202 | b = recipe->mashs[i].step_temp * |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
151
diff
changeset
|
203 | (equip_tun_weight * equip_tun_specific_heat + |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
204 | recipe->mashs.at(i).step_infuse_amount * SpecificHeatWater + |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
205 | recipe->mashs_kg * SpecificHeatMalt) - |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
206 | SlakingHeat * recipe->mashs_kg; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
207 | if (recipe->mashs.at(i).step_infuse_amount > 0) { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
208 | temp = (b - a) / (recipe->mashs.at(i).step_infuse_amount * SpecificHeatWater); |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
209 | } else { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
210 | temp = 99; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
211 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
212 | tuntemp += (temp - tuntemp) / 2; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
213 | recipe->mashs[i].step_infuse_temp = round(temp * 1000000.0) / 1000000.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
214 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
215 | qDebug() << " init infuse temp:" << recipe->mashs.at(i).step_infuse_temp; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
216 | } else { |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
217 | // Calculate amount of infusion water. |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
218 | recipe->mashs[i].step_infuse_amount = |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
219 | infusionVol(infused, recipe->mashs_kg, recipe->mashs.at(i).step_infuse_temp, recipe->mashs.at(i).step_temp, lasttemp); |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
220 | qDebug() << i << " vol:" << recipe->mashs.at(i).step_infuse_amount << "temp:" << recipe->mashs.at(i).step_infuse_temp; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
221 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
222 | infused += recipe->mashs.at(i).step_infuse_amount; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
223 | } else if (recipe->mashs.at(i).step_type == 1) { // Temperature |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
224 | if (i > 0) |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
225 | recipe->mashs[i].step_infuse_amount = 0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
226 | recipe->mashs[i].step_infuse_temp = 0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
227 | } else if (recipe->mashs.at(i).step_type == 2) { // Decoction |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
228 | recipe->mashs[i].step_infuse_amount = decoctionVol(infused, recipe->mashs.at(i).step_temp, lasttemp); |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
229 | recipe->mashs[i].step_infuse_temp = 99; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
230 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
231 | recipe->mashs[i].step_volume = infused; |
151
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
232 | //qDebug() << i << " type:" << recipe->mashs.at(i).step_type << "volume:" << recipe->mashs.at(i).step_infuse_amount << "temp:" << recipe->mashs.at(i).step_infuse_temp; |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
233 | lasttemp = recipe->mashs.at(i).step_temp; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
234 | recipe->mashs_time += recipe->mashs.at(i).step_time; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
235 | if (i > 0) |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
236 | recipe->mashs_time += recipe->mashs.at(i).ramp_time; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
237 | recipe->mashs[i].step_wg_ratio = round((infused / recipe->mashs_kg) * 1000000.0) / 1000000.0; |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
238 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
239 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
240 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
241 | /* Show the calculated total mash time. */ |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
242 | ui->mash_timeEdit->setText(QString("%1:%2").arg(recipe->mashs_time / 60).arg(recipe->mashs_time % 60, 2, 'f', 0, '0')); |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
243 | } |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
244 | |
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
245 | |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
246 | void EditRecipe::addMashRow_clicked() |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
247 | { |
287
83e66c6b6e07
Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
248 | MashSteps newm; |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
249 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
250 | for (int i = 0; i < recipe->mashs.size(); i++) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
251 | if (recipe->mashs.at(i).step_time == 0) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
252 | return; // Add only one at a time. |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
253 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
254 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
255 | newm.step_name = "Name me"; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
256 | newm.step_temp = newm.end_temp = 67.0; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
257 | newm.step_time = 20; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
258 | newm.ramp_time = 10; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
259 | if (recipe->mashs.size()) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
260 | newm.step_volume = recipe->mashs.at(recipe->mashs.size() - 1).step_volume; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
261 | newm.step_wg_ratio = recipe->mashs.at(recipe->mashs.size() - 1).step_wg_ratio; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
262 | newm.step_type = recipe->mashs.at(recipe->mashs.size() - 1).step_type; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
263 | } else { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
264 | newm.step_volume = 0; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
265 | newm.step_wg_ratio = 0; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
266 | newm.step_type = 1; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
267 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
268 | newm.step_infuse_amount = newm.step_infuse_temp = 0; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
269 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
270 | recipe->mashs.append(newm); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
271 | is_changed(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
272 | emit refreshAll(); |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
273 | } |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
274 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
275 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
276 | void EditRecipe::deleteMashRow_clicked() |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
277 | { |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
278 | if (recipe->locked || recipe->mashs.size() < 1) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
279 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
280 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
281 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
282 | int row = pb->objectName().toInt(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
283 | qDebug() << "Delete mash row" << row << recipe->mashs.size(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
284 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
285 | int rc = QMessageBox::warning(this, tr("Delete mash step"), tr("Delete %1").arg(recipe->mashs.at(row).step_name), |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
286 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
287 | if (rc == QMessageBox::No) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
288 | return; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
289 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
290 | recipe->mashs.removeAt(row); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
291 | is_changed(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
292 | emit refreshAll(); |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
293 | } |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
294 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
295 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
296 | void EditRecipe::upMashRow_clicked() |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
297 | { |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
298 | if (recipe->locked || recipe->mashs.size() < 1) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
299 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
300 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
301 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
302 | int row = pb->objectName().toInt(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
303 | qDebug() << "Move up mash row" << row << recipe->mashs.size(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
304 | |
287
83e66c6b6e07
Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
305 | MashSteps temp; |
146 | 306 | temp = recipe->mashs[row - 1]; |
307 | recipe->mashs[row - 1] = recipe->mashs[row]; | |
308 | recipe->mashs[row] = temp; | |
309 | is_changed(); | |
310 | emit refreshAll(); | |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
311 | } |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
312 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
313 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
314 | void EditRecipe::downMashRow_clicked() |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
315 | { |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
316 | if (recipe->locked || recipe->mashs.size() < 1) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
317 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
318 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
319 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
320 | int row = pb->objectName().toInt(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
321 | qDebug() << "Move down mash row" << row << recipe->mashs.size(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
322 | |
287
83e66c6b6e07
Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
323 | MashSteps temp; |
146 | 324 | temp = recipe->mashs[row + 1]; |
325 | recipe->mashs[row + 1] = recipe->mashs[row]; | |
326 | recipe->mashs[row] = temp; | |
327 | is_changed(); | |
328 | emit refreshAll(); | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
329 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
330 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
331 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
332 | void EditRecipe::step_name_changed(QString val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
333 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
334 | recipe->mashs[recipe->mashs_row].step_name = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
335 | ui->mashsTable->setItem(recipe->mashs_row, 0, new QTableWidgetItem(val)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
336 | is_changed(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
337 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
338 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
339 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
340 | void EditRecipe::step_type_changed(int val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
341 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
342 | qDebug() << "step_type_changed" << recipe->mashs_row << val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
343 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
344 | recipe->mashs[recipe->mashs_row].step_type = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
345 | ivolLabel->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
346 | stepivolEdit->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
347 | itmpLabel->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
348 | stepitmpEdit->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
349 | is_changed(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
350 | emit refreshAll(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
351 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
352 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
353 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
354 | void EditRecipe::step_temp_changed(double val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
355 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
356 | qDebug() << "step_temp_changed" << recipe->mashs_row << val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
357 | recipe->mashs[recipe->mashs_row].step_temp = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
358 | QTableWidgetItem *item = new QTableWidgetItem(QString("%1 °C").arg(val, 2, 'f', 1, '0')); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
359 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
360 | ui->mashsTable->setItem(recipe->mashs_row, 2, item); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
361 | is_changed(); |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
362 | emit refreshAll(); |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
363 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
364 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
365 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
366 | void EditRecipe::end_temp_changed(double val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
367 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
368 | qDebug() << "end_temp_changed" << recipe->mashs_row << val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
369 | recipe->mashs[recipe->mashs_row].end_temp = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
370 | QTableWidgetItem *item = new QTableWidgetItem(QString("%1 °C").arg(val, 2, 'f', 1, '0')); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
371 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
372 | ui->mashsTable->setItem(recipe->mashs_row, 3, item); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
373 | is_changed(); |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
374 | emit refreshAll(); |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
375 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
376 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
377 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
378 | void EditRecipe::step_time_changed(double val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
379 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
380 | qDebug() << "step_time_changed" << recipe->mashs_row << val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
381 | recipe->mashs[recipe->mashs_row].step_time = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
382 | QTableWidgetItem *item = new QTableWidgetItem(QString("%1 min").arg(val, 1, 'f', 0, '0')); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
383 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
384 | ui->mashsTable->setItem(recipe->mashs_row, 4, item); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
385 | is_changed(); |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
386 | emit refreshAll(); |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
387 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
388 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
389 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
390 | void EditRecipe::ramp_time_changed(double val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
391 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
392 | qDebug() << "ramp_time_changed" << recipe->mashs_row << val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
393 | recipe->mashs[recipe->mashs_row].ramp_time = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
394 | QTableWidgetItem *item = new QTableWidgetItem(QString("%1 min").arg(val, 1, 'f', 0, '0')); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
395 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
396 | ui->mashsTable->setItem(recipe->mashs_row, 5, item); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
397 | is_changed(); |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
398 | emit refreshAll(); |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
399 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
400 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
401 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
402 | void EditRecipe::infuse_changed(double val) |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
403 | { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
404 | qDebug() << "infuse_changed" << recipe->mashs_row << val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
405 | recipe->mashs[recipe->mashs_row].step_infuse_amount = val; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
406 | QTableWidgetItem *item = new QTableWidgetItem(QString("%1 L").arg(val, 1, 'f', 0, '0')); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
407 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
408 | ui->mashsTable->setItem(recipe->mashs_row, 6, item); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
409 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
410 | /* |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
411 | * Recalculate water volumes |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
412 | */ |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
413 | double volume = 0; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
414 | for (int i = 0; i < recipe->mashs.size(); i++) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
415 | if (recipe->mashs.at(i).step_type == 0) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
416 | volume += recipe->mashs.at(i).step_infuse_amount; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
417 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
418 | recipe->mashs[i].step_volume = volume; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
419 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
420 | recipe->w1_amount = volume - recipe->w2_amount; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
421 | recipe->wg_amount = volume; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
422 | ui->w1_volEdit->setValue(recipe->w1_amount); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
423 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
424 | is_changed(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
425 | emit refreshAll(); |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
426 | } |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
427 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
428 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
429 | void EditRecipe::editMashRow_clicked() |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
430 | { |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
431 | QSqlQuery query; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
432 | |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
433 | if (recipe->locked) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
434 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
163
diff
changeset
|
435 | |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
436 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
437 | recipe->mashs_row = pb->objectName().toInt(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
438 | qDebug() << "Edit mash row" << recipe->mashs_row; |
287
83e66c6b6e07
Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
439 | MashSteps backup = recipe->mashs.at(recipe->mashs_row); |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
440 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
441 | QDialog* dialog = new QDialog(this); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
442 | dialog->resize(738, 230); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
443 | QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
444 | buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
445 | buttonBox->setGeometry(QRect(30, 180, 671, 32)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
446 | buttonBox->setLayoutDirection(Qt::LeftToRight); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
447 | buttonBox->setOrientation(Qt::Horizontal); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
448 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
449 | buttonBox->setCenterButtons(true); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
450 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
451 | QLabel *nameLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
452 | nameLabel->setObjectName(QString::fromUtf8("nameLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
453 | nameLabel->setText(tr("Step name:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
454 | nameLabel->setGeometry(QRect(10, 10, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
455 | nameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
456 | stepnameEdit = new QLineEdit(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
457 | stepnameEdit->setObjectName(QString::fromUtf8("stepnameEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
458 | stepnameEdit->setText(recipe->mashs.at(recipe->mashs_row).step_name); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
459 | stepnameEdit->setGeometry(QRect(160, 10, 511, 23)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
460 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
461 | QLabel *typeLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
462 | typeLabel->setObjectName(QString::fromUtf8("typeLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
463 | typeLabel->setText(tr("Step type:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
464 | typeLabel->setGeometry(QRect(10, 40, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
465 | typeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
466 | QComboBox *typeEdit = new QComboBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
467 | typeEdit->setObjectName(QString::fromUtf8("typeEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
468 | typeEdit->setGeometry(QRect(160, 40, 161, 23)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
469 | typeEdit->addItem(tr("Infusion")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
470 | typeEdit->addItem(tr("Temperature")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
471 | typeEdit->addItem(tr("Decoction")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
472 | typeEdit->setCurrentIndex(recipe->mashs.at(recipe->mashs_row).step_type); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
473 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
474 | QLabel *tempLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
475 | tempLabel->setObjectName(QString::fromUtf8("tempLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
476 | tempLabel->setText(tr("Step start temp:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
477 | tempLabel->setGeometry(QRect(10, 70, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
478 | tempLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
479 | steptempEdit = new QDoubleSpinBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
480 | steptempEdit->setObjectName(QString::fromUtf8("steptempEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
481 | steptempEdit->setGeometry(QRect(160, 70, 121, 24)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
482 | steptempEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
483 | steptempEdit->setDecimals(1); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
484 | steptempEdit->setValue(recipe->mashs.at(recipe->mashs_row).step_temp); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
485 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
486 | QLabel *endLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
487 | endLabel->setObjectName(QString::fromUtf8("endLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
488 | endLabel->setText(tr("Step end temp:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
489 | endLabel->setGeometry(QRect(360, 70, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
490 | endLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
491 | endtempEdit = new QDoubleSpinBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
492 | endtempEdit->setObjectName(QString::fromUtf8("endtempEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
493 | endtempEdit->setGeometry(QRect(510, 70, 121, 24)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
494 | endtempEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
495 | endtempEdit->setDecimals(1); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
496 | endtempEdit->setValue(recipe->mashs.at(recipe->mashs_row).end_temp); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
497 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
498 | QLabel *timeLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
499 | timeLabel->setObjectName(QString::fromUtf8("timeLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
500 | timeLabel->setText(tr("Step rest time:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
501 | timeLabel->setGeometry(QRect(10, 100, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
502 | timeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
503 | steptimeEdit = new QDoubleSpinBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
504 | steptimeEdit->setObjectName(QString::fromUtf8("steptimeEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
505 | steptimeEdit->setGeometry(QRect(160, 100, 121, 24)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
506 | steptimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
507 | steptimeEdit->setDecimals(0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
508 | steptimeEdit->setValue(recipe->mashs.at(recipe->mashs_row).step_time); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
509 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
510 | QLabel *rampLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
511 | rampLabel->setObjectName(QString::fromUtf8("rampLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
512 | rampLabel->setText(tr("Step ramp time:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
513 | rampLabel->setGeometry(QRect(360, 100, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
514 | rampLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
515 | ramptimeEdit = new QDoubleSpinBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
516 | ramptimeEdit->setObjectName(QString::fromUtf8("ramptimeEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
517 | ramptimeEdit->setGeometry(QRect(510, 100, 121, 24)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
518 | ramptimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
519 | ramptimeEdit->setDecimals(0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
520 | ramptimeEdit->setValue(recipe->mashs.at(recipe->mashs_row).ramp_time); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
521 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
522 | /* |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
523 | * Only used for Infusion steps. |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
524 | */ |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
525 | ivolLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
526 | ivolLabel->setObjectName(QString::fromUtf8("ivolLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
527 | ivolLabel->setText(tr("Infusion volume:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
528 | ivolLabel->setGeometry(QRect(10, 130, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
529 | ivolLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
530 | ivolLabel->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
531 | stepivolEdit = new QDoubleSpinBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
532 | stepivolEdit->setObjectName(QString::fromUtf8("stepivolEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
533 | stepivolEdit->setGeometry(QRect(160, 130, 121, 24)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
534 | stepivolEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
535 | stepivolEdit->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
536 | stepivolEdit->setDecimals(1); |
163
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
537 | stepivolEdit->setAccelerated(true); |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
538 | stepivolEdit->setMaximum(100000.0); |
145
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
539 | stepivolEdit->setSingleStep(0.5); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
540 | stepivolEdit->setValue(recipe->mashs.at(recipe->mashs_row).step_infuse_amount); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
541 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
542 | itmpLabel = new QLabel(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
543 | itmpLabel->setObjectName(QString::fromUtf8("itmpLabel")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
544 | itmpLabel->setText(tr("Infusion Temperature:")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
545 | itmpLabel->setGeometry(QRect(360, 130, 141, 20)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
546 | itmpLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
547 | itmpLabel->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
548 | stepitmpEdit = new QDoubleSpinBox(dialog); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
549 | stepitmpEdit->setObjectName(QString::fromUtf8("stepitmpEdit")); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
550 | stepitmpEdit->setGeometry(QRect(510, 130, 121, 24)); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
551 | stepitmpEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
552 | stepitmpEdit->setVisible(recipe->mashs.at(recipe->mashs_row).step_type == 0); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
553 | stepitmpEdit->setDecimals(1); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
554 | stepitmpEdit->setReadOnly(true); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
555 | stepitmpEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
556 | stepitmpEdit->setValue(recipe->mashs.at(recipe->mashs_row).step_infuse_temp); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
557 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
558 | connect(stepnameEdit, &QLineEdit::textEdited, this, &EditRecipe::step_name_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
559 | connect(typeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::step_type_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
560 | connect(steptempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::step_temp_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
561 | connect(endtempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::end_temp_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
562 | connect(steptimeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::step_time_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
563 | connect(ramptimeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::ramp_time_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
564 | connect(stepivolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::infuse_changed); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
565 | connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
566 | connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
567 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
568 | dialog->setModal(true); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
569 | dialog->exec(); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
570 | if (dialog->result() == QDialog::Rejected) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
571 | qDebug() << "reject and rollback"; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
572 | recipe->mashs[recipe->mashs_row] = backup; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
573 | /* Rollback water volumes too */ |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
574 | double volume = 0; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
575 | for (int i = 0; i < recipe->mashs.size(); i++) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
576 | if (recipe->mashs.at(i).step_type == 0) { |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
577 | volume += recipe->mashs.at(i).step_infuse_amount; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
578 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
579 | recipe->mashs[i].step_volume = volume; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
580 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
581 | recipe->w1_amount = volume - recipe->w2_amount; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
582 | recipe->wg_amount = volume; |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
583 | ui->w1_volEdit->setValue(recipe->w1_amount); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
584 | } |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
585 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
586 | disconnect(stepnameEdit, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
587 | disconnect(steptempEdit, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
588 | disconnect(endtempEdit, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
589 | disconnect(steptimeEdit, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
590 | disconnect(ramptimeEdit, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
591 | disconnect(stepivolEdit, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
592 | disconnect(buttonBox, nullptr, nullptr, nullptr); |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
593 | |
fd4f0de86fd9
Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents:
144
diff
changeset
|
594 | emit refreshAll(); |
144
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
595 | } |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
596 | |
c4b107bf153a
First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
597 | |
163
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
598 | void EditRecipe::mash_name_changed(QString name) |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
599 | { |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
600 | qDebug() << "mash_name_changed" << name; |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
601 | recipe->mash_name = name; |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
602 | is_changed(); |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
603 | } |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
604 | |
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
605 | |
147 | 606 | void EditRecipe::mash_select_changed(int val) |
607 | { | |
608 | QSqlQuery query; | |
609 | int i; | |
610 | ||
611 | qDebug() << "mash_select_changed" << val; | |
612 | ||
163
6cccd340ea8c
Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
613 | const QSignalBlocker blocker1(ui->mash_nameEdit); |
147 | 614 | query.prepare("SELECT name,steps FROM profile_mash ORDER BY name"); |
615 | query.exec(); | |
616 | query.first(); | |
617 | for (i = 0; i < (val -1); i++) { | |
618 | query.next(); | |
619 | } | |
620 | ||
151
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
621 | recipe->mash_name = query.value(0).toString(); |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
622 | ui->mash_nameEdit->setText(recipe->mash_name); |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
623 | |
147 | 624 | QJsonParseError parseError; |
625 | const auto& json = query.value(1).toString(); | |
626 | if (!json.trimmed().isEmpty()) { | |
627 | const auto& formattedJson = QString("%1").arg(json); | |
628 | QJsonDocument newsteps = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); | |
629 | ||
630 | if (parseError.error != QJsonParseError::NoError) { | |
631 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset; | |
632 | } else { | |
633 | /* | |
634 | * Got the json data in the steps array, replace the recipe steps. | |
635 | */ | |
151
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
636 | double infuse = 0; |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
637 | if (recipe->mashs.size()) { |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
638 | infuse = recipe->mashs.at(0).step_infuse_amount; |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
639 | recipe->mashs.clear(); |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
640 | ui->mashsTable->clear(); |
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
641 | } |
147 | 642 | if (newsteps.isArray()) { |
643 | for (i = 0; i < newsteps.array().size(); i++) { | |
644 | QJsonObject obj = newsteps.array().at(i).toObject(); | |
287
83e66c6b6e07
Renamed struct Mashs to MashSteps
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
645 | MashSteps m; |
147 | 646 | m.step_name = obj["step_name"].toString(); |
647 | if (obj["step_type"].isString()) | |
648 | m.step_type = QString(obj["step_type"].toString()).toInt(); | |
649 | else | |
650 | m.step_type = obj["step_type"].toInt(); | |
651 | m.step_volume = 0; | |
652 | m.step_infuse_amount = 0; | |
653 | m.step_infuse_temp = 0; | |
654 | if (obj["step_temp"].isString()) | |
655 | m.step_temp = QString(obj["step_temp"].toString()).toDouble(); | |
656 | else | |
657 | m.step_temp = obj["step_temp"].toDouble(); | |
658 | if (obj["step_time"].isString()) | |
659 | m.step_time = QString(obj["step_time"].toString()).toDouble(); | |
660 | else | |
661 | m.step_time = obj["step_time"].toDouble(); | |
662 | if (obj["ramp_time"].isString()) | |
663 | m.ramp_time = QString(obj["ramp_time"].toString()).toDouble(); | |
664 | else | |
665 | m.ramp_time = obj["ramp_time"].toDouble(); | |
666 | if (obj["end_temp"].isString()) | |
667 | m.end_temp = QString(obj["end_temp"].toString()).toDouble(); | |
668 | else | |
669 | m.end_temp = obj["end_temp"].toDouble(); | |
670 | m.step_wg_ratio = 0; | |
671 | recipe->mashs.append(m); | |
672 | } | |
673 | } | |
148
ba25a566b100
Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
674 | if (recipe->mashs.at(0).step_type == 0) |
151
b5b2483f3a3f
New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents:
148
diff
changeset
|
675 | recipe->mashs[0].step_infuse_amount = infuse; // Restore saved initial infusion |
147 | 676 | } |
677 | } | |
678 | is_changed(); | |
679 | emit refreshAll(); | |
680 | } | |
681 | ||
682 |