src/EditProductTab9.cpp

Sun, 10 Mar 2024 11:03:39 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 10 Mar 2024 11:03:39 +0100
changeset 523
632591d9825e
parent 461
add4dbef0c81
permissions
-rw-r--r--

Disable Monitor menu if websocket server is not available.

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
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
156 void EditProduct::brew_brix_changed(double val)
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
157 {
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
158 sg_return = Utils::brix_to_sg(val);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
159 }
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
160
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
161
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
162 double EditProduct::brew_brix_edit(double sg, double sg_default)
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
163 {
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
164 double brix = 0.0;
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
165
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
166 QDialog* dialog = new QDialog(this);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
167 dialog->resize(360, 110);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
168 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
169 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
170 buttonBox->setGeometry(QRect(30, 60, 300, 32));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
171 buttonBox->setLayoutDirection(Qt::LeftToRight);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
172 buttonBox->setOrientation(Qt::Horizontal);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
173 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
174 buttonBox->setCenterButtons(true);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
175
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
176 QLabel *brixLabel = new QLabel(dialog);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
177 brixLabel->setObjectName(QString::fromUtf8("brixLabel"));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
178 brixLabel->setText(tr("Refractometer Brix:"));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
179 brixLabel->setGeometry(QRect(10, 20, 161, 24));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
180 brixLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
181
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
182 QDoubleSpinBox *brixEdit = new QDoubleSpinBox(dialog);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
183 brixEdit->setObjectName(QString::fromUtf8("brixEdit"));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
184 brixEdit->setGeometry(QRect(180, 20, 101, 24));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
185 brixEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
186 brixEdit->setAccelerated(true);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
187 brixEdit->setDecimals(1);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
188 brixEdit->setMaximum(32.0);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
189 brixEdit->setSingleStep(0.1);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
190
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
191 if (sg > 1.001)
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
192 brix = Utils::sg_to_brix(sg);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
193 else
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
194 brix = Utils::sg_to_brix(sg_default);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
195 brixEdit->setValue(brix);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
196
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
197 connect(brixEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_brix_changed);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
198 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
199 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
200
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
201 dialog->setModal(true);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
202 dialog->exec();
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
203 if (dialog->result() == QDialog::Rejected) {
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
204 sg_return = sg;
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
205 }
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
206
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
207 disconnect(brixEdit, nullptr, nullptr, nullptr);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
208 disconnect(buttonBox, nullptr, nullptr, nullptr);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
209
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
210 qDebug() << "brew_brix_edit(" << sg << sg_default << ") return" << sg_return;
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
211 return sg_return;
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
212 }
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
213
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
214
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
215 void EditProduct::brew_volume_calc(double volume, double kettle_volume, double kettle_height, double est_volume, bool aboil, bool chiller)
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
216 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
217 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
218
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
219 if ((chiller && volume > product->eq_chiller_volume) || (! chiller && volume > 0))
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
220 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
221 else
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
222 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
223
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
224 qDebug() << "brew_volume_calc(" << volume << kettle_volume << kettle_height << est_volume << aboil << chiller << ") cm:" << k_cm;
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
225
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
226 QDialog* dialog = new QDialog(this);
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
227 if (chiller)
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
228 dialog->resize(320, 140);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
229 else
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
230 dialog->resize(320, 110);
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
231 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
232 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
233 if (chiller)
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
234 buttonBox->setGeometry(QRect(40, 95, 240, 32));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
235 else
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
236 buttonBox->setGeometry(QRect(40, 65, 240, 32));
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
237 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
238 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
239 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
240 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
241
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
242 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
243 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
244 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
245 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
246 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
247
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
248 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
249 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
250 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
251 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
252 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
253 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
254 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
255 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
256 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
257 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
258
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
259 if (chiller) {
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
260 QLabel *opmLabel = new QLabel(dialog);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
261 opmLabel->setObjectName(QString::fromUtf8("opmLabel"));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
262 opmLabel->setText(tr("Measure with placed immersion chiller."));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
263 opmLabel->setGeometry(QRect(10, 60, 300, 24));
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
264 opmLabel->setAlignment(Qt::AlignCenter);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
265 }
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
266
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
267 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
268 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
269 else
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
270 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
271 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
272 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
273
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
274 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
275 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
276 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
277 }
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
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
280 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
281 {
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
282 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
283 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
284 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
285 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
286 } 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
287 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
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 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
290 }
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
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
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
293 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
294 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
295 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
296 double tot;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
297 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
298
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
299 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
300 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
301 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
302 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
303 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
304 }
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 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
307
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
308 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
309 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
310
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
311 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
312 result = 0;
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
313 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
314 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
315
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
316
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
317 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
318 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
319 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
320 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
321 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
322 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
323 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
324 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
325 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
326 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
327 calcEfficiencyBeforeBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
328 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
329
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
330
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
331 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
332 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
333 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
334 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
335 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
336 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
337 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
338 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
339 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
340 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
341 calcEfficiencyBeforeBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
342 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
343
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
344
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
345 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
346 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
347 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
348 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
349 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
350 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
351 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
352 calcEfficiencyBeforeBoil();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
353 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
354
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
355
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
356 void EditProduct::brew_preboil_brix_button()
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
357 {
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
358 product->brew_preboil_sg = brew_brix_edit(product->brew_preboil_sg, product->preboil_sg);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
359 ui->brew_preboilsgEdit->setValue(product->brew_preboil_sg);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
360 }
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
361
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
362
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
363 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
364 {
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
365 brew_volume_calc(product->brew_preboil_volume, product->eq_kettle_volume, product->eq_kettle_height, product->boil_size * 1.04, false, false);
212
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
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
368
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
369 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
370 {
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
371 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
372 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
373 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
374 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
375 } 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
376 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
377 }
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
378 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
379 }
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
380
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
381
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
382 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
383 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
384 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
385 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
386 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
387
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
388 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
389 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
390 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
391 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 216
diff changeset
392 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
393 } 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
394 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
395 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
396 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
397 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
398 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
399
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
400 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
401 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
402 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
403 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
404 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
405 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
406
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
407
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
408 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
409 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
410 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
411 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
412 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
413 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
414 } else {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
415 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
416 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
417 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
418 calcEfficiencyAfterBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
419 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
420
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
421
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
422 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
423 {
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
424 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
425 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
426 const QSignalBlocker blocker1(ui->brew_aboilvolEdit);
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
427 ui->brew_aboilvolEdit->setValue(product->brew_aboil_volume + product->eq_chiller_volume);
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
428 } else {
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
429 product->brew_aboil_volume = val - product->eq_chiller_volume;
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
430 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
431 is_changed();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
432 calcEfficiencyAfterBoil();
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
433 }
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
434
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
435
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
436 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
437 {
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
438 double vol = Utils::kettle_vol(val, product->eq_kettle_volume, product->eq_kettle_height);
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
439 product->brew_aboil_volume = vol - product->eq_chiller_volume;
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
440 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
441 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
442 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
443 calcEfficiencyAfterBoil();
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
444 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
445
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
446
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
447 void EditProduct::brew_aboil_brix_button()
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
448 {
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
449 product->brew_aboil_sg = brew_brix_edit(product->brew_aboil_sg, product->est_og3);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
450 ui->brew_aboilsgEdit->setValue(product->brew_aboil_sg);
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
451 }
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
452
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
453
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
454 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
455 {
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
456 brew_volume_calc(product->brew_aboil_volume + product->eq_chiller_volume,
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
457 product->eq_kettle_volume, product->eq_kettle_height,
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
458 (product->batch_size * 1.04) + product->eq_chiller_volume,
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
459 true, (product->eq_chiller_volume > 0));
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
460 }
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
461
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
462
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
463 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
464 {
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
465 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
466 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
467 }
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
468
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
469
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
470 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
471 {
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
472 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
473 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
474 }
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
475
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
476
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
477 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
478 {
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
479 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
480 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
481 }
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
482
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
483
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
484 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
485 {
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
486 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
487 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
488 }
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
489
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
490
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
491 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
492 {
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
493 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
494 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
495 }
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
496
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
497
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
498 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
499 {
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
500 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
501 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
502 }
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
503
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
504
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
505 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
506 {
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
507 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
508 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
509 }
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
510
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
511
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
512 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
513 {
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
514 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
515 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
516 }
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
517
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
518
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
519 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
520 {
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
521 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
522 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
523 }
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
524
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
525
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
526 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
527 {
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
528 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
529 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
530 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
531 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
532 }
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
533
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
534
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
535 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
536 {
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
537 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
538 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
539 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
540 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
541 }
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
542
213
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 void EditProduct::brew_log_button()
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
545 {
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
546 QSqlQuery query;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
547 double timestamp;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
548
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
549 QDialog* dialog = new QDialog(this);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
550 dialog->resize(1024, 600);
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
551
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
552 QPushButton *saveButton = new QPushButton(tr("Save"));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
553 saveButton->setAutoDefault(false);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
554 QIcon icon1;
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
555 icon1.addFile(QString::fromUtf8(":icons/silk/disk.png"), QSize(), QIcon::Normal, QIcon::Off);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
556 saveButton->setIcon(icon1);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
557
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
558 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
559 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
560 buttonBox->setOrientation(Qt::Vertical);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
561 buttonBox->setStandardButtons(QDialogButtonBox::Ok);
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
562 buttonBox->addButton(saveButton,QDialogButtonBox::ActionRole);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
563
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
564 QLineSeries *pv_mlt = new QLineSeries();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
565 pv_mlt->setName("MLT");
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
566 QLineSeries *sp_mlt = new QLineSeries();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
567 sp_mlt->setName("Set");
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
568 sp_mlt->setOpacity(0.75);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
569 QLineSeries *pv_hlt = new QLineSeries();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
570 pv_hlt->setName("HLT");
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
571 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
572 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
573
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
574 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
575 query.bindValue(":code", product->code);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
576 query.exec();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
577 while (query.next()) {
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
578 timestamp = query.value("datetime").toDateTime().toSecsSinceEpoch() * 1000;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
579 pv_mlt->append(timestamp, query.value("pv_mlt").toDouble());
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
580 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
581 if (query.value("pv_hlt").toDouble() > 0)
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
582 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
583 pwm_mlt0->append(timestamp, 0);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
584 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
585 }
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
586
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
587 QPen pen(QColorConstants::Svg::navy);
434
ebf4996ab396 Charts downsize the pen from 3 to 2. Some nicer looking graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
588 pen.setWidth(2);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
589 pv_mlt->setPen(pen);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
590 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
591 pwm_mlt->setName("MLT pwr");
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
592 pwm_mlt->setOpacity(0.25);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
593
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
594 chart = new QChart();
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
595 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
596 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
597 chart->addSeries(sp_mlt);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
598 chart->addSeries(pv_hlt);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
599 chart->addSeries(pv_mlt); // Top layer.
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
600
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
601 QDateTimeAxis *axisX = new QDateTimeAxis;
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
602 axisX->setTickCount(20);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
603 axisX->setFormat("HH:mm");
298
180c77a81e15 Update translations
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
604 axisX->setTitleText(tr("Time"));
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
605 axisX->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
606 chart->addAxis(axisX, Qt::AlignBottom);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
607 pv_mlt->attachAxis(axisX);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
608 pv_hlt->attachAxis(axisX);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
609
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
610 QValueAxis *axisY = new QValueAxis;
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
611 axisY->setRange(0, 110);
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
612 axisY->setTickCount(12);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
613 axisY->setMinorTickCount(1);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
614 axisY->setLabelFormat("%i");
298
180c77a81e15 Update translations
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
615 axisY->setTitleText(tr("Temperature °C or Power %"));
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
616 axisY->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
617 chart->addAxis(axisY, Qt::AlignLeft);
295
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
618
4b2ac345b982 Added power useage to the brew log.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
619 pwm_mlt->attachAxis(axisY);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
620 pv_mlt->attachAxis(axisY);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
621 sp_mlt->attachAxis(axisY);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
622 pv_hlt->attachAxis(axisY);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
623
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
624 connect(pv_mlt, &QLineSeries::hovered, this, &EditProduct::tooltip);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
625 connect(pv_hlt, &QLineSeries::hovered, this, &EditProduct::tooltip);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
626
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
627 chartView = new QChartView(chart);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
628 chartView->setRenderHint(QPainter::Antialiasing);
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
629 dialog->setLayout(new QHBoxLayout);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
630 dialog->layout()->addWidget(chartView);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
631 dialog->layout()->addWidget(buttonBox);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
632
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
633 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
634 connect(saveButton, SIGNAL(clicked()), this, SLOT(savePNG()));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
635
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
636 dialog->setModal(true);
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
637 dialog->exec();
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
638 }
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
639
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
640
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
641 void EditProduct::savePNG()
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
642 {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
643 QString path = QFileDialog::getSaveFileName(this, tr("Save Image"), QDir::homePath() + "/brewday.png", tr("Image (*.png)"));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
644 if (path.isEmpty()) {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
645 QMessageBox::warning(this, tr("Save File"), tr("No image file selected."));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
646 return;
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
647 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
648
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
649 QImage img((chartView->size()), QImage::Format_ARGB32);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
650 QPainter painter;
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
651 painter.begin(&img);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
652 chartView->render(&painter);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
653 painter.setRenderHint(QPainter::Antialiasing);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
654 painter.end();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
655 img.save(path);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
656 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
657
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
658
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
659 void EditProduct::tooltip(QPointF point, bool state)
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
660 {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
661 QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender());
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
662
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
663 if (t_tooltip == 0)
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
664 t_tooltip = new Callout(chart, series);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
665
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
666 if (state) {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
667 QDateTime timeis = QDateTime::fromMSecsSinceEpoch(point.x());
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
668 t_tooltip->setSeries(series);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
669 t_tooltip->setText(QString("%1\n%2 %3°C").arg(timeis.toString("dd-MM-yyyy hh:mm")).arg(series->name()).arg(point.y(), 2, 'f', 1));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
670 t_tooltip->setAnchor(point);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
671 t_tooltip->setZValue(11);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
672 t_tooltip->updateGeometry();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
673 t_tooltip->show();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
674 } else {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
675 t_tooltip->hide();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
676 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
677 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
678
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 298
diff changeset
679

mercurial