src/EditRecipeTab1.cpp

Thu, 28 Apr 2022 13:08:20 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 28 Apr 2022 13:08:20 +0200
changeset 171
6cd2d808d863
parent 154
1af9f7b7f317
child 301
fe6346211b5b
permissions
-rw-r--r--

Implemented recipe lock setting.

127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditRecipe.cpp is part of bmsapp.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Tab 1, generic settings.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 void EditRecipe::name_changed(QString name)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 recipe->name = name;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 void EditRecipe::notes_changed()
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 /* The text cannot be passed in a simple way :) */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 recipe->notes = ui->notesEdit->toPlainText();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 /*
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 * New beerstyle is selected.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 QSqlQuery query;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 query.prepare("SELECT * FROM profile_styles ORDER BY style_guide,style_letter,name");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 query.exec();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 query.first();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 query.next();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 // Set relevant fields and update ranges.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 recipe->st_name = query.value(1).toString();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 recipe->st_category = query.value(2).toString();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 recipe->st_category_number = query.value(3).toInt();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 recipe->st_letter = query.value(4).toString();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 recipe->st_guide = query.value(5).toString();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 recipe->st_type = query.value(6).toInt();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 recipe->st_og_min = query.value(7).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 recipe->st_og_max = query.value(8).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 recipe->st_fg_min = query.value(9).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 recipe->st_fg_max = query.value(10).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 recipe->st_ibu_min = query.value(11).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 recipe->st_ibu_max = query.value(12).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 recipe->st_color_min = query.value(13).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 recipe->st_color_max = query.value(14).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 recipe->st_carb_min = query.value(15).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 recipe->st_carb_max = query.value(16).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 recipe->st_abv_min = query.value(17).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 recipe->st_abv_max = query.value(18).toDouble();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 ui->st_nameEdit->setText(recipe->st_name);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 ui->st_groupEdit->setText(recipe->st_letter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 ui->st_guideEdit->setText(recipe->st_guide);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 ui->st_catEdit->setText(recipe->st_category);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ui->est_ogShow->setRange(query.value(7).toDouble(), query.value(8).toDouble());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 ui->est_fgShow->setRange(query.value(9).toDouble(), query.value(10).toDouble());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 calcFermentables();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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

mercurial