Mon, 06 Jun 2022 19:35:39 +0200
Updated the changes from the product misc editor to the recipe misc editor.
127 | 1 | /** |
2 | * EditRecipe.cpp is part of bmsapp. | |
3 | * | |
4 | * Tab 1, generic settings. | |
5 | * | |
6 | * bmsapp is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * bmsapp is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | ||
21 | ||
22 | void EditRecipe::name_changed(QString name) | |
23 | { | |
24 | recipe->name = name; | |
25 | is_changed(); | |
26 | } | |
27 | ||
28 | ||
29 | void EditRecipe::notes_changed() | |
30 | { | |
31 | /* The text cannot be passed in a simple way :) */ | |
32 | recipe->notes = ui->notesEdit->toPlainText(); | |
33 | is_changed(); | |
34 | } | |
35 | ||
36 | ||
37 | /* | |
38 | * New beerstyle is selected. | |
39 | */ | |
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
40 | void EditRecipe::style_changed(int val) |
127 | 41 | { |
42 | QSqlQuery query; | |
43 | ||
44 | query.prepare("SELECT * FROM profile_styles ORDER BY style_guide,style_letter,name"); | |
45 | query.exec(); | |
46 | query.first(); | |
47 | // Skip to the record index. | |
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
48 | for (int i = 0; i < (val - 1); i++) { |
127 | 49 | query.next(); |
50 | } | |
51 | // Set relevant fields and update ranges. | |
52 | recipe->st_name = query.value(1).toString(); | |
53 | recipe->st_category = query.value(2).toString(); | |
54 | recipe->st_category_number = query.value(3).toInt(); | |
55 | recipe->st_letter = query.value(4).toString(); | |
56 | recipe->st_guide = query.value(5).toString(); | |
57 | recipe->st_type = query.value(6).toInt(); | |
58 | recipe->st_og_min = query.value(7).toDouble(); | |
59 | recipe->st_og_max = query.value(8).toDouble(); | |
60 | recipe->st_fg_min = query.value(9).toDouble(); | |
61 | recipe->st_fg_max = query.value(10).toDouble(); | |
62 | recipe->st_ibu_min = query.value(11).toDouble(); | |
63 | recipe->st_ibu_max = query.value(12).toDouble(); | |
64 | recipe->st_color_min = query.value(13).toDouble(); | |
65 | recipe->st_color_max = query.value(14).toDouble(); | |
66 | recipe->st_carb_min = query.value(15).toDouble(); | |
67 | recipe->st_carb_max = query.value(16).toDouble(); | |
68 | recipe->st_abv_min = query.value(17).toDouble(); | |
69 | recipe->st_abv_max = query.value(18).toDouble(); | |
70 | ||
71 | ui->st_nameEdit->setText(recipe->st_name); | |
72 | ui->st_groupEdit->setText(recipe->st_letter); | |
73 | ui->st_guideEdit->setText(recipe->st_guide); | |
74 | ui->st_catEdit->setText(recipe->st_category); | |
75 | ui->st_catnrEdit->setText(QString("%1").arg(recipe->st_category_number)); | |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
76 | ui->st_typeEdit->setText(style_types[recipe->st_type]); |
127 | 77 | |
78 | ui->est_ogShow->setRange(query.value(7).toDouble(), query.value(8).toDouble()); | |
79 | ui->est_fgShow->setRange(query.value(9).toDouble(), query.value(10).toDouble()); | |
80 | ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); | |
81 | ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); | |
82 | ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); | |
83 | ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); | |
84 | ||
85 | is_changed(); | |
86 | } | |
87 | ||
88 | ||
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
89 | void EditRecipe::colormethod_changed(int val) |
127 | 90 | { |
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
91 | recipe->color_method = val; |
127 | 92 | calcFermentables(); |
93 | is_changed(); | |
94 | } | |
95 | ||
96 | ||
150
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
97 | void EditRecipe::ibumethod_changed(int val) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
98 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
99 | recipe->ibu_method = val; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
100 | calcIBUs(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
101 | is_changed(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
102 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
103 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
104 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
105 | void EditRecipe::est_og_changed(double val) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
106 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
107 | recipe->est_og = val; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
108 | calcFermentablesFromOG(val);// Adjust fermentables amounts |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
109 | calcFermentables(); // Update the recipe details |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
110 | calcIBUs(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
111 | calcMash(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
112 | is_changed(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
113 | emit refreshAll(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
114 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
115 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
116 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
117 | void EditRecipe::efficiency_changed(double val) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
118 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
119 | double estog = recipe->est_og; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
120 | recipe->efficiency = val; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
121 | calcFermentablesFromOG(estog); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
122 | calcFermentables(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
123 | calcIBUs(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
124 | is_changed(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
125 | emit refreshAll(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
126 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
127 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
128 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
129 | void EditRecipe::boil_time_changed(int val) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
130 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
131 | qDebug() << "boil_time_changed" << val; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
132 | double new_evap = (0.1 * recipe->batch_size) * val / 60.0; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
133 | recipe->boil_size = recipe->batch_size + new_evap; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
134 | recipe->boil_time = val; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
135 | ui->boil_sizeEdit->setValue(recipe->boil_size); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
136 | calcFermentables(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
137 | calcIBUs(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
138 | is_changed(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
139 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
140 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
141 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
142 | void EditRecipe::batch_size_changed(double val) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
143 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
144 | qDebug() << "batch_size_changed" << val << "old" << recipe->batch_size; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
145 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
146 | double evap = (0.1 * val) * recipe->boil_time / 60.0; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
147 | recipe->boil_size = val + evap; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
148 | double factor = val / recipe->batch_size; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
149 | ui->boil_sizeEdit->setValue(recipe->boil_size); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
150 | recipe->sparge_volume *= factor; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
151 | ui->sp_volEdit->setValue(recipe->sparge_volume); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
152 | recipe->batch_size = val; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
153 | calcFermentablesFromOG(recipe->est_og); // Keep the OG |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
154 | adjustWaters(factor); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
155 | calcFermentables(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
156 | adjustHops(factor); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
157 | adjustMiscs(factor); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
158 | adjustYeasts(factor); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
159 | calcIBUs(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
160 | calcWater(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
161 | //calcSparge(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
162 | calcMash(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
163 | is_changed(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
164 | emit refreshAll(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
165 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
166 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
167 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
168 | void EditRecipe::brew_type_changed(int val) |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
169 | { |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
170 | recipe->type; |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
171 | is_changed(); |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
172 | } |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
173 | |
fd568cc1dd0e
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents:
127
diff
changeset
|
174 | |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
175 | void EditRecipe::locked_changed(bool val) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
176 | { |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
177 | qDebug() << "locked_changed" << val; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
178 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
179 | recipe->locked = val; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
180 | setLocked(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
181 | is_changed(); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
182 | } |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
183 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
184 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
185 | void EditRecipe::setLocked(bool val) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
186 | { |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
187 | /* Tab 1, generic */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
188 | ui->typeEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
189 | ui->color_methodEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
190 | ui->ibu_methodEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
191 | ui->beerstyleEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
192 | ui->nameEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
193 | ui->notesEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
194 | ui->batch_sizeEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
195 | ui->batch_sizeEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
196 | ui->boil_sizeEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
197 | ui->boil_sizeEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
198 | ui->boil_timeEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
199 | ui->boil_timeEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
200 | ui->efficiencyEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
201 | ui->efficiencyEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
202 | ui->est_ogEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
203 | ui->est_ogEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
204 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
205 | /* Tab 2, fermentables */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
206 | ui->est_og2Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
207 | ui->est_og2Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
208 | ui->addFermentable->setEnabled(! val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
209 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
210 | /* Tab 3, hops */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
211 | ui->addHop->setEnabled(! val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
212 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
213 | /* Tab 4, miscs */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
214 | ui->addMisc->setEnabled(! val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
215 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
216 | /* Tab 5, yeasts */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
217 | ui->addYeast->setEnabled(! val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
218 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
219 | /* Tab 6, mash */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
220 | ui->addMash->setEnabled(! val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
221 | ui->mash_nameEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
222 | ui->mash_pickEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
223 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
224 | /* Tab 7, water */ |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
225 | ui->sp_sourceEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
226 | ui->wt_sourceEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
227 | ui->w1_nameEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
228 | ui->w2_nameEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
229 | ui->mw_acidPick->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
230 | ui->sp_acidtypeEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
231 | ui->w2_volEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
232 | ui->w2_volEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
233 | ui->sp_phEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
234 | ui->sp_phEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
235 | ui->sp_tempEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
236 | ui->sp_tempEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
237 | ui->sp_volEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
238 | ui->sp_volEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
239 | ui->bs_cacl2Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
240 | ui->bs_cacl2Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
241 | ui->bs_caso4Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
242 | ui->bs_caso4Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
243 | ui->bs_mgso4Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
244 | ui->bs_mgso4Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
245 | ui->bs_naclEdit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
246 | ui->bs_naclEdit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
247 | ui->bs_mgcl2Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
248 | ui->bs_mgcl2Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
249 | ui->bs_nahco3Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
250 | ui->bs_nahco3Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
251 | ui->bs_caco3Edit->setReadOnly(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
252 | ui->bs_caco3Edit->setButtonSymbols(val ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
253 | if (val) { |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
254 | ui->mw_phEdit->setReadOnly(true); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
255 | ui->mw_phEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
256 | ui->mw_acidvolEdit->setReadOnly(true); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
257 | ui->mw_acidvolEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
258 | } else { |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
259 | ui->mw_phEdit->setReadOnly(! recipe->calc_acid); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
260 | ui->mw_phEdit->setButtonSymbols(recipe->calc_acid ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
261 | ui->mw_acidvolEdit->setReadOnly(recipe->calc_acid); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
262 | ui->mw_acidvolEdit->setButtonSymbols(recipe->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
263 | } |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
264 | ui->mw_autoEdit->setDisabled(val); |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
265 | } |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
266 | |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
267 |