src/EditProductTab9.cpp

Sat, 18 Jun 2022 20:39:59 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 18 Jun 2022 20:39:59 +0200
changeset 296
2f4e250cfed9
parent 295
4b2ac345b982
child 298
180c77a81e15
permissions
-rw-r--r--

Added fermenter and iSpindel graphs.

175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditProduct.cpp is part of bmsapp.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Tab 9, brewday.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
21 /**
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
22 * @brief Check the state by examining the date values.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
23 * 1. startdate and enddate invalid, planning/wait status.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
24 * The enddate cannot be set.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
25 * 2. startdate valid and endate invalid, brewdate is planned.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
26 * The fase will be brew. Enable setting of enddate.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
27 * 3. startdate valid, enddate and start and endtime can be set.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
28 * The enddate cannot be before the startdate and not after 4
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
29 * days from the start.
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
30 * 4. startdate and enddate and times are set and valid. Block
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
31 * the startdate setting. But only after setting a lot of
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
32 * brewdata and acknowledge set the fase to primary.
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
33 *
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
34 */
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
35 void EditProduct::updateBrewday()
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
36 {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
37 setStage();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
38
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
39 qDebug() << "updateBrewday" << product->brew_date_start << product->brew_date_end;
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
40
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
41 ui->brew_startDate->setDate(product->brew_date_start.date());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
42 ui->brew_startTime->setTime(product->brew_date_start.time());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
43 ui->brew_endDate->setDate(product->brew_date_end.date());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
44 ui->brew_endTime->setTime(product->brew_date_end.time());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
45 }
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
46
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
47
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
48 void EditProduct::brew_date_clear()
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
49 {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
50 product->brew_date_start.setDate(QDate());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
51 ui->brew_startDate->setDate(QDate());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
52 }
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
53
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
54
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
55 void EditProduct::brew_date_today()
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
56 {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
57 product->brew_date_start.setDate(QDate::currentDate());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
58 ui->brew_startDate->setDate(QDate::currentDate());
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
59 }
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
60
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
61
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
62 void EditProduct::brew_start_date_changed(QDate val)
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
63 {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
64 product->brew_date_start.setDate(ui->brew_startDate->nullDate());
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
65 updateBrewday();
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
66 is_changed();
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
67 }
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
68
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
69
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
70 void EditProduct::brew_end_today() // Not really, the brew start date is used.
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
71 {
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
72 product->brew_date_end.setDate(product->brew_date_start.date());
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
73 ui->brew_endDate->setDate(product->brew_date_end.date());
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
74 }
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
75
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
76
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
77 void EditProduct::brew_end_date_changed(QDate val)
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
78 {
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
79 product->brew_date_end.setDate(ui->brew_endDate->nullDate());
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
80 updateBrewday();
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
81 is_changed();
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
82 }
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
83
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
84
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
85 void EditProduct::brew_start_time_changed(QTime val)
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
86 {
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
87 product->brew_date_start.setTime(ui->brew_startTime->time());
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
88 updateBrewday();
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
89 is_changed();
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
90 }
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
91
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
92
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
93 void EditProduct::brew_end_time_changed(QTime val)
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
94 {
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
95 product->brew_date_end.setTime(ui->brew_endTime->time());
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
96 updateBrewday();
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
97 is_changed();
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
98 }
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
99
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
100
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
101 void EditProduct::brew_date_ack()
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
102 {
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
103 int rc = QMessageBox::warning(this, tr("Confirm brew"), tr("Confirm that the brew date and time are correct"),
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
104 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
105
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
106 if (rc == QMessageBox::No)
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
107 return;
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
108
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
109 product->stage = PROD_STAGE_PRIMARY;
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
110 setStage();
216
39aad77b7599 Fixed set changed if brewdate is confirmed.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
111 is_changed();
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
112 }
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
113
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
114
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
115 void EditProduct::brew_mashph_changed(double val)
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
116 {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
117 if (product->brew_mash_ph == 0) {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
118 product->brew_mash_ph = 4.8;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
119 const QSignalBlocker blocker1(ui->brew_mashphEdit);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
120 ui->brew_mashphEdit->setValue(4.8);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
121 } else {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
122 product->brew_mash_ph = val;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
123 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
124 is_changed();
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
125 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
126
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
127
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
128 void EditProduct::brew_mashsg_changed(double val)
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
129 {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
130 product->brew_mash_sg = val;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
131 double c = Utils::sg_to_plato(product->est_mash_sg);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
132 double m = Utils::sg_to_plato(val);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
133
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
134 if (c > 0.5)
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
135 product->brew_mash_efficiency = 100 * m / c;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
136 else
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
137 product->brew_mash_efficiency = 0;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
138 ui->brew_masheffShow->setValue(product->brew_mash_efficiency);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
139 is_changed();
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
140 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
141
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
142
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
143 void EditProduct::brew_spargeph_changed(double val)
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
144 {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
145 if (product->brew_sparge_ph == 0) {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
146 product->brew_sparge_ph = 4.8;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
147 const QSignalBlocker blocker1(ui->brew_spargephEdit);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
148 ui->brew_spargephEdit->setValue(4.8);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
149 } else {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
150 product->brew_sparge_ph = val;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
151 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
152 is_changed();
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
153 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
154
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
155
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
156 void EditProduct::brew_volume_calc(double volume, double kettle_volume, double kettle_height, double est_volume, bool aboil)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
157 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
158 double k_cm;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
159
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
160 if (volume > 0)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
161 k_cm = Utils::kettle_cm(volume, kettle_volume, kettle_height);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
162 else
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
163 k_cm = Utils::kettle_cm(est_volume, kettle_volume, kettle_height);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
164
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
165 QDialog* dialog = new QDialog(this);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
166 dialog->resize(320, 110);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
167 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
168 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
169 buttonBox->setGeometry(QRect(40, 65, 240, 32));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
170 buttonBox->setLayoutDirection(Qt::LeftToRight);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
171 buttonBox->setOrientation(Qt::Horizontal);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
172 buttonBox->setStandardButtons(QDialogButtonBox::Ok);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
173 buttonBox->setCenterButtons(true);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
174
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
175 QLabel *cmLabel = new QLabel(dialog);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
176 cmLabel->setObjectName(QString::fromUtf8("cmLabel"));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
177 cmLabel->setText(tr("Distance from top:"));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
178 cmLabel->setGeometry(QRect(10, 20, 141, 20));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
179 cmLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
180
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
181 QDoubleSpinBox *cmEdit = new QDoubleSpinBox(dialog);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
182 cmEdit->setObjectName(QString::fromUtf8("cmEdit"));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
183 cmEdit->setGeometry(QRect(160, 20, 121, 24));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
184 cmEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
185 cmEdit->setAccelerated(true);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
186 cmEdit->setDecimals(1);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
187 cmEdit->setSuffix(tr(" cm"));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
188 cmEdit->setMaximum(kettle_height * 100);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
189 cmEdit->setSingleStep(0.1);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
190 cmEdit->setValue(k_cm);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
191
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
192 if (aboil)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
193 connect(cmEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_aboil_cm_changed);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
194 else
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
195 connect(cmEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_preboil_cm_changed);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
196 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
197 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
198
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
199 dialog->setModal(true);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
200 dialog->exec();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
201 disconnect(cmEdit, nullptr, nullptr, nullptr);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
202 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
203
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
204
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
205 void EditProduct::brew_preboilph_changed(double val)
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
206 {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
207 if (product->brew_preboil_ph == 0) {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
208 product->brew_preboil_ph = 4.8;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
209 const QSignalBlocker blocker1(ui->brew_preboilphEdit);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
210 ui->brew_preboilphEdit->setValue(4.8);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
211 } else {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
212 product->brew_preboil_ph = val;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
213 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
214 is_changed();
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
215 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
216
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
217
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
218 void EditProduct::calcEfficiencyBeforeBoil()
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
219 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
220 double m = 0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
221 double tot;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
222 double result = 0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
223
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
224 if (product->fermentables.size() == 0)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
225 return; // no fermentables loaded yet
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
226 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
227 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
228 m += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100);
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
229 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
230 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
231 tot = Utils::sg_to_plato(product->brew_preboil_sg) * (product->brew_preboil_volume / 1.04) * product->brew_preboil_sg * 10 / 1000;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
232
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
233 if (m > 0)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
234 result = round((tot / m * 100) * 10.0) / 10.0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
235
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
236 if (result < 0)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
237 result = 0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
238 ui->brew_preboileffShow->setValue(result);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
239 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
240
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
241
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
242 void EditProduct::brew_preboilsg_changed(double val)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
243 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
244 if (product->brew_preboil_sg == 0) {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
245 product->brew_preboil_sg = product->preboil_sg;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
246 const QSignalBlocker blocker1(ui->brew_preboilsgEdit);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
247 ui->brew_preboilsgEdit->setValue(product->preboil_sg);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
248 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
249 product->brew_preboil_sg = val;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
250 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
251 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
252 calcEfficiencyBeforeBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
253 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
254
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
255
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
256 void EditProduct::brew_preboilvol_changed(double val)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
257 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
258 if (product->brew_preboil_volume == 0) {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
259 product->brew_preboil_volume = product->boil_size * 1.04;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
260 const QSignalBlocker blocker1(ui->brew_preboilvolEdit);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
261 ui->brew_preboilvolEdit->setValue(product->boil_size * 1.04);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
262 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
263 product->brew_preboil_volume = val;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
264 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
265 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
266 calcEfficiencyBeforeBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
267 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
268
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
269
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
270 void EditProduct::brew_preboil_cm_changed(double val)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
271 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
272 double vol = Utils::kettle_vol(val, product->eq_kettle_volume, product->eq_kettle_height);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
273 product->brew_preboil_volume = vol;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
274 const QSignalBlocker blocker1(ui->brew_preboilvolEdit);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
275 ui->brew_preboilvolEdit->setValue(vol);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
276 is_changed();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
277 calcEfficiencyBeforeBoil();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
278 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
279
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
280
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
281 void EditProduct::brew_preboil_button()
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
282 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
283 brew_volume_calc(product->brew_preboil_volume, product->eq_kettle_volume, product->eq_kettle_height, product->boil_size * 1.04, false);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
284 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
285
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
286
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
287 void EditProduct::brew_aboilph_changed(double val)
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
288 {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
289 if (product->brew_aboil_ph == 0) {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
290 product->brew_aboil_ph = 4.8;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
291 const QSignalBlocker blocker1(ui->brew_aboilphEdit);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
292 ui->brew_aboilphEdit->setValue(4.8);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
293 } else {
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
294 product->brew_aboil_ph = val;
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
295 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
296 is_changed();
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
297 }
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
298
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
299
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
300 void EditProduct::calcEfficiencyAfterBoil()
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
301 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
302 double m = 0; // Sugars added at mash
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
303 double b = 0; // Sugars added at boil
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
304 double result = 0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
305
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
306 if (product->fermentables.size() == 0)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
307 return; // no fermentables loaded yet
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
308 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
309 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
310 m += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
311 } else if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
312 b += product->fermentables.at(i).amount * (product->fermentables.at(i).yield / 100) * (1 - product->fermentables.at(i).moisture / 100);
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
313 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
314 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
315 double tot = Utils::sg_to_plato(product->brew_aboil_sg) * (product->brew_aboil_volume / 1.04) * product->brew_aboil_sg * 10 / 1000;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
316 tot -= b; // total sugars in wort minus added sugars.
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
317
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
318 if (m > 0)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
319 result = round((tot / m * 100) * 10.0) / 10.0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
320 product->brew_aboil_efficiency = result;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
321 ui->brew_aboileffShow->setValue(result);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
322 calcFermentables(); // This will also recalculate all volumes.
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
323 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
324
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
325
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
326 void EditProduct::brew_aboilsg_changed(double val)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
327 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
328 if (product->brew_aboil_sg == 0) {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
329 product->brew_aboil_sg = product->est_og3;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
330 const QSignalBlocker blocker1(ui->brew_aboilsgEdit);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
331 ui->brew_aboilsgEdit->setValue(product->est_og3);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
332 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
333 product->brew_aboil_sg = val;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
334 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
335 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
336 calcEfficiencyAfterBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
337 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
338
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
339
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
340 void EditProduct::brew_aboilvol_changed(double val)
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
341 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
342 if (product->brew_aboil_volume == 0) {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
343 product->brew_aboil_volume = product->batch_size * 1.04;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
344 const QSignalBlocker blocker1(ui->brew_aboilvolEdit);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
345 ui->brew_aboilvolEdit->setValue(product->batch_size * 1.04);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
346 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
347 product->brew_aboil_volume = val;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
348 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
349 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
350 calcEfficiencyAfterBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
351 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
352
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
353
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
354 void EditProduct::brew_aboil_cm_changed(double val)
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
355 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
356 double vol = Utils::kettle_vol(val, product->eq_kettle_volume, product->eq_kettle_height);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
357 product->brew_aboil_volume = vol;
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
358 const QSignalBlocker blocker1(ui->brew_aboilvolEdit);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
359 ui->brew_aboilvolEdit->setValue(vol);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
360 is_changed();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
361 calcEfficiencyAfterBoil();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
362 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
363
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
364
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
365 void EditProduct::brew_aboil_button()
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
366 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
367 brew_volume_calc(product->brew_aboil_volume, product->eq_kettle_volume, product->eq_kettle_height, product->batch_size * 1.04, true);
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
368 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
369
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
370
210
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
371 void EditProduct::brew_cooling_method_changed(int val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
372 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
373 product->brew_cooling_method = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
374 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
375 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
376
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
377
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
378 void EditProduct::brew_cooling_to_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
379 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
380 product->brew_cooling_to = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
381 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
382 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
383
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
384
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
385 void EditProduct::brew_cooling_time_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
386 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
387 product->brew_cooling_time = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
388 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
389 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
390
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
391
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
392 void EditProduct::brew_whirlpool9_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
393 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
394 product->brew_whirlpool9 = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
395 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
396 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
397
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
398
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
399 void EditProduct::brew_whirlpool7_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
400 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
401 product->brew_whirlpool7 = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
402 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
403 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
404
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
405
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
406 void EditProduct::brew_whirlpool6_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
407 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
408 product->brew_whirlpool6 = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
409 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
410 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
411
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
412
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
413 void EditProduct::brew_whirlpool2_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
414 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
415 product->brew_whirlpool2 = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
416 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
417 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
418
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
419
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
420 void EditProduct::brew_aerwith_changed(int val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
421 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
422 product->brew_aeration_type = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
423 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
424 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
425
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
426
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
427 void EditProduct::brew_aerspeed_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
428 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
429 product->brew_aeration_speed = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
430 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
431 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
432
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
433
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
434 void EditProduct::brew_aertime_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
435 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
436 product->brew_aeration_time = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
437 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
438 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
439
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
440
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
441 void EditProduct::brew_trubloss_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
442 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
443 product->brew_fermenter_tcloss = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
444 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
445 calcFermentables(); // This will also recalculate all volumes.
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
446 calcIBUs();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
447 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
448
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
449
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
450 void EditProduct::brew_topupwater_changed(double val)
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
451 {
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
452 product->brew_fermenter_extrawater = val;
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
453 is_changed();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
454 calcFermentables(); // This will also recalculate all volumes.
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
455 calcIBUs();
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
456 }
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
457
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
458
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
459 void EditProduct::brew_log_button()
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
460 {
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
461 QSqlQuery query;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
462 double timestamp;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
463
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
464 QDialog* dialog = new QDialog(this);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
465 dialog->resize(1024, 600);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
466 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
467 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
468 buttonBox->setGeometry(QRect(40, 565, 944, 36));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
469 buttonBox->setLayoutDirection(Qt::LeftToRight);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
470 buttonBox->setOrientation(Qt::Horizontal);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
471 buttonBox->setStandardButtons(QDialogButtonBox::Ok);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
472 buttonBox->setCenterButtons(true);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
473
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
474 QLineSeries *pv_mlt = new QLineSeries();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
475 pv_mlt->setName("MLT");
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
476 QLineSeries *sp_mlt = new QLineSeries();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
477 sp_mlt->setName("Set");
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
478 sp_mlt->setOpacity(0.75);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
479 QLineSeries *pv_hlt = new QLineSeries();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
480 pv_hlt->setName("HLT");
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
481 QLineSeries *pwm_mlt1 = new QLineSeries(); // Top side of area
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
482 QLineSeries *pwm_mlt0 = new QLineSeries(); // Bottom side of area
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
483
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
484 query.prepare("SELECT * FROM log_brews WHERE code=:code ORDER BY datetime");
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
485 query.bindValue(":code", product->code);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
486 query.exec();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
487 while (query.next()) {
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
488 timestamp = query.value("datetime").toDateTime().toSecsSinceEpoch() * 1000;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
489 pv_mlt->append(timestamp, query.value("pv_mlt").toDouble());
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
490 sp_mlt->append(timestamp, query.value("sp_mlt").toDouble());
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
491 if (query.value("pv_hlt").toDouble() > 0)
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
492 pv_hlt->append(timestamp, query.value("pv_hlt").toDouble());
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
493 pwm_mlt0->append(timestamp, 0);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
494 pwm_mlt1->append(timestamp, query.value("pwm_mlt").toInt());
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
495 }
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
496
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
497 QPen pen(QColorConstants::Svg::navy);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
498 pen.setWidth(3);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
499 pv_mlt->setPen(pen);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
500 QAreaSeries *pwm_mlt = new QAreaSeries(pwm_mlt0, pwm_mlt1);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
501 pwm_mlt->setName("MLT pwr");
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
502 pwm_mlt->setOpacity(0.25);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
503
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
504 QChart *chart = new QChart();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
505 chart->setTitle(QString("%1 \"%2\"").arg(product->code).arg(product->name));
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
506 chart->addSeries(pwm_mlt); // Order is important, first drawn is lowest layer.
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
507 chart->addSeries(sp_mlt);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
508 chart->addSeries(pv_hlt);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
509 chart->addSeries(pv_mlt); // Top layer.
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
510
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
511 QDateTimeAxis *axisX = new QDateTimeAxis;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
512 axisX->setTickCount(20);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
513 axisX->setFormat("HH:mm");
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
514 axisX->setTitleText("Time");
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
515 axisX->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
516 chart->addAxis(axisX, Qt::AlignBottom);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
517 pv_mlt->attachAxis(axisX);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
518 pv_hlt->attachAxis(axisX);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
519
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
520 QValueAxis *axisY = new QValueAxis;
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
521 axisY->setRange(0, 110);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
522 axisY->setTickCount(12);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
523 axisY->setMinorTickCount(1);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
524 axisY->setLabelFormat("%i");
296
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 295
diff changeset
525 axisY->setTitleText(tr("Temperature or Power %"));
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
526 axisY->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
527 chart->addAxis(axisY, Qt::AlignLeft);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
528
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
529 pwm_mlt->attachAxis(axisY);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
530 pv_mlt->attachAxis(axisY);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
531 sp_mlt->attachAxis(axisY);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
532 pv_hlt->attachAxis(axisY);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
533
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
534 QChartView *chartView = new QChartView(chart);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
535 chartView->setRenderHint(QPainter::Antialiasing);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
536 dialog->setLayout(new QVBoxLayout);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
537 dialog->layout()->addWidget(chartView);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
538 dialog->layout()->addWidget(buttonBox);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
539
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
540 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
541 dialog->setModal(true);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
542 dialog->exec();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
543 }
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
544
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
545

mercurial