src/EditRecipe.cpp

Wed, 20 Apr 2022 14:30:06 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 20 Apr 2022 14:30:06 +0200
changeset 149
d73719fa2ebb
parent 148
ba25a566b100
child 150
fd568cc1dd0e
permissions
-rw-r--r--

Implemented choose main and dillution waters. Implement change dillution water volume.

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
144
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
79 query.prepare("SELECT name FROM profile_mash ORDER BY name");
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
80 query.exec();
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
81 ui->mash_pickEdit->addItem("");
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
82 while (query.next()) {
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
83 ui->mash_pickEdit->addItem(query.value(0).toString());
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
84 }
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
85
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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 }
1d14d3bf2465 Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
94
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
95 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
96 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
97 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
98 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
99 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
100
108
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
101 recipe->record = query.value(0).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
102 recipe->uuid = query.value(1).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
103 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
104 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
105 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
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120 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
121 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
122 recipe->name = query.value(21).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
123 recipe->notes = query.value(22).toString();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
124 recipe->type = query.value(23).toInt();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
125 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
126 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
127 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
128 recipe->efficiency = query.value(27).toDouble();
ecfcbee4a9b2 Redesign the database interface for the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 107
diff changeset
129 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
130 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
131 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
132 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
133 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
134 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
135 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
136 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
137
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
149 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
150 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
151 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
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187
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
188 QJsonParseError parseError;
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
189 const auto& f_json = query.value(84).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
190 if (!f_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
191 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
192 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
193 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
194 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
195 } 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
196 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
197 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
198 //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
199 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
200 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
201 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 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
212 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
213 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
214 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
215 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
216 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
217 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
218 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
219 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
220 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
221 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
222 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
223 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
224 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
225 }
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
226 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
227 }
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
228 } 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
229 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
230 }
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
231
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
232 const auto& h_json = query.value(85).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
233 if (!h_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
234 const auto& formattedJson = QString("%1").arg(h_json);
113
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
235 QJsonDocument hops = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
236 if (parseError.error != QJsonParseError::NoError) {
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
237 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
238 } else if (hops.isArray()) {
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
239 for (int i = 0; i < hops.array().size(); i++) {
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
240 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
241 //qDebug() << i << obj;
113
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
242 Hops h;
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
243 h.h_name = obj["h_name"].toString();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
244 h.h_origin = obj["h_origin"].toString();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
245 h.h_amount = obj["h_amount"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
246 h.h_cost = obj["h_cost"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
247 h.h_type = obj["h_type"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
248 h.h_form = obj["h_form"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
249 h.h_useat = obj["h_useat"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
250 h.h_time = obj["h_time"].toInt();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
251 h.h_alpha = obj["h_alpha"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
252 h.h_beta = obj["h_beta"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
253 h.h_hsi = obj["h_hsi"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
254 h.h_humulene = obj["h_humulene"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
255 h.h_caryophyllene = obj["h_caryophyllene"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
256 h.h_cohumulone = obj["h_cohumulone"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
257 h.h_myrcene = obj["h_myrcene"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
258 h.h_total_oil = obj["h_total_oil"].toDouble();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
259 recipe->hops.append(h);
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
260 }
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
261 qDebug() << "hops" << recipe->hops.size();
30a34d639e90 Load hops in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
262 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
263 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
264 qDebug() << "empty hops";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
265 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
266
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
267 const auto& m_json = query.value(86).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
268 if (!m_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
269 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
270 QJsonDocument miscs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
112
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
271 if (parseError.error != QJsonParseError::NoError) {
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
272 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
273 } else if (miscs.isArray()) {
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
274 for (int i = 0; i < miscs.array().size(); i++) {
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
275 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
276 //qDebug() << i << obj;
112
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
277 Miscs m;
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
278 m.m_name = obj["m_name"].toString();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
279 m.m_amount = obj["m_amount"].toDouble();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
280 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
281 m.m_use_use = obj["m_use_use"].toInt();
112
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
282 m.m_time = obj["m_time"].toDouble();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
283 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
284 m.m_cost = obj["m_cost"].toDouble();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
285 recipe->miscs.append(m);
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
286 }
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
287 qDebug() << "miscs" << recipe->miscs.size();
9e0dfa78f349 Load miscs in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
288 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
289 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
290 qDebug() << "empty miscs";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
291 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
292
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
293 const auto& y_json = query.value(87).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
294 if (!y_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
295 const auto& formattedJson = QString("%1").arg(y_json);
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
296 QJsonDocument yeasts = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
297 if (parseError.error != QJsonParseError::NoError) {
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
298 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
299 } else if (yeasts.isArray()) {
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
300 for (int i = 0; i < yeasts.array().size(); i++) {
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
301 QJsonObject obj = yeasts.array().at(i).toObject();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
302 qDebug() << i << obj;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
303 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
304 /* 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
305 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
306 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
307 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
308 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
309 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
310 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
311 /* Now get what we have got */
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
312 y.y_name = obj["y_name"].toString();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
313 y.y_laboratory = obj["y_laboratory"].toString();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
314 y.y_product_id = obj["y_product_id"].toString();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
315 y.y_amount = obj["y_amount"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
316 y.y_type = obj["y_type"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
317 y.y_form = obj["y_form"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
318 y.y_min_temperature = obj["y_min_temperature"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
319 y.y_max_temperature = obj["y_max_temperature"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
320 y.y_flocculation = obj["y_flocculation"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
321 y.y_attenuation = obj["y_attenuation"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
322 y.y_cells = obj["y_cells"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
323 y.y_tolerance = obj["y_tolerance"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
324 y.y_inventory = obj["y_inventory"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
325 y.y_use = obj["y_use"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
326 y.y_sta1 = obj["y_sta1"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
327 y.y_bacteria = obj["y_bacteria"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
328 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
329 y.y_harvest_time = obj["y_harvest_time"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
330 y.y_pitch_temperature = obj["y_pitch_temperature"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
331 y.y_pofpos = obj["y_pofpos"].toInt() ? true:false;
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
332 y.y_zymocide = obj["y_zymocide"].toInt();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
333 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
334 y.y_sg_lo = obj["y_sg_lo"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
335 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
336 y.y_sg_hi = obj["y_sg_hi"].toDouble();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
337 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
338
141
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
339 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
340 /*
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
341 * 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
342 */
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
343 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
344 "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
345 "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
346 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
347 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
348 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
349 query.exec();
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
350 if (query.first()) {
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
351 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
352 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
353 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
354 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
355 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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 } else {
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
365 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
366 }
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
367 }
111
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
368 recipe->yeasts.append(y);
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
369 }
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
370 qDebug() << "yeasts" << recipe->yeasts.size();
04f5a7c5a1dc Load yeasts in QList.
Michiel Broek <mbroek@mbse.eu>
parents: 110
diff changeset
371 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
372 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
373 qDebug() << "empty yeasts";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
374 }
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
375
141
eea8a9e7e1f6 Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
376 qDebug() << query.value(88).toString();
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
377 const auto& ma_json = query.value(88).toString();
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
378 if (!ma_json.trimmed().isEmpty()) {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
379 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
380 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
381 if (parseError.error != QJsonParseError::NoError) {
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
382 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
383 } 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
384 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
385 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
386 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
387 Mashs m;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
388 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
389 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
390 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
391 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
392 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
393 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
394 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
395 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
396 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
397 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
398 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
399 }
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
400 }
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
401 } else {
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
402 qDebug() << "empty mashs";
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
403 }
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
404 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
405
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
406 } 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
407 /* 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
408 recipe->locked = false;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
409 recipe->st_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
410 recipe->st_letter = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
411 recipe->st_guide = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
412 recipe->st_category = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 recipe->name = "";
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
422 recipe->notes = "";
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
423 recipe->efficiency = 75;
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
424 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
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 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
435 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
436 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
437 recipe->mash_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
438 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
439 recipe->w1_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
440 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
441 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
442 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
443 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
444 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
445 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
446 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
447 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
448 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
449 recipe->w2_name = "";
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 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
470 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
471 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
472 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
473 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
474 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
475 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
476 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
477 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478
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
479 // Tab generic.
109
1ce50e72a6b1 Completed read MySQL recipe record. Mash schedule moved to recipe QList.
Michiel Broek <mbroek@mbse.eu>
parents: 108
diff changeset
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 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
498 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
499 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
500 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
501 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
502 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
503 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
504 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
505 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
506 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
507 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
508 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
509 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
510 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525 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
526 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
527
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
528 // 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
529 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
530 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
531 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
532
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 // 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
534 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
535
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 // 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
537 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
538 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
539 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
540
144
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
541 // Tab mashs.
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
542 ui->mash_nameEdit->setText(recipe->mash_name);
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
543
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
544 // 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
545 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
546 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
547 /*
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 * 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
549 */
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 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
551 } 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
552 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
553 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
554 /*
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 * 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
556 */
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.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
558 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
559 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
560 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
561 }
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 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
563 /*
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 * 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
565 */
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 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
567 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
568 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
569 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
570 }
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 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
572 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
573 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
574 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
575 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
576 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
577 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
578 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
579 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
580 } 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
581 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
582 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
583 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
584 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
585 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
586 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
587 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
588 }
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 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
591 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
592 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
593 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
594 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
595 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
596 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
597 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
598 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
599
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 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
601 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
602 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
603 } 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
604 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
605 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
606 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
607 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
608 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
609 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
610 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
611 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
612 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
613 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
614 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
615 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
616 } 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
617 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
618 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
619 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
620 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
621 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
622 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
623 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
624 }
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
625 }
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
626 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
627 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
628 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
629 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
630 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
631 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
632 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
633 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
634 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
635 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
636 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
637 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
638 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
639 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
640
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
641 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
642 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
643 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
644 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
645 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
646 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
647 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
648
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
649 // 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
650 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
651 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
652 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
653 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
654 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
655 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
656 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
657 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
658 connect(ui->est_ogEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed);
102
b017001850df Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
659 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
660 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
661
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
662 // 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
663 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
664 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
665 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
666 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
667 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
668 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
669 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
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 "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
672 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
673 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
674 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
675 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
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 "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
678 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
679 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
680
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
681 // 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
682 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
683 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
684
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
685 // All signals from tab "Mash"
144
c4b107bf153a First setup of the mash tab with the table.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
686 ui->mashsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
145
fd4f0de86fd9 Implemented most parts of the mash editor.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
687 connect(ui->addMash, SIGNAL(clicked()), this, SLOT(addMashRow_clicked()));
147
af1386a6ece7 Added mash table replace
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
688 connect(ui->mash_pickEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::mash_select_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
689
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
690 // 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
691 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
692 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
693 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
694 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
695 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
696 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
697 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
698 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
699 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
700 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
701 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
702 connect(ui->wt_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::wt_target_changed);
149
d73719fa2ebb Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
703 connect(ui->w1_nameEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::w1_name_changed);
d73719fa2ebb Implemented choose main and dillution waters. Implement change dillution water volume.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
704 connect(ui->w2_nameEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::w2_name_changed);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
705 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
706
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
707 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
708 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
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 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
711 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
712
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 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
715 {
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
716 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
717 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
718 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
719 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
720 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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
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
723 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
724 {
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
725 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
726 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
727 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
728 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
729 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
730 refreshYeasts();
142
1caa15a0eefc Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
731 calcYeast();
148
ba25a566b100 Added calcMash(). Display total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
732 calcMash();
125
2e79e0975e58 Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
733 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
734 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
735 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
736 }
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
737
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
738
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
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 * 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
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::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
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 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
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 (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
747 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
748 } 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
749 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
750 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 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
753 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
754 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 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
756 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
759 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
760 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 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
762
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 /* 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
764 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
765 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
766 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
767 }
114
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
768 if (ui->st_nameEdit->text().length() < 2) {
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
769 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
770 return;
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
771 }
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
772
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 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
774 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
775 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
776 "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
777 "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
778 "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
779 "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
780 "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
781 "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
782 "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
783 "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
784 "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
785 "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
786 "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
787 "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
788 "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
789 "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
790 "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
791 "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
792 "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
793 "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
794 "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
795 "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
796 "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
797 "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
798 "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
799 "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
800 "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
801 } 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
802 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
803 "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
804 "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
805 "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
806 "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
807 "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
808 "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
809 "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
810 "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
811 "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
812 "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
813 "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
814 "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
815 "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
816 "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
817 "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
818 "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
819 "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
820 "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
821 "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
822 "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
823 "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
824 "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
825 "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
826 "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
827 "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
828 }
114
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
829 query.bindValue(":locked", recipe->locked ? 1:0);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
830 query.bindValue(":st_name", recipe->st_name);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
831 query.bindValue(":st_letter", recipe->st_letter);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
832 query.bindValue(":st_guide", recipe->st_guide);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
833 query.bindValue(":st_category", recipe->st_category);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
834 query.bindValue(":st_catnr", recipe->st_category_number);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
835 query.bindValue(":st_type", recipe->st_type);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
836 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
837 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
838 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
839 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
840 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
841 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
842 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
843 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
844 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
845 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
846 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
847 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
848 query.bindValue(":name", recipe->name);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
849 query.bindValue(":notes", recipe->notes);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
850 query.bindValue(":type", recipe->type);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
851 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
852 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
853 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
854 query.bindValue(":efficiency", round(recipe->efficiency * 10) / 10);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
855 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
856 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
857 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
858 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
859 query.bindValue(":color_method", recipe->color_method);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
860 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
861 query.bindValue(":ibu_method", recipe->ibu_method);
b027aa2a01d4 Code cleanup after last changes.
Michiel Broek <mbroek@mbse.eu>
parents: 113
diff changeset
862 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
863 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
864 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
865 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
866 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
867 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
868 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
869 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
870 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
871 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
872 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
873 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
874 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
875 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
876 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
877 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
878 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
879 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
880 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
881 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
882 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
883 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
884 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
885 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
886 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
887 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
888 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
889 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
890 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
891 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
892 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
893 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
894 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
895 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
896 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
897 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
898 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
899 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
900 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
901 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
902 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
903 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
904 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
905 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
906 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
907 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
908 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
909 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
910 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
911
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
912 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
913 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
914 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
915 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
916 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
917 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
918 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
919 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
920 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
921 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
922 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
923 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
924 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
925 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
926 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
927 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
928 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
929 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
930 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
931 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
932 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
933 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
934 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
935 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
936 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
937 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
938 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
939 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
940 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
941 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
942 }
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
943 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
944 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
945 // 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
946 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
947 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
948
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
949 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
950 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
951 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
952 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
953 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
954 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
955 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
956 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
957 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
958 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
959 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
960 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
961 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
962 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
963 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
964 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
965 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
966 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
967 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
968 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
969 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
970 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
971 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
972 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
973 }
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
974 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
975 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
976 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
977 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
978
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
979 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
980 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
981 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
982 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
983 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
984 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
985 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
986 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
987 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
988 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
989 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
990 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
991 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
992 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
993 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
994 }
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
995 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
996 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
997 // 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
998 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
999 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1000
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1001 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
1002 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
1003 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1004 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1005 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
1006 QJsonObject obj;
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_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
1008 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
1009 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
1010 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
1011 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
1012 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
1013 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
1014 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
1015 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
1016 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
1017 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
1018 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
1019 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
1020 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
1021 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
1022 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
1023 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
1024 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
1025 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
1026 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
1027 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
1028 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
1029 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
1030 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
1031 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
1032 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
1033 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
1034 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
1035 }
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
1036 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
1037 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
1038 // 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
1039 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
1040 }
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1041
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1042 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
1043 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
1044 } else {
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1045 QJsonArray array;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1046 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
1047 QJsonObject obj;
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1048 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
1049 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
1050 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
1051 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
1052 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
1053 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
1054 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
1055 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
1056 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
1057 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
1058 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
1059 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
1060 }
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
1061 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
1062 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
1063 // 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
1064 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
1065 }
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
1066
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
1067 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
1068 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
1069 } 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
1070 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
1071 }
115
9c90a00fd9dd Completed recipe save record. Recipe name and notes can be edited.
Michiel Broek <mbroek@mbse.eu>
parents: 114
diff changeset
1072 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
1073 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
1074 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
1075 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
1076 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
1077 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
1078 .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
1079 .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
1080 .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
1081 } 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
1082 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
1083 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 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
1087 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
1088 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
1089 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1092 #include "EditRecipeTab1.cpp"
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1093 #include "EditRecipeTab2.cpp"
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1094 #include "EditRecipeTab3.cpp"
128
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1095 #include "EditRecipeTab4.cpp"
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1096 #include "EditRecipeTab5.cpp"
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1097 #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
1098 #include "EditRecipeTab7.cpp"
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1099
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1100
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
1101 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
1102 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 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
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 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
1106 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
1107 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
1108 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
1109 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
1110 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
1111 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
1112 .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
1113 .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
1114 .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
1115 } 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
1116 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
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
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1119 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
1120 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
1121 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 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
1125 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 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
1127 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
1128 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
1129 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
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
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet 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 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
1134 {
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1135 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
1136 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
1137 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
1138 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
1139 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
1140 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
1141 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
1142 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
1143 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
1144 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
1145 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
1146 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1147 }
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1148
fb0bb9a2a7e1 Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1149 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
1150 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
1151 }

mercurial