src/EditRecipe.cpp

Sun, 17 Jul 2022 22:18:48 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 17 Jul 2022 22:18:48 +0200
changeset 358
d89bc21e2f07
parent 336
e97f9e87d94b
child 359
dfbb012c631c
permissions
-rw-r--r--

Adapted to new Utils functions. Used named versions for MySQL water read.

92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditRecipe.cpp is part of bmsapp.
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
108
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
17 #include "MainWindow.h"
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "EditRecipe.h"
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
19 #include "PrinterDialog.h"
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "../ui/ui_EditRecipe.h"
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
21 #include "Utils.h"
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
22 #include "global.h"
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
23 #include "config.h"
249
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
24 #include "database/db_recipe.h"
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 249
diff changeset
25 #include "database/db_product.h"
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
110
224be4d9f8eb Fermentables are loaded in the main recipe record in a QList. The refresh table function does the sorting, on added moment (mash first), amount and finally color of the malt. Removed the old hidden table columns. Do all manipulation on the recipe record with QList arrays. The ferment_amount_changed() slot is complete. The whole recipe editor is going in the right direction.
Michiel Broek <mbroek@mbse.eu>
parents: 109
diff changeset
27
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 EditRecipe::EditRecipe(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditRecipe)
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 {
152
58e4ce7dd217 Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
30 QSqlQuery query, wquery, yquery;
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
32 qInfo() << "EditRecipe record:" << id;
108
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
33 recipe = new Recipe;
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 ui->setupUi(this);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
35 recipe->fermentables_row = recipe->hops_row = recipe->miscs_row = recipe->yeasts_row = recipe->mashs_row = -1;
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
36 recipe->fermentables_use100 = false;
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 this->recno = id;
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 WindowTitle();
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 ui->typeEdit->addItem(tr("Extract"));
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 ui->typeEdit->addItem(tr("Partial Mash"));
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 ui->typeEdit->addItem(tr("All Grain"));
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
45 ui->color_methodEdit->addItem("Morey");
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
46 ui->color_methodEdit->addItem("Mosher");
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
47 ui->color_methodEdit->addItem("Daniels");
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
48 ui->color_methodEdit->addItem("Halberstadt");
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
49 ui->color_methodEdit->addItem("Naudts");
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
50
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
51 for (int i = 0; i < 3; i++)
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
52 ui->ibu_methodEdit->addItem(g_ibu_method[i]);
100
d11a3e713e3b Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 99
diff changeset
53
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
54 for (int i = 0; i < my_acids.size(); i++) {
135
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
55 ui->mw_acidPick->addItem(my_acids.at(i).name_en);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
56 ui->sp_acidtypeEdit->addItem(my_acids.at(i).name_en);
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
57 }
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
58
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
59 ui->sp_sourceEdit->addItem(tr("Source 1"));
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
60 ui->sp_sourceEdit->addItem(tr("Source 2"));
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
61 ui->sp_sourceEdit->addItem(tr("Mixed"));
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
62
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
63 query.prepare("SELECT name FROM inventory_waters ORDER BY record");
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
64 query.exec();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
65 query.first();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
66 ui->w1_nameEdit->addItem("");
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
67 ui->w2_nameEdit->addItem("");
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
68 for (int i = 0; i < query.size(); i++) {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
69 ui->w1_nameEdit->addItem(query.value(0).toString());
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
70 ui->w2_nameEdit->addItem(query.value(0).toString());
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
71 query.next();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
72 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
73
138
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
74 query.prepare("SELECT name FROM profile_water ORDER BY name");
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
75 query.exec();
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
76 ui->wt_sourceEdit->addItem("");
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
77 while (query.next()) {
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
78 ui->wt_sourceEdit->addItem(query.value(0).toString());
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
79 }
1189d072f346 Add select target water profile. The mash part of the water tab is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
80
144
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
81 query.prepare("SELECT name FROM profile_mash ORDER BY name");
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
82 query.exec();
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
83 ui->mash_pickEdit->addItem("");
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
84 while (query.next()) {
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
85 ui->mash_pickEdit->addItem(query.value(0).toString());
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
86 }
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
87
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
88 ui->beerstyleEdit->addItem(""); // First add a dummy
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
89 query.prepare("SELECT style_guide,style_letter,name FROM profile_styles ORDER BY style_guide,style_letter,name");
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
90 query.exec();
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
91 query.first();
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
92 for (int i = 0; i < query.size(); i++) {
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
93 ui->beerstyleEdit->addItem(query.value(0).toString()+" "+query.value(1).toString()+" "+query.value(2).toString());
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
94 query.next();
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
95 }
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
96
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 if (id >= 0) {
249
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
98 if (! DB_recipe::load(recipe, this, id))
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
99 return;
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 } else {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 /* Set some defaults */
249
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
102 recipe->record = -1;
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
103 recipe->locked = false;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
104 recipe->st_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
105 recipe->st_letter = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
106 recipe->st_guide = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
107 recipe->st_category = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
108 recipe->st_category_number = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
109 recipe->st_type = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
110 recipe->st_og_min = 1.025; recipe->st_og_max = 1.100;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
111 recipe->st_fg_min = 1.000; recipe->st_fg_max = 1.020;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
112 recipe->st_ibu_min = 5; recipe->st_ibu_max = 200;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
113 recipe->st_color_min = 3; recipe->st_color_max = 100;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
114 recipe->st_carb_min = 1.0; recipe->st_carb_max = 4.5;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
115 recipe->st_abv_min = 1; recipe->st_abv_max = 15;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
116 recipe->name = "";
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
117 recipe->notes = "";
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
118 recipe->efficiency = 75;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
119 recipe->batch_size = 20;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
120 recipe->boil_time = 60;
151
b5b2483f3a3f New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
121 recipe->boil_size = recipe->batch_size + (round(recipe->batch_size * recipe->boil_time / 60.0) / 10.0);
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
122 recipe->type = 2;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
123 recipe->est_og = recipe->est_fg = recipe->est_color = recipe->est_ibu = recipe->est_abv = 0;
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
124 recipe->sparge_temp = 80;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
125 recipe->sparge_ph = 5.4;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
126 recipe->sparge_volume = 8;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
127 recipe->sparge_source = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
128 recipe->sparge_acid_type = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
129 recipe->sparge_acid_perc = 80;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
130 recipe->sparge_acid_amount = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
131 recipe->mash_ph = 5.4;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
132 recipe->mash_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
133 recipe->calc_acid = true;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
134 recipe->w1_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
135 recipe->w1_amount = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
136 recipe->w1_calcium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
137 recipe->w1_sulfate = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
138 recipe->w1_chloride = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
139 recipe->w1_sodium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
140 recipe->w1_magnesium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
141 recipe->w1_total_alkalinity = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
142 recipe->w1_ph = 7;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
143 recipe->w1_cost = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
144 recipe->w2_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
145 recipe->w2_amount = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
146 recipe->w2_calcium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
147 recipe->w2_sulfate = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
148 recipe->w2_chloride = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
149 recipe->w2_sodium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
150 recipe->w2_magnesium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
151 recipe->w2_total_alkalinity = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
152 recipe->w2_ph = 7;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
153 recipe->w2_cost = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
154 recipe->wg_amount = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
155 recipe->wg_calcium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
156 recipe->wg_sulfate = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
157 recipe->wg_chloride = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
158 recipe->wg_sodium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
159 recipe->wg_magnesium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
160 recipe->wg_total_alkalinity = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
161 recipe->wg_ph = 7;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
162 recipe->wb_calcium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
163 recipe->wb_sulfate = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
164 recipe->wb_chloride = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
165 recipe->wb_sodium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
166 recipe->wb_magnesium = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
167 recipe->wb_total_alkalinity = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
168 recipe->wb_ph = 7;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
169 recipe->wa_acid_name = 0;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
170 recipe->wa_acid_perc = 80;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
171 recipe->wa_base_name = 0;
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
174 // Tab generic.
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
175 ui->lockedEdit->setChecked(recipe->locked);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
176 ui->st_nameEdit->setText(recipe->st_name);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
177 ui->st_groupEdit->setText(recipe->st_letter);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
178 ui->st_guideEdit->setText(recipe->st_guide);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
179 ui->st_catEdit->setText(recipe->st_category);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
180 ui->st_catnrEdit->setText(QString("%1").arg(recipe->st_category_number));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
181 ui->st_typeEdit->setText(QCoreApplication::translate("BeerType", g_style_types[recipe->st_type]));
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
182 ui->nameEdit->setText(recipe->name);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
183 ui->notesEdit->setPlainText(recipe->notes);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
184 ui->typeEdit->setCurrentIndex(recipe->type);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
185 ui->batch_sizeEdit->setValue(recipe->batch_size);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
186 ui->boil_sizeEdit->setValue(recipe->boil_size);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
187 ui->boil_timeEdit->setValue(recipe->boil_time);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
188 ui->efficiencyEdit->setValue(recipe->efficiency);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
189 ui->est_ogEdit->setValue(recipe->est_og);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
190 ui->est_ogShow->setRange(recipe->st_og_min, recipe->st_og_max);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
191 ui->est_ogShow->setPrecision(3);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
192 ui->est_ogShow->setMarkerTextIsValue(true);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
193 ui->est_ogShow->setValue(recipe->est_og);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
194 ui->est_fgEdit->setValue(recipe->est_fg);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
195 ui->est_fgShow->setRange(recipe->st_fg_min, recipe->st_fg_max);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
196 ui->est_fgShow->setPrecision(3);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
197 ui->est_fgShow->setMarkerTextIsValue(true);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
198 ui->est_fgShow->setValue(recipe->est_fg);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
199 ui->est_abvEdit->setValue(recipe->est_abv);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
200 ui->est_abvShow->setRange(recipe->st_abv_min, recipe->st_abv_max);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
201 ui->est_abvShow->setPrecision(1);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
202 ui->est_abvShow->setMarkerTextIsValue(true);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
203 ui->est_abvShow->setValue(recipe->est_abv);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
204 ui->est_colorEdit->setValue(recipe->est_color);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
205 ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(recipe->est_color));
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
206 ui->est_colorShow->setPrecision(0);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
207 ui->est_colorShow->setMarkerTextIsValue(true);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
208 ui->est_colorShow->setRange(recipe->st_color_min, recipe->st_color_max);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
209 ui->est_colorShow->setValue(recipe->est_color);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
210 ui->color_methodEdit->setCurrentIndex(recipe->color_method);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
211 ui->est_ibuEdit->setValue(recipe->est_ibu);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
212 ui->est_ibuShow->setPrecision(0);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
213 ui->est_ibuShow->setMarkerTextIsValue(true);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
214 ui->est_ibuShow->setRange(recipe->st_ibu_min, recipe->st_ibu_max);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
215 ui->est_ibuShow->setValue(recipe->est_ibu);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
216 ui->ibu_methodEdit->setCurrentIndex(recipe->ibu_method);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
217 ui->est_carbEdit->setValue(recipe->est_carb);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
218 ui->est_carbShow->setPrecision(1);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
219 ui->est_carbShow->setMarkerTextIsValue(true);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
220 ui->est_carbShow->setRange(recipe->st_carb_min, recipe->st_carb_max);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
221 ui->est_carbShow->setValue(recipe->est_carb);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
222
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
223 // Tab fermentables.
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
224 ui->est_og2Edit->setValue(recipe->est_og);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
225 ui->est_color2Edit->setValue(recipe->est_color);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
226 ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(recipe->est_color));
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
227
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
228 // Tab hops.
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
229 ui->est_ibu2Edit->setValue(recipe->est_ibu);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
230
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
231 // Tab yeasts.
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
232 ui->est_og3Edit->setValue(recipe->est_og);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
233 ui->est_fg3Edit->setValue(recipe->est_fg);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
234 ui->est_abv2Edit->setValue(recipe->est_abv);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
235
144
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
236 // Tab mashs.
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
237 ui->mash_nameEdit->setText(recipe->mash_name);
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
238
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
239 // Tab waters.
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
240 qDebug() << "water 1" << recipe->w1_name << "default" << my_default_water;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
241 if (recipe->w1_ph > 4.0) {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
242 /*
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
243 * Water data seems present, use that and set the name between []
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
244 */
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
245 ui->w1_nameEdit->setPlaceholderText(QString("["+recipe->w1_name+"]"));
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
246 } else {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
247 bool found = false;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
248 if (recipe->w1_name != "") {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
249 /*
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
250 * We have a name, but do we know it?
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
251 */
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
252 query.prepare("SELECT * FROM inventory_waters WHERE name=:water");
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
253 query.bindValue(":water", recipe->w1_name);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
254 query.exec();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
255 found = query.first();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
256 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
257 if (!found) {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
258 /*
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
259 * Try to load default water
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
260 */
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
261 query.prepare("SELECT * FROM inventory_waters WHERE record=:record");
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
262 query.bindValue(":record", my_default_water);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
263 query.exec();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
264 found = query.first();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
265 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
266 if (found) {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
267 recipe->w1_calcium = query.value(3).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
268 recipe->w1_magnesium = query.value(8).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
269 recipe->w1_total_alkalinity = query.value(11).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
270 recipe->w1_sodium = query.value(7).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
271 recipe->w1_chloride = query.value(6).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
272 recipe->w1_sulfate = query.value(5).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
273 recipe->w1_ph = query.value(9).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
274 ui->w1_nameEdit->setCurrentIndex(query.value(0).toInt());
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
275 } else {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
276 recipe->w1_calcium = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
277 recipe->w1_magnesium = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
278 recipe->w1_total_alkalinity = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
279 recipe->w1_sodium = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
280 recipe->w1_chloride = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
281 recipe->w1_sulfate = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
282 recipe->w1_ph = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
283 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
284 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
285 ui->w1_volEdit->setValue(recipe->w1_amount);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
286 ui->w1_caEdit->setValue(recipe->w1_calcium);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
287 ui->w1_mgEdit->setValue(recipe->w1_magnesium);
358
d89bc21e2f07 Adapted to new Utils functions. Used named versions for MySQL water read.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
288 ui->w1_hco3Edit->setValue(Utils::Bicarbonate(recipe->w1_total_alkalinity, recipe->w1_ph));
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
289 ui->w1_caco3Edit->setValue(recipe->w1_total_alkalinity);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
290 ui->w1_naEdit->setValue(recipe->w1_sodium);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
291 ui->w1_clEdit->setValue(recipe->w1_chloride);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
292 ui->w1_so4Edit->setValue(recipe->w1_sulfate);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
293 ui->w1_phEdit->setValue(recipe->w1_ph);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
294
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
295 qDebug() << "water 2" << recipe->w2_name;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
296 if (recipe->w2_ph > 4.0) {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
297 ui->w2_nameEdit->setPlaceholderText(QString("["+recipe->w2_name+"]"));
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
298 } else if (recipe->w2_name != "") {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
299 query.prepare("SELECT * FROM inventory_waters WHERE name=:water");
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
300 query.bindValue(":water", recipe->w2_name);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
301 query.exec();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
302 if (query.first()) {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
303 recipe->w2_calcium = query.value(3).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
304 recipe->w2_magnesium = query.value(8).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
305 recipe->w2_total_alkalinity = query.value(11).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
306 recipe->w2_sodium = query.value(7).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
307 recipe->w2_chloride = query.value(6).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
308 recipe->w2_sulfate = query.value(5).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
309 recipe->w2_ph = query.value(9).toDouble();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
310 ui->w2_nameEdit->setCurrentIndex(query.value(0).toInt());
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
311 } else {
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
312 recipe->w2_calcium = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
313 recipe->w2_magnesium = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
314 recipe->w2_total_alkalinity = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
315 recipe->w2_sodium = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
316 recipe->w2_chloride = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
317 recipe->w2_sulfate = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
318 recipe->w2_ph = 0;
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
319 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
320 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
321 ui->w2_volEdit->setValue(recipe->w2_amount);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
322 ui->w2_caEdit->setValue(recipe->w2_calcium);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
323 ui->w2_mgEdit->setValue(recipe->w2_magnesium);
358
d89bc21e2f07 Adapted to new Utils functions. Used named versions for MySQL water read.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
324 ui->w2_hco3Edit->setValue(Utils::Bicarbonate(recipe->w2_total_alkalinity, recipe->w2_ph));
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
325 ui->w2_caco3Edit->setValue(recipe->w2_total_alkalinity);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
326 ui->w2_naEdit->setValue(recipe->w2_sodium);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
327 ui->w2_clEdit->setValue(recipe->w2_chloride);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
328 ui->w2_so4Edit->setValue(recipe->w2_sulfate);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
329 ui->w2_phEdit->setValue(recipe->w2_ph);
135
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
330 ui->mw_autoEdit->setChecked(recipe->calc_acid);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
331 ui->mw_phEdit->setReadOnly(! recipe->calc_acid);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
332 ui->mw_phEdit->setButtonSymbols(recipe->calc_acid ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
333 ui->mw_acidvolEdit->setReadOnly(recipe->calc_acid);
e68b27ad8a40 Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
334 ui->mw_acidvolEdit->setButtonSymbols(recipe->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
335
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
336 ui->sp_volEdit->setValue(recipe->sparge_volume);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
337 ui->sp_tempEdit->setValue(recipe->sparge_temp);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
338 ui->sp_phEdit->setValue(recipe->sparge_ph);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
339 ui->sp_sourceEdit->setCurrentIndex(recipe->sparge_source);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
340 ui->sp_acidtypeEdit->setCurrentIndex(recipe->sparge_acid_type);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
341 ui->sp_acidpercEdit->setValue(recipe->sparge_acid_perc);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
342 ui->sp_acidvolEdit->setValue(recipe->sparge_acid_amount);
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
343
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
344 // All signals from tab "Generic"
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditRecipe::is_changed);
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
346 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditRecipe::name_changed);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
347 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(notes_changed()));
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: 149
diff changeset
348 connect(ui->typeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::brew_type_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: 149
diff changeset
349 connect(ui->batch_sizeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::batch_size_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: 149
diff changeset
350 connect(ui->boil_timeEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditRecipe::boil_time_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: 149
diff changeset
351 connect(ui->efficiencyEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::efficiency_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: 149
diff changeset
352 connect(ui->beerstyleEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::style_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: 149
diff changeset
353 connect(ui->est_ogEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::est_og_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: 149
diff changeset
354 connect(ui->color_methodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::colormethod_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: 149
diff changeset
355 connect(ui->ibu_methodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::ibumethod_changed);
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 169
diff changeset
356 connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditRecipe::locked_changed);
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
357
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
358 // All signals from tab "Fermentables"
106
2924fb71dce9 Global table edit lock. The 100% mark is now display only, editing goes into the popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 105
diff changeset
359 ui->fermentablesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
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: 149
diff changeset
360 connect(ui->est_og2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::est_og_changed);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
361 connect(ui->perc_mashShow, &QProgressBar::valueChanged, this, &EditRecipe::ferment_perc_mash_valueChanged);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
362 connect(ui->perc_sugarsShow, &QProgressBar::valueChanged, this, &EditRecipe::ferment_perc_sugars_valueChanged);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
363 connect(ui->perc_caraShow, &QProgressBar::valueChanged, this, &EditRecipe::ferment_perc_cara_valueChanged);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
364 connect(ui->lintnerShow, &QProgressBar::valueChanged, this, &EditRecipe::ferment_lintner_valueChanged);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
365 connect(ui->addFermentable, SIGNAL(clicked()), this, SLOT(addFermentRow_clicked()));
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
366
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
367 // All signals from tab "Hops"
129
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
368 ui->hopsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
369 connect(ui->hop_tasteShow, &QProgressBar::valueChanged, this, &EditRecipe::hop_Flavour_valueChanged);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
370 connect(ui->hop_aromaShow, &QProgressBar::valueChanged, this, &EditRecipe::hop_Aroma_valueChanged);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
371 connect(ui->addHop, SIGNAL(clicked()), this, SLOT(addHopRow_clicked()));
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
372
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
373 // All signals from tab "Miscs"
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
374 ui->miscsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
375 connect(ui->addMisc, SIGNAL(clicked()), this, SLOT(addMiscRow_clicked()));
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
376
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
377 // All signals from tab "Yeasts"
141
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
378 ui->yeastsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
379 connect(ui->addYeast, SIGNAL(clicked()), this, SLOT(addYeastRow_clicked()));
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
380
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
381 // All signals from tab "Mash"
144
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
382 ui->mashsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
145
fd4f0de86fd9 Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
383 connect(ui->addMash, SIGNAL(clicked()), this, SLOT(addMashRow_clicked()));
147
af1386a6ece7 Added mash table replace
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
384 connect(ui->mash_pickEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::mash_select_changed);
163
6cccd340ea8c Version 0.1.3. Mash name can be edited manual. Added a remark about EBC calculations. Updated dustch translation. Still items in recipe tables are not shown translated, another qt mistery. Extended some number input ranges for large batches.
Michiel Broek <mbroek@mbse.eu>
parents: 162
diff changeset
385 connect(ui->mash_nameEdit, &QLineEdit::textChanged, this, &EditRecipe::mash_name_changed);
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
386
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
387 // All signals from tab "Water"
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
388 connect(ui->bs_cacl2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_cacl2_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
389 connect(ui->bs_caso4Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_caso4_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
390 connect(ui->bs_mgso4Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_mgso4_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
391 connect(ui->bs_naclEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_nacl_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
392 connect(ui->bs_mgcl2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_mgcl2_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
393 connect(ui->bs_nahco3Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_nahco3_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
394 connect(ui->bs_caco3Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::wb_caco3_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
395 connect(ui->mw_autoEdit, &QCheckBox::stateChanged, this, &EditRecipe::mw_calc_acid_clicked);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
396 connect(ui->mw_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::mw_ph_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
397 connect(ui->mw_acidvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::mw_acid_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
398 connect(ui->mw_acidPick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::mw_type_changed);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
399 connect(ui->wt_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::wt_target_changed);
149
d73719fa2ebb Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
400 connect(ui->w1_nameEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::w1_name_changed);
d73719fa2ebb Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
401 connect(ui->w2_nameEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::w2_name_changed);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
402 connect(ui->w2_volEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::w2_volume_changed);
162
19156b8b339f Added calcSparge.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
403 connect(ui->sp_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::sp_source_changed);
19156b8b339f Added calcSparge.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
404 connect(ui->sp_acidtypeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::sp_type_changed);
19156b8b339f Added calcSparge.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
405 connect(ui->sp_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::sp_ph_changed);
100
d11a3e713e3b Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 99
diff changeset
406
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 169
diff changeset
407 setLocked(recipe->locked);
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 169
diff changeset
408
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 ui->saveButton->setEnabled(false);
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 169
diff changeset
410 ui->deleteButton->setEnabled((id >= 0 && ! recipe->locked) ? true:false);
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
411
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
412 emit refreshAll();
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
415
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 EditRecipe::~EditRecipe()
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 {
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
418 qDebug() << "EditRecipe done start";
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419 delete ui;
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 emit entry_changed();
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
421 qDebug() << "EditRecipe done final";
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
425 void EditRecipe::refreshAll()
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
426 {
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
427 refreshFermentables();
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
428 calcFermentables(); /* Must be before Hops */
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
429 refreshHops();
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
430 calcIBUs();
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
431 refreshMiscs();
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
432 refreshYeasts();
142
1caa15a0eefc Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
433 calcYeast();
148
ba25a566b100 Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
434 calcMash();
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
435 refreshMashs();
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
436 refreshWaters();
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
437 calcWater();
101
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
438 }
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
439
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
440
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 /*
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 * Window header, mark any change with '**'
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 */
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 void EditRecipe::WindowTitle()
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 QString txt;
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 if (this->recno < 0) {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449 txt = QString(tr("BMSapp - Add new recipe"));
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450 } else {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
451 txt = QString(tr("BMSapp - Edit recipe %1").arg(this->recno));
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
452 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454 if (this->textIsChanged) {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
455 txt.append((QString(" **")));
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 setWindowTitle(txt);
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 void EditRecipe::on_saveButton_clicked()
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463 QSqlQuery query;
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 /* If there are errors in the form, show a message and do "return;" */
95
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
466 if (ui->nameEdit->text().length() < 2) {
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
467 QMessageBox::warning(this, tr("Edit Recipe"), tr("Name empty or too short."));
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
468 return;
ef6048186cb3 Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
469 }
114
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
470 if (ui->st_nameEdit->text().length() < 2) {
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
471 QMessageBox::warning(this, tr("Edit Recipe"), tr("No beerstyle selected."));
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
472 return;
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
473 }
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
474
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475 if (this->textIsChanged) {
249
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
476 recipe->record = this->recno;
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
477 if (DB_recipe::save(recipe, this)) {
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
478 /*
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
479 * If this was a new record, update the global recno.
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
480 */
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
481 this->recno = recipe->record;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
482 }
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
483 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
484
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
485 ui->saveButton->setEnabled(false);
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
486 this->textIsChanged = false;
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
487 WindowTitle();
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
488 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
489
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
490
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
491 #include "EditRecipeTab1.cpp"
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
492 #include "EditRecipeTab2.cpp"
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
493 #include "EditRecipeTab3.cpp"
128
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
494 #include "EditRecipeTab4.cpp"
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
495 #include "EditRecipeTab5.cpp"
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
496 #include "EditRecipeTab6.cpp"
129
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
497 #include "EditRecipeTab7.cpp"
156
74c9002580d1 Delete recipe needs a confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
498 #include "EditRecipeExport.cpp"
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
499
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
500
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
501 void EditRecipe::on_deleteButton_clicked()
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 {
156
74c9002580d1 Delete recipe needs a confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
503 int rc = QMessageBox::warning(this, tr("Delete recipe"), tr("Delete %1").arg(recipe->name),
74c9002580d1 Delete recipe needs a confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
504 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
74c9002580d1 Delete recipe needs a confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
505 if (rc == QMessageBox::No)
74c9002580d1 Delete recipe needs a confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
506 return;
74c9002580d1 Delete recipe needs a confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
507
249
3c28dc8dd51d Moved recipe load, save and delete to it's own file.
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
508 DB_recipe::dele(this, this->recno);
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
509
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
510 this->close();
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
511 this->setResult(1);
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
512 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
513
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
514
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
515 void EditRecipe::is_changed()
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
516 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
517 ui->saveButton->setEnabled(true);
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 169
diff changeset
518 ui->deleteButton->setEnabled(((this->recno >= 0) ? true:false) && ! recipe->locked);
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
519 this->textIsChanged = true;
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
520 WindowTitle();
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
521 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
522
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
523
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
524 void EditRecipe::on_quitButton_clicked()
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
525 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
526 if (this->textIsChanged) {
98
1425bf3e18ed Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
527 int rc = QMessageBox::warning(this, tr("Recipe changed"), tr("The recipe has been modified. Save changes?"),
92
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
528 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
529 switch (rc) {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530 case QMessageBox::Save:
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
531 on_saveButton_clicked();
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532 break; /* Saved and then Quit */
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
533 case QMessageBox::Discard:
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
534 break; /* Quit without Save */
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
535 case QMessageBox::Cancel:
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
536 return; /* Return to the editor page */
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
537 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
538 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
539
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
540 this->close();
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
541 this->setResult(1);
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
542 }

mercurial