src/EditRecipeTab1.cpp

Wed, 20 Apr 2022 22:48:20 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 20 Apr 2022 22:48:20 +0200
changeset 150
fd568cc1dd0e
parent 127
475c8b8df67f
child 154
1af9f7b7f317
permissions
-rw-r--r--

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.

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));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 ui->st_typeEdit->setText(s_types[recipe->st_type]);
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

mercurial