src/EditProductTab1.cpp

Fri, 20 May 2022 14:48:03 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 20 May 2022 14:48:03 +0200
changeset 224
d369948a3eb5
parent 219
fa7cad488e27
child 225
448e4187cada
permissions
-rw-r--r--

Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.

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 1, generic settings.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 void EditProduct::name_changed(QString name)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 product->name = name;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 void EditProduct::notes_changed()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 /* The text cannot be passed in a simple way :) */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 product->notes = ui->notesEdit->toPlainText();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 * New beerstyle is selected.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 void EditProduct::style_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 QSqlQuery query;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 query.prepare("SELECT * FROM profile_styles ORDER BY style_guide,style_letter,name");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 // Skip to the record index.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 for (int i = 0; i < (val - 1); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 query.next();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 // Set relevant fields and update ranges.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 product->st_name = query.value(1).toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 product->st_category = query.value(2).toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 product->st_category_number = query.value(3).toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 product->st_letter = query.value(4).toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 product->st_guide = query.value(5).toString();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 product->st_type = query.value(6).toInt();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 product->st_og_min = query.value(7).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 product->st_og_max = query.value(8).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 product->st_fg_min = query.value(9).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 product->st_fg_max = query.value(10).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 product->st_ibu_min = query.value(11).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 product->st_ibu_max = query.value(12).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 product->st_color_min = query.value(13).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 product->st_color_max = query.value(14).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 product->st_carb_min = query.value(15).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 product->st_carb_max = query.value(16).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 product->st_abv_min = query.value(17).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 product->st_abv_max = query.value(18).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 ui->st_nameEdit->setText(product->st_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 ui->st_groupEdit->setText(product->st_letter);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 ui->st_guideEdit->setText(product->st_guide);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 ui->st_catEdit->setText(product->st_category);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 ui->st_catnrEdit->setText(QString("%1").arg(product->st_category_number));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 ui->st_typeEdit->setText(style_types[product->st_type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ui->est_ogShow->setRange(query.value(7).toDouble(), query.value(8).toDouble());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 ui->est_fgShow->setRange(query.value(9).toDouble(), query.value(10).toDouble());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 void EditProduct::colormethod_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 product->color_method = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 calcFermentables();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 void EditProduct::ibumethod_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 product->ibu_method = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 void EditProduct::est_og_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 product->est_og = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 calcFermentablesFromOG(val);// Adjust fermentables amounts
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 calcFermentables(); // Update the product details
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 calcMash();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 void EditProduct::efficiency_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 double estog = product->est_og;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 product->efficiency = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 calcFermentablesFromOG(estog);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 calcFermentables();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 void EditProduct::boil_time_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 qDebug() << "boil_time_changed" << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 double new_evap = (0.1 * product->batch_size) * val / 60.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 product->boil_size = product->batch_size + new_evap;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 product->boil_time = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 ui->boil_sizeEdit->setValue(product->boil_size);
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
136 ui->brew_preboilvolShow->setValue(product->boil_size * 1.04);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 calcFermentables();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 void EditProduct::batch_size_changed(double val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 qDebug() << "batch_size_changed" << val << "old" << product->batch_size;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 double evap = (0.1 * val) * product->boil_time / 60.0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 product->boil_size = val + evap;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 double factor = val / product->batch_size;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 ui->boil_sizeEdit->setValue(product->boil_size);
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
151 ui->brew_preboilvolShow->setValue(product->boil_size * 1.04);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 product->sparge_volume *= factor;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 ui->sp_volEdit->setValue(product->sparge_volume);
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
154 ui->brew_spargevolShow->setValue(product->sparge_volume);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 product->batch_size = val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 calcFermentablesFromOG(product->est_og); // Keep the OG
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 adjustWaters(factor);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 calcFermentables();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 adjustHops(factor);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 adjustMiscs(factor);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 adjustYeasts(factor);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 calcWater();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 calcMash();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 void EditProduct::brew_type_changed(int val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 product->type;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 void EditProduct::locked_changed(bool val)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 qDebug() << "locked_changed" << val;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
181 if (product->stage < PROD_STAGE_READY)
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
182 return;
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
183
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 product->locked = val;
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
185 product->stage = val ? PROD_STAGE_CLOSED : PROD_STAGE_READY;
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
186 setStage();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 is_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
191 void EditProduct::setStage()
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 {
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
193 int stage = product->stage;
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
194 bool locked = product->locked;
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
195
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
196 /*
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
197 * See if we need to set a new stage.
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
198 */
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
199 if ((stage == PROD_STAGE_PLAN) && (product->est_og > 1.005) && (product->est_color > 3) && (product->est_ibu > 3))
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
200 stage = PROD_STAGE_WAIT;
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
201 if ((stage == PROD_STAGE_WAIT) && (product->brew_date_start.date().isValid()))
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
202 stage = PROD_STAGE_BREW;
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
203 if ((stage == PROD_STAGE_BREW) && (! product->brew_date_start.date().isValid()))
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
204 stage = PROD_STAGE_WAIT;
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
205 /* from PROD_STAGE_BREW to PROD_STAGE_PRIMARY is handled in EditProductTab9.cpp */
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
206 /* from PROD_STAGE_PRIMARY to PROD_STAGE_SECONDARY is handled in EditProductTab10.cpp */
224
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
207 /* from PROD_STAGE_SECONDARY to PROD_STAGE_TERIARY is handled in EditProductTab10.cpp */
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
208 if ((stage == PROD_STAGE_TERTIARY) && product->package_date.isValid())
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
209 stage = PROD_STAGE_PACKAGE;
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
210 if ((stage == PROD_STAGE_PACKAGE) && (! product->package_date.isValid()))
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
211 stage = PROD_STAGE_TERTIARY;
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
212 /* from PROD_STAGE_PACKAGE to PROD_STAGE_CARBONATION is handled in EditProductTab11.cpp */
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
213 if ((stage == PROD_STAGE_CARBONATION) && (product->package_date.daysTo(QDate::currentDate()) > 14))
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
214 stage = PROD_STAGE_MATURE;
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
215
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
216 if (product->stage != stage) {
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
217 qDebug() << "setStage() change state:" << prod_stages[product->stage] << "to:" << prod_stages[stage];
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
218 product->stage = stage;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
219 is_changed();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
220 } else {
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
221 qDebug() << "setStage() stage:" << prod_stages[stage];
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
222 }
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
223
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
224 ui->stageEdit->setText(prod_stages[stage]);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
225
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 /* Tab 1, generic */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
227 ui->typeEdit->setDisabled(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
228 ui->color_methodEdit->setDisabled(locked);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
229 ui->ibu_methodEdit->setDisabled(locked);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
230 ui->beerstyleEdit->setDisabled(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
231 ui->nameEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
232 ui->codeEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
233 ui->notesEdit->setReadOnly(locked);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
234 ui->batch_sizeEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
235 ui->batch_sizeEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
236 ui->boil_sizeEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
237 ui->boil_sizeEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
238 ui->boil_timeEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
239 ui->boil_timeEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
240 ui->efficiencyEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
241 ui->efficiencyEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
242 ui->est_ogEdit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
243 ui->est_ogEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
244 // Block locked if stage <= PROD_STAGE_TASTE
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
246 /* Tab 2, equipment */
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
247 ui->tabWidget->setTabEnabled(1, stage < PROD_STAGE_BREW);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
248
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
249 /* Tab 3, fermentables */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
250 ui->est_og2Edit->setReadOnly(stage > PROD_STAGE_WAIT);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
251 ui->est_og2Edit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
252 ui->addFermentable->setEnabled(stage <= PROD_STAGE_PACKAGE);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
254 /* Tab 4, hops */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
255 ui->addHop->setEnabled(stage <= PROD_STAGE_PACKAGE);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
257 /* Tab 5, miscs */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
258 ui->addMisc->setEnabled(stage <= PROD_STAGE_PACKAGE);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
260 /* Tab 6, yeasts */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
261 ui->addYeast->setEnabled(stage <= PROD_STAGE_PACKAGE);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
263 /* Tab 7, mash */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
264 ui->addMash->setEnabled(stage <= PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
265 ui->mash_nameEdit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
266 ui->mash_pickEdit->setDisabled(stage > PROD_STAGE_BREW);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
268 /* Tab 8, water */
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
269 ui->sp_sourceEdit->setDisabled(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
270 ui->wt_sourceEdit->setDisabled(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
271 ui->w1_nameEdit->setDisabled(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
272 ui->w2_nameEdit->setDisabled(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
273 ui->mw_acidPick->setDisabled(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
274 ui->sp_acidtypeEdit->setDisabled(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
275 ui->w2_volEdit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
276 ui->w2_volEdit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
277 ui->sp_phEdit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
278 ui->sp_phEdit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
279 ui->sp_tempEdit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
280 ui->sp_tempEdit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
281 ui->sp_volEdit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
282 ui->sp_volEdit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
283 ui->bs_cacl2Edit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
284 ui->bs_cacl2Edit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
285 ui->bs_caso4Edit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
286 ui->bs_caso4Edit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
287 ui->bs_mgso4Edit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
288 ui->bs_mgso4Edit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
289 ui->bs_naclEdit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
290 ui->bs_naclEdit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
291 ui->bs_mgcl2Edit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
292 ui->bs_mgcl2Edit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
293 ui->bs_nahco3Edit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
294 ui->bs_nahco3Edit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
295 ui->bs_caco3Edit->setReadOnly(stage > PROD_STAGE_BREW);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
296 ui->bs_caco3Edit->setButtonSymbols((stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
297 if (stage > PROD_STAGE_BREW) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 ui->mw_phEdit->setReadOnly(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 ui->mw_phEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 ui->mw_acidvolEdit->setReadOnly(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 ui->mw_acidvolEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 ui->mw_phEdit->setReadOnly(! product->calc_acid);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 ui->mw_phEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 ui->mw_acidvolEdit->setReadOnly(product->calc_acid);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 ui->mw_acidvolEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 }
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
308 ui->mw_autoEdit->setDisabled(stage > PROD_STAGE_BREW);
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
309
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
310 /* Tab 9, brewday */
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
311 ui->tabWidget->setTabEnabled(8, stage > PROD_STAGE_PLAN);
211
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
312 if (product->log_brew) {
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
313 ui->brew_logLabel->show();
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
314 ui->brew_logButton->show();
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
315 } else {
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
316 ui->brew_logLabel->hide();
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
317 ui->brew_logButton->hide();
bec0386b1df1 Only show brew_log prompt and button if there is a log.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
318 }
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: 211
diff changeset
319 ui->brew_ackLabel->hide();
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: 211
diff changeset
320 ui->brew_ackButton->hide();
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
321 if (product->stage < PROD_STAGE_BREW) {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
322 ui->brew_startButton1->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
323 ui->brew_startButton2->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
324 ui->brew_startDate->setReadOnly(false);
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
325 ui->brew_startDate->setMinimumDate(product->birth.addDays(-1)); // The birth date is the first valid date.
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
326 ui->brew_endButton1->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
327 ui->brew_startLabel2->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
328 ui->brew_endLabel->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
329 ui->brew_endLabel2->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
330 ui->brew_startTime->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
331 ui->brew_endDate->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
332 ui->brew_endTime->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
333 } else if (product->stage == PROD_STAGE_BREW) {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
334 ui->brew_startButton1->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
335 ui->brew_startButton2->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
336 ui->brew_startDate->setReadOnly(false);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
337 ui->brew_startLabel2->show();
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: 206
diff changeset
338
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: 206
diff changeset
339 /*
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: 206
diff changeset
340 * Enable brew_end settings if it is the right date or later.
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: 206
diff changeset
341 * If some essential values are filled in.
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: 206
diff changeset
342 */
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: 206
diff changeset
343 int brewTime = product->brew_date_start.date().daysTo(QDate::currentDate());
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: 206
diff changeset
344
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: 206
diff changeset
345 if ((brewTime >= 0) && (product->brew_cooling_method > 0) && (product->brew_cooling_time > 0) &&
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: 206
diff changeset
346 (product->brew_aboil_sg > 1.002) && (product->brew_aboil_volume > 0)) {
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: 206
diff changeset
347 ui->brew_endLabel->show();
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: 206
diff changeset
348 ui->brew_startLabel2->show();
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: 206
diff changeset
349 ui->brew_endLabel2->show();
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: 206
diff changeset
350 ui->brew_endButton1->show();
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: 206
diff changeset
351 ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
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: 206
diff changeset
352 ui->brew_startTime->show();
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: 206
diff changeset
353 ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
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: 206
diff changeset
354 ui->brew_endDate->show();
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: 206
diff changeset
355 ui->brew_endDate->setReadOnly(false);
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: 206
diff changeset
356 ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
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: 206
diff changeset
357 ui->brew_endTime->show();
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: 211
diff changeset
358 if (product->brew_date_end.isValid() && product->brew_date_start.isValid() &&
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: 211
diff changeset
359 (product->brew_date_start.msecsTo(product->brew_date_end) > 7200000)) {
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: 211
diff changeset
360 /* The start and end dates are valid, and the end is more then two hours after the start. */
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: 211
diff changeset
361 ui->brew_ackLabel->show();
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: 211
diff changeset
362 ui->brew_ackButton->show();
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: 211
diff changeset
363 }
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: 206
diff changeset
364 } else {
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: 206
diff changeset
365 ui->brew_endButton1->hide();
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: 206
diff changeset
366 ui->brew_startLabel2->hide();
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: 206
diff changeset
367 ui->brew_endLabel->hide();
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: 206
diff changeset
368 ui->brew_endLabel2->hide();
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: 206
diff changeset
369 ui->brew_startTime->hide();
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: 206
diff changeset
370 ui->brew_endDate->hide();
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: 206
diff changeset
371 ui->brew_endTime->hide();
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: 206
diff changeset
372 }
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
373 } else {
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
374 ui->brew_startButton1->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
375 ui->brew_startButton2->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
376 ui->brew_startDate->setReadOnly(true);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
377 ui->brew_startLabel2->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
378 ui->brew_endLabel->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
379 ui->brew_endLabel2->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
380 ui->brew_endButton1->hide();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
381 ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
382 ui->brew_startTime->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
383 ui->brew_startTime->setReadOnly(true);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
384 ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::NoButtons);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
385 ui->brew_endDate->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
386 ui->brew_endDate->setReadOnly(true);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
387 ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
388 ui->brew_endTime->show();
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
389 ui->brew_endTime->setReadOnly(true);
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
390 }
206
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
391 ui->brew_mashphEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
392 ui->brew_mashphEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
393 ui->brew_mashsgEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
394 ui->brew_mashsgEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
395 ui->brew_spargephEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
396 ui->brew_spargephEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
397 ui->brew_preboilphEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
398 ui->brew_preboilphEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
399 ui->brew_preboilsgEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
400 ui->brew_preboilsgEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
401 ui->brew_preboilvolEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
402 ui->brew_preboilvolEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
403 ui->brew_preboilButton->setDisabled(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
404 ui->brew_aboilphEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
405 ui->brew_aboilphEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
406 ui->brew_aboilsgEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
407 ui->brew_aboilsgEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
408 ui->brew_aboilvolEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
409 ui->brew_aboilvolEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
410 ui->brew_aboilButton->setDisabled(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
411 ui->brew_cooltoEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
412 ui->brew_cooltoEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
413 ui->brew_cooltimeEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
414 ui->brew_cooltimeEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
415 ui->brew_coolwithEdit->setDisabled(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
416 ui->brew_whirlpool9Edit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
417 ui->brew_whirlpool9Edit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
418 ui->brew_whirlpool7Edit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
419 ui->brew_whirlpool7Edit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
420 ui->brew_whirlpool6Edit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
421 ui->brew_whirlpool6Edit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
422 ui->brew_whirlpool2Edit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
423 ui->brew_whirlpool2Edit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
424 ui->brew_aerspeedEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
425 ui->brew_aerspeedEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
426 ui->brew_aertimeEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
427 ui->brew_aertimeEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
428 ui->brew_aerwithEdit->setDisabled(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
429 ui->brew_trublossEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
430 ui->brew_trublossEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
431 ui->brew_topupwaterEdit->setReadOnly(stage > PROD_STAGE_BREW);
83ae8ac83f51 Enable/disable read/write al settings on the brewday tab as needed.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
432 ui->brew_topupwaterEdit->setButtonSymbols( (stage > PROD_STAGE_BREW) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
433
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
434 /* Tab 10, fermentation */
190
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
435 ui->tabWidget->setTabEnabled(9, stage > PROD_STAGE_WAIT);
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
436 ui->prim_enddateEdit->setReadOnly(true);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
437 ui->prim_enddateEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
438 ui->prim_enddateButton->hide();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
439 ui->prim_ackButton->hide();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
440 ui->sec_enddateEdit->setReadOnly(true);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
441 ui->sec_enddateEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
442 ui->sec_enddateButton->hide();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
443 ui->sec_ackButton->hide();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
444 ui->prim_startCEdit->setReadOnly(product->stage != PROD_STAGE_PRIMARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
445 ui->prim_startCEdit->setButtonSymbols((product->stage == PROD_STAGE_PRIMARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
446 ui->prim_maxCEdit->setReadOnly(product->stage != PROD_STAGE_PRIMARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
447 ui->prim_maxCEdit->setButtonSymbols((product->stage == PROD_STAGE_PRIMARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
448 ui->prim_endCEdit->setReadOnly(product->stage != PROD_STAGE_PRIMARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
449 ui->prim_endCEdit->setButtonSymbols((product->stage == PROD_STAGE_PRIMARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
450 ui->prim_endsgEdit->setReadOnly(product->stage != PROD_STAGE_PRIMARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
451 ui->prim_endsgEdit->setButtonSymbols((product->stage == PROD_STAGE_PRIMARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
452 if (product->stage == PROD_STAGE_PRIMARY)
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
453 ui->prim_endsgButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
454 else
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
455 ui->prim_endsgButton->hide();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
456 if ((product->primary_start_temp > 0) && (product->primary_max_temp > 0) && (product->primary_end_temp > 0) &&
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
457 (product->primary_end_sg > 0.980) && (product->stage == PROD_STAGE_PRIMARY)) {
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
458 ui->prim_enddateEdit->setReadOnly(false);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
459 ui->prim_enddateEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
460 ui->prim_enddateEdit->setMinimumDate(product->brew_date_end.date());
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
461 ui->prim_enddateEdit->setMaximumDate(QDate::currentDate());
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
462 ui->prim_enddateButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
463 if (product->primary_end_date.isValid()) {
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
464 ui->prim_ackButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
465 }
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
466 }
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
467 ui->sec_tempEdit->setReadOnly(product->stage != PROD_STAGE_SECONDARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
468 ui->sec_tempEdit->setButtonSymbols((product->stage == PROD_STAGE_SECONDARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
469 ui->sec_sgEdit->setReadOnly(product->stage != PROD_STAGE_SECONDARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
470 ui->sec_sgEdit->setButtonSymbols((product->stage == PROD_STAGE_SECONDARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
471 if (product->stage == PROD_STAGE_SECONDARY)
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
472 ui->sec_sgButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
473 else
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
474 ui->sec_sgButton->hide();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
475 if ((product->secondary_end_sg > 0.980) && (product->secondary_temp > 0) && (product->stage == PROD_STAGE_SECONDARY)) {
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
476 ui->sec_enddateEdit->setReadOnly(false);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
477 ui->sec_enddateEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
478 ui->sec_enddateEdit->setMinimumDate(product->primary_end_date.addDays(-1)); // Allow same date as primary end.
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
479 ui->sec_enddateEdit->setMaximumDate(QDate::currentDate());
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
480 ui->sec_enddateButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
481 if (product->secondary_end_date.isValid()) {
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
482 ui->sec_ackButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
483 }
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
484 }
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
485 ui->tert_tempEdit->setReadOnly(product->stage != PROD_STAGE_TERTIARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
486 ui->tert_tempEdit->setButtonSymbols((product->stage == PROD_STAGE_TERTIARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
487 ui->tert_sgEdit->setReadOnly(product->stage != PROD_STAGE_TERTIARY);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
488 ui->tert_sgEdit->setButtonSymbols((product->stage == PROD_STAGE_TERTIARY) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
489 if (product->stage == PROD_STAGE_TERTIARY)
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
490 ui->tert_sgButton->show();
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
491 else
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
492 ui->tert_sgButton->hide();
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
493
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
494 /* Tab 11, packaging */
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
495 ui->tabWidget->setTabEnabled(10, stage > PROD_STAGE_PLAN);
224
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
496 bool pack = ((stage > PROD_STAGE_PLAN) && (stage <= PROD_STAGE_PACKAGE)) ? true:false;
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
497 ui->pack_volumeEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
498 ui->pack_volumeEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
499 ui->pack_phEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
500 ui->pack_phEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
501 ui->pack_addvolEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
502 ui->pack_addvolEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
503 ui->pack_addabvEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
504 ui->pack_addabvEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
505 ui->pack_notesEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
506 ui->bottle_volumeEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
507 ui->bottle_volumeEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
508 ui->bottle_carbEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
509 ui->bottle_carbEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
510 ui->bottle_sugarEdit->setDisabled(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
511 ui->bottle_sug_waterEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
512 ui->bottle_sug_waterEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
513 ui->bottle_tempEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
514 ui->bottle_tempEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
515 ui->keg_volumeEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
516 ui->keg_volumeEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
517 ui->keg_carbEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
518 ui->keg_carbEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
519 ui->keg_sugarEdit->setDisabled(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
520 ui->keg_sug_waterEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
521 ui->keg_sug_waterEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
522 ui->keg_tempEdit->setReadOnly(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
523 ui->keg_tempEdit->setButtonSymbols((pack) ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
524 ui->keg_forcedEdit->setDisabled(! pack);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
525 ui->pack_dateEdit->setReadOnly(true);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
526 ui->pack_dateEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
527 ui->pack_dateButton->hide();
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
528 ui->pack_ackButton->hide();
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
529 if (((stage == PROD_STAGE_TERTIARY) || (stage == PROD_STAGE_PACKAGE)) &&
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
530 (product->package_volume > 1) && ((product->bottle_amount + product->keg_amount) > 1)) {
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
531 ui->pack_dateEdit->setReadOnly(false);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
532 ui->pack_dateEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
533 ui->pack_dateEdit->setMinimumDate(product->secondary_end_date.addDays(-1)); // Allow same date as secondary end.
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
534 ui->pack_dateEdit->setMaximumDate(QDate::currentDate());
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
535 ui->pack_dateButton->show();
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
536 if (stage == PROD_STAGE_PACKAGE)
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
537 ui->pack_ackButton->show();
d369948a3eb5 Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
538 }
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
539
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
540
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
541 /* Tab 12, tasting */
190
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
542 ui->tabWidget->setTabEnabled(11, stage > PROD_STAGE_PACKAGE);
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
543
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
544 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
545
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546

mercurial