src/EditRecipe.cpp

Mon, 18 Apr 2022 10:55:33 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 18 Apr 2022 10:55:33 +0200
changeset 141
eea8a9e7e1f6
parent 139
f947c6988e91
child 142
1caa15a0eefc
permissions
-rw-r--r--

Upgrade yeasts fields if needed during recipe startup. Added yeast table.

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"
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
19 #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
20 #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
21 #include "global.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
22
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
23
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
24
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
25 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
26 {
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
27 QSqlQuery query, wquery;
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
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 qDebug() << "EditRecipe record:" << id;
108
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
30 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
31 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
32 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
33 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
34 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
35
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
36 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
37
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 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
39 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
40 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
41
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
42 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
43 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
44 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
45 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
46 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
47
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
48 ui->ibu_methodEdit->addItem("Tinseth");
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
49 ui->ibu_methodEdit->addItem("Rager");
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
50 ui->ibu_methodEdit->addItem("Daniels");
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
51
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
52 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
53 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
54 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
55 }
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
56
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 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
58 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
59 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
60
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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 }
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
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
72 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
73 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
74 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
75 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
76 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
77 }
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
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
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 }
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
87
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
88 if (id >= 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
89 query.prepare("SELECT * FROM recipes WHERE record = :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
90 query.bindValue(":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
91 query.exec();
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
92 query.next();
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
93
108
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
94 recipe->record = query.value(0).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
95 recipe->uuid = query.value(1).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
96 recipe->locked = query.value(2).toInt() ? true:false;
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
97 recipe->st_name = query.value(3).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
98 recipe->st_letter = query.value(4).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
99 recipe->st_guide = query.value(5).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
100 recipe->st_category = query.value(6).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
101 recipe->st_category_number = query.value(7).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
102 recipe->st_type = query.value(8).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
103 recipe->st_og_min = query.value(9).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
104 recipe->st_og_max = query.value(10).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
105 recipe->st_fg_min = query.value(11).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
106 recipe->st_fg_max = query.value(12).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
107 recipe->st_ibu_min = query.value(13).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
108 recipe->st_ibu_max = query.value(14).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
109 recipe->st_color_min = query.value(15).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
110 recipe->st_color_max = query.value(16).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
111 recipe->st_carb_min = query.value(17).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
112 recipe->st_carb_max = query.value(18).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
113 recipe->st_abv_min = query.value(19).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
114 recipe->st_abv_max = query.value(20).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
115 recipe->name = query.value(21).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
116 recipe->notes = query.value(22).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
117 recipe->type = query.value(23).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
118 recipe->batch_size = query.value(24).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
119 recipe->boil_size = query.value(25).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
120 recipe->boil_time = query.value(26).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
121 recipe->efficiency = query.value(27).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
122 recipe->est_og = query.value(28).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
123 recipe->est_fg = query.value(29).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
124 recipe->est_abv = query.value(30).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
125 recipe->est_color = query.value(31).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
126 recipe->color_method = query.value(32).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
127 recipe->est_ibu = query.value(33).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
128 recipe->ibu_method = query.value(34).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
129 recipe->est_carb = query.value(35).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
130
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
131 recipe->sparge_temp = query.value(36).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
132 recipe->sparge_ph = query.value(37).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
133 recipe->sparge_volume = query.value(38).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
134 recipe->sparge_source = query.value(39).toInt();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
135 recipe->sparge_acid_type = query.value(40).toInt();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
136 recipe->sparge_acid_perc = query.value(41).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
137 recipe->sparge_acid_amount = query.value(42).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
138 recipe->mash_ph = query.value(43).toDouble();
118
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
139 recipe->mash_name = query.value(44).toString();
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
140 recipe->calc_acid = query.value(45).toInt() ? true:false;
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
141
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
142 recipe->w1_name = query.value(46).toString();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
143 recipe->w1_amount = query.value(47).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
144 recipe->w1_calcium = query.value(48).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
145 recipe->w1_sulfate = query.value(49).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
146 recipe->w1_chloride = query.value(50).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
147 recipe->w1_sodium = query.value(51).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
148 recipe->w1_magnesium = query.value(52).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
149 recipe->w1_total_alkalinity = query.value(53).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
150 recipe->w1_ph = query.value(54).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
151 recipe->w1_cost = query.value(55).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
152 recipe->w2_name = query.value(56).toString();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
153 recipe->w2_amount = query.value(57).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
154 recipe->w2_calcium = query.value(58).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
155 recipe->w2_sulfate = query.value(59).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
156 recipe->w2_chloride = query.value(60).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
157 recipe->w2_sodium = query.value(61).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
158 recipe->w2_magnesium = query.value(62).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
159 recipe->w2_total_alkalinity = query.value(63).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
160 recipe->w2_ph = query.value(64).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
161 recipe->w2_cost = query.value(65).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
162 recipe->wg_amount = query.value(66).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
163 recipe->wg_calcium = query.value(67).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
164 recipe->wg_sulfate = query.value(68).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
165 recipe->wg_chloride = query.value(69).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
166 recipe->wg_sodium = query.value(70).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
167 recipe->wg_magnesium = query.value(71).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
168 recipe->wg_total_alkalinity = query.value(72).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
169 recipe->wg_ph = query.value(73).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
170 recipe->wb_calcium = query.value(74).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
171 recipe->wb_sulfate = query.value(75).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
172 recipe->wb_chloride = query.value(76).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
173 recipe->wb_sodium = query.value(77).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
174 recipe->wb_magnesium = query.value(78).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
175 recipe->wb_total_alkalinity = query.value(79).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
176 recipe->wb_ph = query.value(80).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
177 recipe->wa_acid_name = query.value(81).toInt();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
178 recipe->wa_acid_perc = query.value(82).toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
179 recipe->wa_base_name = query.value(83).toInt();
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
180
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
181 QJsonParseError parseError;
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
182 const auto& f_json = query.value(84).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
183 if (!f_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
184 const auto& formattedJson = QString("%1").arg(f_json);
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
185 QJsonDocument fermentables = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
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
186 if (parseError.error != QJsonParseError::NoError) {
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
187 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
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
188 } else if (fermentables.isArray()) {
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
189 for (int i = 0; i < fermentables.array().size(); i++) {
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
190 QJsonObject obj = fermentables.array().at(i).toObject();
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
191 //qDebug() << i << obj;
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
192 Fermentables f;
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
193 f.f_name = obj["f_name"].toString();
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
194 f.f_origin = obj["f_origin"].toString();
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
195 f.f_supplier = obj["f_supplier"].toString();
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
196 f.f_amount = obj["f_amount"].toDouble();
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
197 f.f_cost = obj["f_cost"].toDouble();
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
198 f.f_type = obj["f_type"].toInt();
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
199 f.f_yield = obj["f_yield"].toDouble();
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
200 f.f_color = obj["f_color"].toDouble();
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
201 f.f_coarse_fine_diff = obj["f_coarse_fine_diff"].toDouble();
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
202 f.f_moisture = obj["f_moisture"].toDouble();
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
203 f.f_diastatic_power = obj["f_diastatic_power"].toDouble();
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
204 f.f_protein = obj["f_protein"].toDouble();
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
205 f.f_dissolved_protein = obj["f_dissolved_protein"].toDouble();
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
206 f.f_max_in_batch = obj["f_max_in_batch"].toDouble();
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
207 f.f_graintype = obj["f_graintype"].toInt();
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
208 f.f_added = obj["f_added"].toInt();
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
209 f.f_recommend_mash = obj["f_recommend_mash"].toInt() ? true:false;
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
210 f.f_add_after_boil = obj["f_add_after_boil"].toInt() ? true:false;
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
211 f.f_adjust_to_total_100 = obj["f_adjust_to_total_100"].toInt() ? true:false;
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
212 f.f_percentage = obj["f_percentage"].toDouble();
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
213 f.f_di_ph = obj["f_di_ph"].toDouble();
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
214 f.f_acid_to_ph_57 = obj["f_acid_to_ph_57"].toDouble();
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
215 if (f.f_adjust_to_total_100)
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
216 recipe->fermentables_use100 = true;
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
217 recipe->fermentables.append(f);
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
218 }
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
219 qDebug() << "fermentables" << recipe->fermentables.size();
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
220 }
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
221 } else {
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
222 qDebug() << "empty fermentables";
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
223 }
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
224
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
225 const auto& h_json = query.value(85).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
226 if (!h_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
227 const auto& formattedJson = QString("%1").arg(h_json);
113
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
228 QJsonDocument hops = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
229 if (parseError.error != QJsonParseError::NoError) {
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
230 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
231 } else if (hops.isArray()) {
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
232 for (int i = 0; i < hops.array().size(); i++) {
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
233 QJsonObject obj = hops.array().at(i).toObject();
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
234 //qDebug() << i << obj;
113
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
235 Hops h;
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
236 h.h_name = obj["h_name"].toString();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
237 h.h_origin = obj["h_origin"].toString();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
238 h.h_amount = obj["h_amount"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
239 h.h_cost = obj["h_cost"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
240 h.h_type = obj["h_type"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
241 h.h_form = obj["h_form"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
242 h.h_useat = obj["h_useat"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
243 h.h_time = obj["h_time"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
244 h.h_alpha = obj["h_alpha"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
245 h.h_beta = obj["h_beta"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
246 h.h_hsi = obj["h_hsi"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
247 h.h_humulene = obj["h_humulene"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
248 h.h_caryophyllene = obj["h_caryophyllene"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
249 h.h_cohumulone = obj["h_cohumulone"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
250 h.h_myrcene = obj["h_myrcene"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
251 h.h_total_oil = obj["h_total_oil"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
252 recipe->hops.append(h);
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
253 }
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
254 qDebug() << "hops" << recipe->hops.size();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
255 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
256 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
257 qDebug() << "empty hops";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
258 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
259
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
260 const auto& m_json = query.value(86).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
261 if (!m_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
262 const auto& formattedJson = QString("%1").arg(m_json);
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
263 QJsonDocument miscs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
112
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
264 if (parseError.error != QJsonParseError::NoError) {
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
265 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
266 } else if (miscs.isArray()) {
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
267 for (int i = 0; i < miscs.array().size(); i++) {
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
268 QJsonObject obj = miscs.array().at(i).toObject();
141
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
269 //qDebug() << i << obj;
112
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
270 Miscs m;
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
271 m.m_name = obj["m_name"].toString();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
272 m.m_amount = obj["m_amount"].toDouble();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
273 m.m_type = obj["m_type"].toInt();
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
274 m.m_use_use = obj["m_use_use"].toInt();
112
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
275 m.m_time = obj["m_time"].toDouble();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
276 m.m_amount_is_weight = obj["m_amount_is_weight"].toInt() ? true:false;
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
277 m.m_cost = obj["m_cost"].toDouble();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
278 recipe->miscs.append(m);
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
279 }
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
280 qDebug() << "miscs" << recipe->miscs.size();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
281 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
282 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
283 qDebug() << "empty miscs";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
284 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
285
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
286 const auto& y_json = query.value(87).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
287 if (!y_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
288 const auto& formattedJson = QString("%1").arg(y_json);
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
289 QJsonDocument yeasts = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
290 if (parseError.error != QJsonParseError::NoError) {
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
291 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
292 } else if (yeasts.isArray()) {
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
293 for (int i = 0; i < yeasts.array().size(); i++) {
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
294 QJsonObject obj = yeasts.array().at(i).toObject();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
295 qDebug() << i << obj;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
296 Yeasts y;
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
297 /* First some defaults for newer fields. */
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
298 y.y_tolerance = y.y_harvest_time = y.y_pitch_temperature = y.y_zymocide = 0;
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
299 y.y_sta1 = y.y_bacteria = y.y_harvest_top = y.y_pofpos = false;
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
300 y.y_gr_hl_lo = 50;
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
301 y.y_sg_lo = 1.04;
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
302 y.y_gr_hl_hi = 80;
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
303 y.y_sg_hi = 1.08;
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
304 /* Now get what we have got */
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
305 y.y_name = obj["y_name"].toString();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
306 y.y_laboratory = obj["y_laboratory"].toString();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
307 y.y_product_id = obj["y_product_id"].toString();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
308 y.y_amount = obj["y_amount"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
309 y.y_type = obj["y_type"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
310 y.y_form = obj["y_form"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
311 y.y_min_temperature = obj["y_min_temperature"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
312 y.y_max_temperature = obj["y_max_temperature"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
313 y.y_flocculation = obj["y_flocculation"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
314 y.y_attenuation = obj["y_attenuation"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
315 y.y_cells = obj["y_cells"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
316 y.y_tolerance = obj["y_tolerance"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
317 y.y_inventory = obj["y_inventory"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
318 y.y_use = obj["y_use"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
319 y.y_sta1 = obj["y_sta1"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
320 y.y_bacteria = obj["y_bacteria"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
321 y.y_harvest_top = obj["y_harvest_top"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
322 y.y_harvest_time = obj["y_harvest_time"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
323 y.y_pitch_temperature = obj["y_pitch_temperature"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
324 y.y_pofpos = obj["y_pofpos"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
325 y.y_zymocide = obj["y_zymocide"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
326 y.y_gr_hl_lo = obj["y_gr_hl_lo"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
327 y.y_sg_lo = obj["y_sg_lo"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
328 y.y_gr_hl_hi = obj["y_gr_hl_hi"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
329 y.y_sg_hi = obj["y_sg_hi"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
330 y.y_cost = obj["y_cost"].toDouble();
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
331
141
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
332 if (y.y_tolerance == 0) { // More and better tests?
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
333 /*
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
334 * Possible data upgrade needed.
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
335 */
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
336 query.prepare("SELECT tolerance,cells,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,"
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
337 "pofpos,zymocide,gr_hl_lo,sg_lo,gr_hl_hi,sg_hi "
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
338 "FROM inventory_yeasts WHERE name=:name AND laboratory=:laboratory AND product_id=:product_id");
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
339 query.bindValue(":name", y.y_name);
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
340 query.bindValue(":laboratory", y.y_laboratory);
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
341 query.bindValue(":product_id", y.y_product_id);
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
342 query.exec();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
343 if (query.first()) {
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
344 y.y_tolerance = query.value(0).toDouble();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
345 y.y_cells = query.value(1).toDouble();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
346 y.y_sta1 = query.value(2).toInt() ? true:false;
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
347 y.y_bacteria = query.value(3).toInt() ? true:false;
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
348 y.y_harvest_top = query.value(4).toInt() ? true:false;
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
349 y.y_harvest_time = query.value(5).toInt();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
350 y.y_pitch_temperature = query.value(6).toDouble();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
351 y.y_pofpos = query.value(7).toInt() ? true:false;
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
352 y.y_zymocide = query.value(8).toInt();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
353 y.y_gr_hl_lo = query.value(9).toInt();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
354 y.y_sg_lo = query.value(10).toDouble();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
355 y.y_gr_hl_hi = query.value(11).toInt();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
356 y.y_sg_hi = query.value(12).toDouble();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
357 } else {
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
358 qDebug() << y.y_name << y.y_product_id << "not found for upgrade";
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
359 }
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
360 }
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
361 recipe->yeasts.append(y);
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
362 }
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
363 qDebug() << "yeasts" << recipe->yeasts.size();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
364 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
365 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
366 qDebug() << "empty yeasts";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
367 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
368
141
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
369 qDebug() << query.value(88).toString();
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
370 const auto& ma_json = query.value(88).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
371 if (!ma_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
372 const auto& formattedJson = QString("%1").arg(ma_json);
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
373 QJsonDocument mashs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
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
374 if (parseError.error != QJsonParseError::NoError) {
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
375 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
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
376 } else if (mashs.isArray()) {
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
377 for (int i = 0; i < mashs.array().size(); i++) {
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
378 QJsonObject obj = mashs.array().at(i).toObject();
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
379 qDebug() << i << obj;
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
380 Mashs m;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
381 m.step_name = obj["step_name"].toString();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
382 m.step_type = obj["step_type"].toInt();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
383 m.step_volume = obj["step_volume"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
384 m.step_infuse_amount = obj["step_infuse_amount"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
385 m.step_infuse_temp = obj["step_infuse_temp"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
386 m.step_temp = obj["step_temp"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
387 m.step_time = obj["step_time"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
388 m.ramp_time = obj["ramp_time"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
389 m.end_temp = obj["end_temp"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
390 m.step_wg_ratio = obj["step_wg_ratio"].toDouble();
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
391 recipe->mashs.append(m);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
392 }
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
393 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
394 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
395 qDebug() << "empty mashs";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
396 }
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
397 qDebug() << "mashs" << recipe->mashs.size();
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
398
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
399 } 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
400 /* Set some defaults */
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
401 recipe->locked = false;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
402 recipe->st_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
403 recipe->st_letter = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
404 recipe->st_guide = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
405 recipe->st_category = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
406 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
407 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
408 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
409 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
410 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
411 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
412 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
413 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
414 recipe->name = "";
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
415 recipe->notes = "";
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
416 recipe->efficiency = 75;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
417 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
418 recipe->boil_size = 24;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
419 recipe->boil_time = 60;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
420 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
421 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
422 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
423 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
424 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
425 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
426 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
427 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
428 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
429 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
430 recipe->mash_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
431 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
432 recipe->w1_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
433 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
434 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
435 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
436 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
437 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
438 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
439 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
440 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
441 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
442 recipe->w2_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
443 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
444 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
445 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
446 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
447 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
448 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
449 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
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 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
470 }
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
471
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
472 // Tab generic.
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
473 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
474 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
475 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
476 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
477 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
478 ui->st_catnrEdit->setText(QString("%1").arg(recipe->st_category_number));
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
479 ui->st_typeEdit->setText(s_types[recipe->st_type]);
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 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
498 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
499 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
500 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
501 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
502 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
503 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
504 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
505 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
506 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
507 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
508 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
509 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
510 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519 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
520
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
521 // 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
522 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
523 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
524 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
525
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
526 // 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
527 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
528
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
529 // 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
530 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
531 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
532 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
533
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
534 // 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
535 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
536 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
537 /*
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
538 * 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
539 */
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
540 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
541 } 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
542 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
543 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
544 /*
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
545 * 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
546 */
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
547 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
548 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
549 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
550 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
551 }
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
552 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
553 /*
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
554 * 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
555 */
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
556 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
557 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
558 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
559 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
560 }
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
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 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
569 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
570 } 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
571 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
572 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
573 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
574 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
575 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
576 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
577 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
578 }
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
579 }
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
580 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
581 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
582 ui->w1_mgEdit->setValue(recipe->w1_magnesium);
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
583 ui->w1_hco3Edit->setValue(recipe->w1_total_alkalinity * 1.22);
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
584 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
585 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
586 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
587 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
588 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
589
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
590 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
591 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
592 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
593 } 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
594 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
595 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
596 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
597 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
598 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
599 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
600 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
601 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
602 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
603 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
604 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
605 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
606 } 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
607 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
608 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
609 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
610 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
611 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
612 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
613 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
614 }
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
615 }
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
616 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
617 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
618 ui->w2_mgEdit->setValue(recipe->w2_magnesium);
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
619 ui->w2_hco3Edit->setValue(recipe->w2_total_alkalinity * 1.22);
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
620 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
621 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
622 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
623 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
624 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
625 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
626 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
627 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
628 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
629 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
630
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
631 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
632 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
633 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
634 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
635 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
636 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
637 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
638
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
639 // 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
640 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
641 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
642 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(notes_changed()));
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
643 connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &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
644 connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &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
645 connect(ui->boil_timeEdit, &QSpinBox::textChanged, this, &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
646 connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_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
647 connect(ui->beerstyleEdit, &QComboBox::currentTextChanged, this, &EditRecipe::style_changed);
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
648 connect(ui->est_ogEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed);
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
649 connect(ui->color_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::colormethod_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
650 connect(ui->ibu_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_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
651
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
652 // 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
653 ui->fermentablesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
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
654 connect(ui->est_og2Edit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_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
655 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
656 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
657 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
658 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
659 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
660
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
661 // 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
662 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
663 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
664 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
665 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
666
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
667 // 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
668 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
669 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
670
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
671 // 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
672 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
673 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
674
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
675 // All signals from tab "Mash"
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
676
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
677 // 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
678 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
679 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
680 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
681 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
682 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
683 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
684 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
685 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
686 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
687 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
688 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
689 connect(ui->wt_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::wt_target_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
690 connect(ui->w2_volEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::w2_volume_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
691
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
692 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
693 ui->deleteButton->setEnabled((id >= 0) ? 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
694
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
695 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
696 }
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
697
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
698
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
699 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
700 {
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
701 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
702 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
703 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
704 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
705 }
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
706
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
707
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
708 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
709 {
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
710 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
711 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
712 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
713 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
714 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
715 refreshYeasts();
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
716 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
717 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
718 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
719 }
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
720
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
721
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
722 /*
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
723 * 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
724 */
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
725 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
726 {
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
727 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
728
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
729 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
730 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
731 } 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
732 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
733 }
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
734
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
735 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
736 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
737 }
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
738 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
739 }
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
740
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
741
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
742 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
743 {
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
744 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
745
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
746 /* 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
747 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
748 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
749 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
750 }
114
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
751 if (ui->st_nameEdit->text().length() < 2) {
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
752 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
753 return;
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
754 }
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
755
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
756 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
757 if (this->recno == -1) {
107
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
758 query.prepare("INSERT INTO recipes SET locked=:locked, st_name=:st_name, st_letter=:st_letter, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
759 "st_guide=:st_guide, st_category=:st_category, st_category_number=:st_catnr, st_type=:st_type, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
760 "st_og_min=:st_og_min, st_og_max=:st_og_max, st_fg_min=:st_fg_min, st_fg_max=:st_fg_max, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
761 "st_ibu_min=:st_ibu_min, st_ibu_max=:st_ibu_max, st_color_min=:st_color_min, st_color_max=:st_color_max, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
762 "st_carb_min=:st_carb_min, st_carb_max=:st_carb_max, st_abv_min=:st_abv_min, st_abv_max=:st_abv_max, "
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
763 "name=:name, notes=:notes, type=:type, batch_size=:batch_size, boil_size=:boil_size, "
118
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
764 "boil_time=:boil_time, efficiency=:efficiency, est_og=:est_og, est_fg=:est_fg, est_abv=:est_abv, "
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
765 "est_color=:est_color, color_method=:color_method, est_ibu=:est_ibu, ibu_method=:ibu_method, "
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
766 "est_carb=:est_carb, sparge_temp=:sparge_temp, sparge_ph=:sparge_ph, "
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
767 "sparge_volume=:sparge_volume, sparge_source=:sparge_source, sparge_acid_type=:sparge_acid_type, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
768 "sparge_acid_perc=:sparge_acid_perc, sparge_acid_amount=:sparge_acid_amount, mash_ph=:mash_ph, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
769 "mash_name=:mash_name, calc_acid=:calc_acid, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
770 "w1_name=:w1_name, w1_amount=:w1_amount, w1_calcium=:w1_calcium, w1_sulfate=:w1_sulfate, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
771 "w1_chloride=:w1_chloride, w1_sodium=:w1_sodium, w1_magnesium=:w1_magnesium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
772 "w1_total_alkalinity=:w1_total_alkalinity, w1_ph=:w1_ph, w1_cost=:w1_cost, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
773 "w2_name=:w2_name, w2_amount=:w2_amount, w2_calcium=:w2_calcium, w2_sulfate=:w2_sulfate, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
774 "w2_chloride=:w2_chloride, w2_sodium=:w2_sodium, w2_magnesium=:w2_magnesium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
775 "w2_total_alkalinity=:w2_total_alkalinity, w2_ph=:w2_ph, w2_cost=:w2_cost, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
776 "wg_amount=:wg_amount, wg_calcium=:wg_calcium, wg_sulfate=:wg_sulfate, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
777 "wg_chloride=:wg_chloride, wg_sodium=:wg_sodium, wg_magnesium=:wg_magnesium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
778 "wg_total_alkalinity=:wg_total_alkalinity, wg_ph=:wg_ph, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
779 "wb_calcium=:wb_calcium, wb_sulfate=:wb_sulfate, wb_chloride=:wb_chloride, wb_sodium=:wb_sodium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
780 "wb_magnesium=:wb_magnesium, wb_total_alkalinity=:wb_total_alkalinity, wb_ph=:wb_ph, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
781 "wa_acid_name=:wa_acid_name, wa_acid_perc=:wa_acid_perc, wa_base_name=:wa_base_name, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
782 "json_fermentables=:json_fermentables, json_hops=:json_hops, json_miscs=:json_miscs, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
783 "json_yeasts=:json_yeasts, json_mashs=:json_mashs, uuid=:uuid");
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
784 } else {
107
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
785 query.prepare("UPDATE recipes SET locked=:locked, st_name=:st_name, st_letter=:st_letter, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
786 "st_guide=:st_guide, st_category=:st_category, st_category_number=:st_catnr, st_type=:st_type, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
787 "st_og_min=:st_og_min, st_og_max=:st_og_max, st_fg_min=:st_fg_min, st_fg_max=:st_fg_max, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
788 "st_ibu_min=:st_ibu_min, st_ibu_max=:st_ibu_max, st_color_min=:st_color_min, st_color_max=:st_color_max, "
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
789 "st_carb_min=:st_carb_min, st_carb_max=:st_carb_max, st_abv_min=:st_abv_min, st_abv_max=:st_abv_max, "
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
790 "name=:name, notes=:notes, type=:type, batch_size=:batch_size, boil_size=:boil_size, "
118
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
791 "boil_time=:boil_time, efficiency=:efficiency, est_og=:est_og, est_fg=:est_fg, est_abv=:est_abv, "
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
792 "est_color=:est_color, color_method=:color_method, est_ibu=:est_ibu, ibu_method=:ibu_method, "
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
793 "est_carb=:est_carb, sparge_temp=:sparge_temp, sparge_ph=:sparge_ph, "
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
794 "sparge_volume=:sparge_volume, sparge_source=:sparge_source, sparge_acid_type=:sparge_acid_type, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
795 "sparge_acid_perc=:sparge_acid_perc, sparge_acid_amount=:sparge_acid_amount, mash_ph=:mash_ph, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
796 "mash_name=:mash_name, calc_acid=:calc_acid, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
797 "w1_name=:w1_name, w1_amount=:w1_amount, w1_calcium=:w1_calcium, w1_sulfate=:w1_sulfate, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
798 "w1_chloride=:w1_chloride, w1_sodium=:w1_sodium, w1_magnesium=:w1_magnesium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
799 "w1_total_alkalinity=:w1_total_alkalinity, w1_ph=:w1_ph, w1_cost=:w1_cost, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
800 "w2_name=:w2_name, w2_amount=:w2_amount, w2_calcium=:w2_calcium, w2_sulfate=:w2_sulfate, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
801 "w2_chloride=:w2_chloride, w2_sodium=:w2_sodium, w2_magnesium=:w2_magnesium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
802 "w2_total_alkalinity=:w2_total_alkalinity, w2_ph=:w2_ph, w2_cost=:w2_cost, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
803 "wg_amount=:wg_amount, wg_calcium=:wg_calcium, wg_sulfate=:wg_sulfate, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
804 "wg_chloride=:wg_chloride, wg_sodium=:wg_sodium, wg_magnesium=:wg_magnesium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
805 "wg_total_alkalinity=:wg_total_alkalinity, wg_ph=:wg_ph, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
806 "wb_calcium=:wb_calcium, wb_sulfate=:wb_sulfate, wb_chloride=:wb_chloride, wb_sodium=:wb_sodium, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
807 "wb_magnesium=:wb_magnesium, wb_total_alkalinity=:wb_total_alkalinity, wb_ph=:wb_ph, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
808 "wa_acid_name=:wa_acid_name, wa_acid_perc=:wa_acid_perc, wa_base_name=:wa_base_name, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
809 "json_fermentables=:json_fermentables, json_hops=:json_hops, json_miscs=:json_miscs, "
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
810 "json_yeasts=:json_yeasts, json_mashs=:json_mashs WHERE record = :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
811 }
114
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
812 query.bindValue(":locked", recipe->locked ? 1:0);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
813 query.bindValue(":st_name", recipe->st_name);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
814 query.bindValue(":st_letter", recipe->st_letter);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
815 query.bindValue(":st_guide", recipe->st_guide);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
816 query.bindValue(":st_category", recipe->st_category);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
817 query.bindValue(":st_catnr", recipe->st_category_number);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
818 query.bindValue(":st_type", recipe->st_type);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
819 query.bindValue(":st_og_min", round(recipe->st_og_min * 1000) / 1000);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
820 query.bindValue(":st_og_max", round(recipe->st_og_max * 1000) / 1000);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
821 query.bindValue(":st_fg_min", round(recipe->st_fg_min * 1000) / 1000);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
822 query.bindValue(":st_fg_max", round(recipe->st_fg_max * 1000) / 1000);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
823 query.bindValue(":st_ibu_min", round(recipe->st_ibu_min * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
824 query.bindValue(":st_ibu_max", round(recipe->st_ibu_max * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
825 query.bindValue(":st_color_min", round(recipe->st_color_min * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
826 query.bindValue(":st_color_max", round(recipe->st_color_max * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
827 query.bindValue(":st_carb_min", round(recipe->st_carb_min * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
828 query.bindValue(":st_carb_max", round(recipe->st_carb_max * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
829 query.bindValue(":st_abv_min", round(recipe->st_abv_min * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
830 query.bindValue(":st_abv_max", round(recipe->st_abv_max * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
831 query.bindValue(":name", recipe->name);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
832 query.bindValue(":notes", recipe->notes);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
833 query.bindValue(":type", recipe->type);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
834 query.bindValue(":batch_size", round(recipe->batch_size * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
835 query.bindValue(":boil_size", round(recipe->boil_size * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
836 query.bindValue(":boil_time", round(recipe->boil_time * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
837 query.bindValue(":efficiency", round(recipe->efficiency * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
838 query.bindValue(":est_og", round(recipe->est_og * 1000) / 1000);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
839 query.bindValue(":est_fg", round(recipe->est_fg * 1000) / 1000);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
840 query.bindValue(":est_abv", round(recipe->est_abv * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
841 query.bindValue(":est_color", round(recipe->est_color * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
842 query.bindValue(":color_method", recipe->color_method);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
843 query.bindValue(":est_ibu", round(recipe->est_ibu * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
844 query.bindValue(":ibu_method", recipe->ibu_method);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
845 query.bindValue(":est_carb", round(recipe->est_carb * 10) / 10);
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
846 query.bindValue(":sparge_temp", round(recipe->sparge_temp * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
847 query.bindValue(":sparge_ph", round(recipe->sparge_ph * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
848 query.bindValue(":sparge_volume", round(recipe->sparge_volume * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
849 query.bindValue(":sparge_source", recipe->sparge_source);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
850 query.bindValue(":sparge_acid_type", recipe->sparge_acid_type);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
851 query.bindValue(":sparge_acid_perc", round(recipe->sparge_acid_perc * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
852 query.bindValue(":sparge_acid_amount", round(recipe->sparge_acid_amount * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
853 query.bindValue(":mash_ph", round(recipe->mash_ph * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
854 query.bindValue(":mash_name", recipe->mash_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
855 query.bindValue(":calc_acid", recipe->calc_acid ?1:0);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
856 query.bindValue(":w1_name", recipe->w1_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
857 query.bindValue(":w1_amount", round(recipe->w1_amount * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
858 query.bindValue(":w1_calcium", round(recipe->w1_calcium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
859 query.bindValue(":w1_sulfate", round(recipe->w1_sulfate * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
860 query.bindValue(":w1_chloride", round(recipe->w1_chloride * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
861 query.bindValue(":w1_sodium", round(recipe->w1_sodium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
862 query.bindValue(":w1_magnesium", round(recipe->w1_magnesium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
863 query.bindValue(":w1_total_alkalinity", round(recipe->w1_total_alkalinity * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
864 query.bindValue(":w1_ph", round(recipe->w1_ph * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
865 query.bindValue(":w1_cost", round(recipe->w1_cost * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
866 query.bindValue(":w2_name", recipe->w2_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
867 query.bindValue(":w2_amount", round(recipe->w2_amount * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
868 query.bindValue(":w2_calcium", round(recipe->w2_calcium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
869 query.bindValue(":w2_sulfate", round(recipe->w2_sulfate * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
870 query.bindValue(":w2_chloride", round(recipe->w2_chloride * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
871 query.bindValue(":w2_sodium", round(recipe->w2_sodium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
872 query.bindValue(":w2_magnesium", round(recipe->w2_magnesium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
873 query.bindValue(":w2_total_alkalinity", round(recipe->w2_total_alkalinity * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
874 query.bindValue(":w2_ph", round(recipe->w2_ph * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
875 query.bindValue(":w2_cost", round(recipe->w2_cost * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
876 query.bindValue(":wg_amount", round(recipe->wg_amount * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
877 query.bindValue(":wg_calcium", round(recipe->wg_calcium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
878 query.bindValue(":wg_sulfate", round(recipe->wg_sulfate * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
879 query.bindValue(":wg_chloride", round(recipe->wg_chloride * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
880 query.bindValue(":wg_sodium", round(recipe->wg_sodium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
881 query.bindValue(":wg_magnesium", round(recipe->wg_magnesium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
882 query.bindValue(":wg_total_alkalinity", round(recipe->wg_total_alkalinity * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
883 query.bindValue(":wg_ph", round(recipe->wg_ph * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
884 query.bindValue(":wb_calcium", round(recipe->wb_calcium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
885 query.bindValue(":wb_sulfate", round(recipe->wb_sulfate * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
886 query.bindValue(":wb_chloride", round(recipe->wb_chloride * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
887 query.bindValue(":wb_sodium", round(recipe->wb_sodium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
888 query.bindValue(":wb_magnesium", round(recipe->wb_magnesium * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
889 query.bindValue(":wb_total_alkalinity", round(recipe->wb_total_alkalinity * 100000) / 100000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
890 query.bindValue(":wb_ph", round(recipe->wb_ph * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
891 query.bindValue(":wa_acid_name", recipe->wa_acid_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
892 query.bindValue(":wa_acid_perc", round(recipe->wa_acid_perc * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
893 query.bindValue(":wa_base_name", recipe->wa_base_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
894
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
895 if (recipe->fermentables.size() == 0) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
896 query.bindValue(":json_fermentables", "[]");
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
897 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
898 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
899 for (int i = 0; i < recipe->fermentables.size(); i++) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
900 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
901 obj.insert("f_name", recipe->fermentables.at(i).f_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
902 obj.insert("f_origin", recipe->fermentables.at(i).f_origin);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
903 obj.insert("f_supplier", recipe->fermentables.at(i).f_supplier);
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
904 obj.insert("f_amount", round(recipe->fermentables.at(i).f_amount * 10000) / 10000);
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
905 obj.insert("f_cost", round(recipe->fermentables.at(i).f_cost * 1000) / 1000);
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
906 obj.insert("f_type", recipe->fermentables.at(i).f_type);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
907 obj.insert("f_yield", round(recipe->fermentables.at(i).f_yield * 10) / 10);
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
908 obj.insert("f_color", round(recipe->fermentables.at(i).f_color * 10) / 10);
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
909 obj.insert("f_coarse_fine_diff", round(recipe->fermentables.at(i).f_coarse_fine_diff * 10) / 10);
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
910 obj.insert("f_moisture", round(recipe->fermentables.at(i).f_moisture * 10) / 10);
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
911 obj.insert("f_diastatic_power", round(recipe->fermentables.at(i).f_diastatic_power * 100000) / 100000);
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
912 obj.insert("f_protein", round(recipe->fermentables.at(i).f_protein * 10) / 10);
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
913 obj.insert("f_dissolved_protein", round(recipe->fermentables.at(i).f_dissolved_protein * 10) / 10);
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
914 obj.insert("f_max_in_batch", recipe->fermentables.at(i).f_max_in_batch);
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
915 obj.insert("f_graintype", recipe->fermentables.at(i).f_graintype);
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
916 obj.insert("f_added", recipe->fermentables.at(i).f_added);
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
917 obj.insert("f_recommend_mash", recipe->fermentables.at(i).f_recommend_mash ? 1:0);
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
918 obj.insert("f_add_after_boil", recipe->fermentables.at(i).f_add_after_boil ? 1:0);
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
919 obj.insert("f_adjust_to_total_100", recipe->fermentables.at(i).f_adjust_to_total_100 ? 1:0);
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
920 obj.insert("f_percentage", round(recipe->fermentables.at(i).f_percentage * 10) / 10);
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
921 obj.insert("f_di_ph", round(recipe->fermentables.at(i).f_di_ph * 100000) / 100000);
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
922 obj.insert("f_acid_to_ph_57", round(recipe->fermentables.at(i).f_acid_to_ph_57 * 100000) / 100000);
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
923 qDebug() << "fermentables_Json" << i << obj;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
924 array.append(obj); /* Append this object */
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
925 }
116
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
926 QJsonDocument doc;
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
927 doc.setArray(array);
118
c57771e40ca8 Fixed loading mash_name. Save calculated est_ values in the Recipe struct. Fixed missing recipe values save to MySQL. Added slots for ferment_select_changed, ferment_instock_changed. Layout changes in fermentables popup editor. Implemented fermentable abort and rollback.
Michiel Broek <mbroek@mbse.eu>
parents: 117
diff changeset
928 // qDebug() << doc.toJson(QJsonDocument::Compact);
116
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
929 query.bindValue(":json_fermentables", doc.toJson(QJsonDocument::Compact));
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
930 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
931
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
932 if (recipe->hops.size() == 0) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
933 query.bindValue(":json_hops", "[]");
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
934 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
935 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
936 for (int i = 0; i < recipe->hops.size(); i++) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
937 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
938 obj.insert("h_name", recipe->hops.at(i).h_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
939 obj.insert("h_origin", recipe->hops.at(i).h_origin);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
940 obj.insert("h_amount", round(recipe->hops.at(i).h_amount * 10000) / 10000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
941 obj.insert("h_cost", round(recipe->hops.at(i).h_cost * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
942 obj.insert("h_type", recipe->hops.at(i).h_type);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
943 obj.insert("h_form", recipe->hops.at(i).h_form);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
944 obj.insert("h_useat", recipe->hops.at(i).h_useat);
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
945 obj.insert("h_time", round(recipe->hops.at(i).h_time));
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
946 obj.insert("h_alpha", round(recipe->hops.at(i).h_alpha * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
947 obj.insert("h_beta", round(recipe->hops.at(i).h_beta * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
948 obj.insert("h_hsi", round(recipe->hops.at(i).h_hsi * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
949 obj.insert("h_humulene", round(recipe->hops.at(i).h_humulene * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
950 obj.insert("h_caryophyllene", round(recipe->hops.at(i).h_caryophyllene * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
951 obj.insert("h_cohumulone", round(recipe->hops.at(i).h_cohumulone * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
952 obj.insert("h_myrcene", round(recipe->hops.at(i).h_myrcene * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
953 obj.insert("h_total_oil", round(recipe->hops.at(i).h_total_oil * 100) / 100);
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
954 qDebug() << "hops_Json" << i << obj;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
955 array.append(obj); /* Append this object */
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
956 }
116
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
957 QJsonDocument doc;
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
958 doc.setArray(array);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
959 query.bindValue(":json_hops", doc.toJson(QJsonDocument::Compact));
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
960 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
961
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
962 if (recipe->miscs.size() == 0) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
963 query.bindValue(":json_miscs", "[]");
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
964 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
965 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
966 for (int i = 0; i < recipe->miscs.size(); i++) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
967 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
968 obj.insert("m_name", recipe->miscs.at(i).m_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
969 obj.insert("m_amount", round(recipe->miscs.at(i).m_amount * 10000) / 10000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
970 obj.insert("m_type", recipe->miscs.at(i).m_type);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
971 obj.insert("m_use_use", recipe->miscs.at(i).m_use_use);
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
972 obj.insert("m_time", round(recipe->miscs.at(i).m_time));
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
973 obj.insert("m_amount_is_weight", recipe->miscs.at(i).m_amount_is_weight ? 1:0);
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
974 obj.insert("m_cost", round(recipe->miscs.at(i).m_cost * 10000) / 10000);
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
975 qDebug() << "miscs_Json" << i << obj;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
976 array.append(obj); /* Append this object */
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
977 }
116
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
978 QJsonDocument doc;
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
979 doc.setArray(array);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
980 // qDebug() << doc.toJson(QJsonDocument::Compact);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
981 query.bindValue(":json_miscs", doc.toJson(QJsonDocument::Compact));
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
982 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
983
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
984 if (recipe->yeasts.size() == 0) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
985 query.bindValue(":json_yeasts", "[]");
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
986 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
987 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
988 for (int i = 0; i < recipe->yeasts.size(); i++) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
989 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
990 obj.insert("y_name", recipe->yeasts.at(i).y_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
991 obj.insert("y_laboratory", recipe->yeasts.at(i).y_laboratory);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
992 obj.insert("y_product_id", recipe->yeasts.at(i).y_product_id);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
993 obj.insert("y_amount", round(recipe->yeasts.at(i).y_amount * 10000) / 10000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
994 obj.insert("y_type", recipe->yeasts.at(i).y_type);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
995 obj.insert("y_form", recipe->yeasts.at(i).y_form);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
996 obj.insert("y_min_temperature", round(recipe->yeasts.at(i).y_min_temperature * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
997 obj.insert("y_max_temperature", round(recipe->yeasts.at(i).y_max_temperature * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
998 obj.insert("y_flocculation", recipe->yeasts.at(i).y_flocculation);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
999 obj.insert("y_attenuation", round(recipe->yeasts.at(i).y_attenuation * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1000 obj.insert("y_cells", recipe->yeasts.at(i).y_cells);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1001 obj.insert("y_tolerance", round(recipe->yeasts.at(i).y_tolerance * 10) / 10);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1002 obj.insert("y_inventory", round(recipe->yeasts.at(i).y_inventory * 10000) / 10000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1003 obj.insert("y_use", recipe->yeasts.at(i).y_use);
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
1004 obj.insert("y_sta1", recipe->yeasts.at(i).y_sta1 ? 1:0);
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
1005 obj.insert("y_bacteria", recipe->yeasts.at(i).y_bacteria ? 1:0);
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
1006 obj.insert("y_harvest_top", recipe->yeasts.at(i).y_harvest_top ? 1:0);
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1007 obj.insert("y_harvest_time", recipe->yeasts.at(i).y_harvest_time);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1008 obj.insert("y_pitch_temperature", round(recipe->yeasts.at(i).y_pitch_temperature * 10) / 10);
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
1009 obj.insert("y_pofpos", recipe->yeasts.at(i).y_pofpos ? 1:0);
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1010 obj.insert("y_zymocide", recipe->yeasts.at(i).y_zymocide);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1011 obj.insert("y_gr_hl_lo", recipe->yeasts.at(i).y_gr_hl_lo);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1012 obj.insert("y_sg_lo", round(recipe->yeasts.at(i).y_sg_lo * 1000) / 1000);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1013 obj.insert("y_gr_hl_hi", recipe->yeasts.at(i).y_gr_hl_hi);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1014 obj.insert("y_sg_hi", round(recipe->yeasts.at(i).y_sg_hi * 1000) / 1000);
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
1015 obj.insert("y_cost", round(recipe->yeasts.at(i).y_cost * 1000) / 1000);
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
1016 qDebug() << "yeasts_Json" << i << obj;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1017 array.append(obj); /* Append this object */
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1018 }
116
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1019 QJsonDocument doc;
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1020 doc.setArray(array);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1021 // qDebug() << doc.toJson(QJsonDocument::Compact);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1022 query.bindValue(":json_yeasts", doc.toJson(QJsonDocument::Compact));
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1023 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1024
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1025 if (recipe->mashs.size() == 0) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1026 query.bindValue(":json_mashs", "[]");
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1027 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1028 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1029 for (int i = 0; i < recipe->mashs.size(); i++) {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1030 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1031 obj.insert("step_name", recipe->mashs.at(i).step_name);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1032 obj.insert("step_type", recipe->mashs.at(i).step_type);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1033 obj.insert("step_volume", round(recipe->mashs.at(i).step_volume * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1034 obj.insert("step_infuse_amount", round(recipe->mashs.at(i).step_infuse_amount * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1035 obj.insert("step_infuse_temp", round(recipe->mashs.at(i).step_infuse_temp * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1036 obj.insert("step_temp", round(recipe->mashs.at(i).step_temp * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1037 obj.insert("step_time", round(recipe->mashs.at(i).step_time * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1038 obj.insert("ramp_time", round(recipe->mashs.at(i).ramp_time * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1039 obj.insert("end_temp", round(recipe->mashs.at(i).end_temp * 100) / 100);
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1040 obj.insert("step_wg_ratio", round(recipe->mashs.at(i).step_wg_ratio * 100) / 100);
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
1041 qDebug() << "mashs_Json" << i << obj;
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1042 array.append(obj); /* Append this object */
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1043 }
116
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1044 QJsonDocument doc;
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1045 doc.setArray(array);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1046 // qDebug() << doc.toJson(QJsonDocument::Compact);
6f415bf6340a Fixed saving the json data. Removed dead code. Edit fermentable amounts sets is_changed.
Michiel Broek <mbroek@mbse.eu>
parents: 115
diff changeset
1047 query.bindValue(":json_mashs", doc.toJson(QJsonDocument::Compact));
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1048 }
107
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1049
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
1050 if (this->recno == -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
1051 query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
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
1052 } 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
1053 query.bindValue(":recno", 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
1054 }
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1055 query.exec();
107
bb4607e23065 Added minval() and maxval() read to RangedSlider. Filled the MySQL query with the values that are ready at this point.
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1056 qDebug() << query.lastQuery();
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
1057 if (query.lastError().isValid()) {
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
1058 qDebug() << "EditRecipe" << query.lastError();
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
1059 QMessageBox::warning(this, tr("Database error"),
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
1060 tr("MySQL error: %1\n%2\n%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
1061 .arg(query.lastError().nativeErrorCode())
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
1062 .arg(query.lastError().driverText())
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
1063 .arg(query.lastError().databaseText()));
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
1064 } 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
1065 qDebug() << "EditRecipe Saved";
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
1066 }
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
1067 }
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
1068
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
1069 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
1070 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
1071 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
1072 }
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
1073
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
1074
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1075 #include "EditRecipeTab1.cpp"
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1076 #include "EditRecipeTab2.cpp"
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1077 #include "EditRecipeTab3.cpp"
128
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1078 #include "EditRecipeTab4.cpp"
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1079 #include "EditRecipeTab5.cpp"
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1080 #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
1081 #include "EditRecipeTab7.cpp"
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1082
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1083
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
1084 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
1085 {
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
1086 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
1087
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
1088 query.prepare("DELETE FROM recipes WHERE record = :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
1089 query.bindValue(":recno", 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
1090 query.exec();
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
1091 if (query.lastError().isValid()) {
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
1092 qDebug() << "EditRecipe" << query.lastError();
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
1093 QMessageBox::warning(this, tr("Database error"),
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
1094 tr("MySQL error: %1\n%2\n%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
1095 .arg(query.lastError().nativeErrorCode())
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
1096 .arg(query.lastError().driverText())
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
1097 .arg(query.lastError().databaseText()));
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
1098 } 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
1099 qDebug() << "EditRecipe Deleted" << 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
1100 }
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
1101
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
1102 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
1103 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
1104 }
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
1105
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
1106
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
1107 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
1108 {
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
1109 ui->saveButton->setEnabled(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
1110 ui->deleteButton->setEnabled((this->recno >= 0) ? true: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
1111 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
1112 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
1113 }
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
1114
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
1115
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
1116 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
1117 {
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
1118 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
1119 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
1120 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
1121 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
1122 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
1123 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
1124 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
1125 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
1126 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
1127 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
1128 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
1129 }
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
1130 }
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
1131
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
1132 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
1133 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
1134 }

mercurial