Sun, 03 Apr 2022 22:02:12 +0200
Experiment with checkboxes in the fermentable table.
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * EditRecipe.cpp is part of bmsapp. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #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
|
18 | #include "../ui/ui_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 "MainWindow.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" |
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
|
21 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
24 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
26 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | qDebug() << "EditRecipe record:" << 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
|
28 | ui->setupUi(this); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
30 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
32 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | 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
|
34 | 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
|
35 | 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
|
36 | |
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
|
37 | 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
|
38 | 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
|
39 | 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
|
40 | 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
|
41 | 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
|
42 | |
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
|
43 | 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
|
44 | 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
|
45 | 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
|
46 | |
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
|
47 | 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
|
48 | 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
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | 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
|
53 | 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
|
54 | } |
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
|
55 | |
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
|
56 | 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
|
57 | 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
|
58 | 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
|
59 | 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
|
60 | 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
|
61 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | ui->lockedEdit->setChecked(query.value(2).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
|
63 | ui->st_nameEdit->setText(query.value(3).toString()); |
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
|
64 | ui->st_groupEdit->setText(query.value(4).toString()); |
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
|
65 | ui->st_guideEdit->setText(query.value(5).toString()); |
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
|
66 | ui->st_catEdit->setText(query.value(6).toString()); |
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
|
67 | ui->st_catnrEdit->setText(query.value(7).toString()); |
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
|
68 | ui->st_typeEdit->setText(s_types[query.value(8).toInt()]); |
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
|
69 | |
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
|
70 | ui->nameEdit->setText(query.value(21).toString()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | ui->notesEdit->setPlainText(query.value(22).toString()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | ui->typeEdit->setCurrentIndex(query.value(23).toInt()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | ui->batch_sizeEdit->setValue(query.value(24).toDouble()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | ui->boil_sizeEdit->setValue(query.value(25).toDouble()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | ui->boil_timeEdit->setValue(query.value(26).toInt()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | ui->efficiencyEdit->setValue(query.value(27).toDouble()); |
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
|
77 | |
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
|
78 | ui->est_ogEdit->setValue(query.value(28).toDouble()); |
101
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
79 | ui->est_og2Edit->setValue(query.value(28).toDouble()); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
80 | ui->est_og3Edit->setValue(query.value(28).toDouble()); |
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
|
81 | ui->est_ogShow->setRange(query.value(9).toDouble(), query.value(10).toDouble()); |
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
|
82 | ui->est_ogShow->setPrecision(3); |
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
|
83 | ui->est_ogShow->setMarkerTextIsValue(true); |
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
|
84 | ui->est_ogShow->setValue(query.value(28).toDouble()); |
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
|
85 | |
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
|
86 | ui->est_fgEdit->setValue(query.value(29).toDouble()); |
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
|
87 | ui->est_fg3Edit->setValue(query.value(29).toDouble()); |
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
|
88 | ui->est_fgShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
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
|
89 | ui->est_fgShow->setPrecision(3); |
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
|
90 | ui->est_fgShow->setMarkerTextIsValue(true); |
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
|
91 | ui->est_fgShow->setValue(query.value(29).toDouble()); |
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
|
92 | |
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
|
93 | ui->est_abvEdit->setValue(query.value(30).toDouble()); |
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
|
94 | ui->est_abv2Edit->setValue(query.value(30).toDouble()); |
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
|
95 | ui->est_abvShow->setRange(query.value(19).toDouble(), query.value(20).toDouble()); |
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
|
96 | ui->est_abvShow->setPrecision(1); |
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
|
97 | ui->est_abvShow->setMarkerTextIsValue(true); |
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
|
98 | ui->est_abvShow->setValue(query.value(30).toDouble()); |
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
|
99 | |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
100 | //QColor color = Utils::ebc_to_color(query.value(31).toInt()); |
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
|
101 | ui->est_colorEdit->setValue(query.value(31).toDouble()); |
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
|
102 | ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(query.value(31).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
|
103 | ui->est_color2Edit->setValue(query.value(31).toDouble()); |
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
|
104 | ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(query.value(31).toInt())); |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
105 | ui->est_colorShow->setPrecision(0); |
99
053c0578cf58
CMakeLists.txt cleanup. Removed partial BeerColor plugin, it was ugly and takes too much space. A bit of RanedSlider code cleanup. Most widgets for the first tab in the recipe editor placed.
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
106 | ui->est_colorShow->setMarkerTextIsValue(true); |
96
c36fef8bb088
Removed the ugly green value text from the ranged slider.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
107 | ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
c36fef8bb088
Removed the ugly green value text from the ranged slider.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
108 | ui->est_colorShow->setValue(query.value(31).toDouble()); |
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
|
109 | |
96
c36fef8bb088
Removed the ugly green value text from the ranged slider.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
110 | ui->color_methodEdit->setCurrentIndex(query.value(32).toInt()); |
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
|
111 | |
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
|
112 | ui->est_ibuEdit->setValue(query.value(33).toDouble()); |
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
|
113 | ui->est_ibu2Edit->setValue(query.value(33).toDouble()); |
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
|
114 | ui->est_ibuShow->setPrecision(0); |
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
|
115 | ui->est_ibuShow->setMarkerTextIsValue(true); |
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
|
116 | ui->est_ibuShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
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
|
117 | ui->est_ibuShow->setValue(query.value(33).toDouble()); |
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
|
118 | |
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
|
119 | ui->ibu_methodEdit->setCurrentIndex(query.value(34).toInt()); |
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
|
120 | |
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
|
121 | ui->est_carbEdit->setValue(query.value(35).toDouble()); |
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
|
122 | ui->est_carbShow->setPrecision(1); |
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
|
123 | ui->est_carbShow->setMarkerTextIsValue(true); |
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
|
124 | ui->est_carbShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); |
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
|
125 | ui->est_carbShow->setValue(query.value(35).toDouble()); |
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
|
126 | |
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
|
127 | // 36 sparge_temp |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | // 37 sparge_ph |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | // 38 sparge_volume |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | // 39 sparge_source |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | // 40 sparge_acid_type |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | // 41 sparge_acid_perc |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | // 42 sparge_acid_amount |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | // 43 mash_ph |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | // 44 mash_name |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | // 45 calc_acid |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | // 46 w1_name |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | // 47 w1_amount |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | // 48 w1_calcium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | // 49 w1_sulfate |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | // 50 w1_chloride |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | // 51 w1_sodium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | // 52 w1_magnesium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | // 53 w1_total_alkalinity |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | // 54 w1_ph |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | // 55 w1_cost |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | // 56 w2_name |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | // 57 w2_amount |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | // 58 w2_calcium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | // 59 w2_sulfate |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | // 60 w2_chloride |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | // 61 w2_sodium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | // 62 w2_magnesium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | // 63 w2_total_alkalinity |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | // 64 w2_ph |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | // 65 w2_cost |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | // 66 wg_amount |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | // 67 wg_calcium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | // 68 wg_sulfate |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | // 69 wg_chloride |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | // 70 wg_sodium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | // 71 wg_magnesium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | // 72 wg_total_alkalinity |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
164 | // 73 wg_ph |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | // 74 wb_calcium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | // 75 wb_sulfate |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | // 76 wb_chloride |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | // 77 wb_sodium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | // 78 wb_magnesium |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | // 79 wb_total_alkalinity |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | // 80 wb_ph |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | // 81 wa_acid_name |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | // 82 wa_acid_perc |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | // 83 wa_base_name |
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
|
175 | |
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
|
176 | |
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
|
177 | QJsonParseError parseError; |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
178 | const auto& f_json = query.value(84).toString(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
179 | if (!f_json.trimmed().isEmpty()) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
180 | const auto& formattedJson = QString("%1").arg(f_json); |
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
|
181 | this->fermentables = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
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
|
182 | if (parseError.error != QJsonParseError::NoError) |
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
|
183 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
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
|
184 | } 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
|
185 | 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
|
186 | } |
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 | |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
188 | const auto& h_json = query.value(85).toString(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
189 | if (!h_json.trimmed().isEmpty()) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
190 | const auto& formattedJson = QString("%1").arg(h_json); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
191 | this->hops = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
192 | if (parseError.error != QJsonParseError::NoError) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
193 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
194 | } else { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
195 | qDebug() << "empty hops"; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
196 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
197 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
198 | const auto& m_json = query.value(86).toString(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
199 | if (!m_json.trimmed().isEmpty()) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
200 | const auto& formattedJson = QString("%1").arg(m_json); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
201 | this->miscs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
202 | if (parseError.error != QJsonParseError::NoError) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
203 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
204 | } else { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
205 | qDebug() << "empty miscs"; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
206 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
207 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
208 | const auto& y_json = query.value(87).toString(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
209 | if (!y_json.trimmed().isEmpty()) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
210 | const auto& formattedJson = QString("%1").arg(y_json); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
211 | this->yeasts = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
212 | if (parseError.error != QJsonParseError::NoError) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
213 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
214 | } else { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
215 | qDebug() << "empty yeasts"; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
216 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
217 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
218 | const auto& ma_json = query.value(88).toString(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
219 | if (!ma_json.trimmed().isEmpty()) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
220 | const auto& formattedJson = QString("%1").arg(ma_json); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
221 | this->mashs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
222 | if (parseError.error != QJsonParseError::NoError) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
223 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
224 | } else { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
225 | qDebug() << "empty mashs"; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
226 | } |
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
|
227 | } 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
|
228 | /* Set some defaults */ |
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
|
229 | |
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 | const auto& formattedJson = QString("[]"); |
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 | this->fermentables = QJsonDocument::fromJson(formattedJson.toUtf8()); |
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
|
232 | this->hops = QJsonDocument::fromJson(formattedJson.toUtf8()); |
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
|
233 | this->miscs = QJsonDocument::fromJson(formattedJson.toUtf8()); |
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
|
234 | this->yeasts = QJsonDocument::fromJson(formattedJson.toUtf8()); |
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
|
235 | this->mashs = QJsonDocument::fromJson(formattedJson.toUtf8()); |
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
|
236 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
237 | |
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
|
238 | // 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
|
239 | connect(ui->lockedEdit, &QCheckBox::stateChanged, 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
|
240 | connect(ui->nameEdit, &QLineEdit::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
|
241 | connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(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
|
242 | 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
|
243 | 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
|
244 | 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
|
245 | 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
|
246 | 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
|
247 | connect(ui->est_ogEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
248 | 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
|
249 | 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
|
250 | |
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
|
251 | // All signals from tab "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
|
252 | connect(ui->est_og2Edit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
253 | connect(ui->perc_mashShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_mash_valueChanged); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
254 | connect(ui->perc_sugarsShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_sugars_valueChanged); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
255 | connect(ui->perc_caraShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_cara_valueChanged); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
256 | connect(ui->lintnerShow, &QProgressBar::valueChanged, this, &EditRecipe::on_lintner_valueChanged); |
103
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
257 | connect(ui->fermentablesTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Fermentable_changed(int, int))); |
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
|
258 | |
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
|
259 | // All signals from tab "Hops" |
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
|
260 | // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
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
|
261 | |
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
|
262 | // All signals from tab "Miscs" |
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
|
263 | // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
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
|
264 | |
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
|
265 | // All signals from tab "Yeasts" |
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
|
266 | // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
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
|
267 | |
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
|
268 | // All signals from tab "Mash" |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
269 | // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
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
|
270 | |
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
|
271 | // All signals from tab "Water" |
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
|
272 | |
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
|
273 | 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
|
274 | 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
|
275 | |
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
|
276 | 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
|
277 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
279 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
280 | 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
|
281 | { |
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
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | 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
|
286 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
287 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
288 | |
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
|
289 | void EditRecipe::refreshFermentables() |
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
|
290 | { |
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
|
291 | QString w; |
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
|
292 | QWidget* pWidget; |
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
|
293 | QHBoxLayout* pLayout; |
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
|
294 | QTableWidgetItem *item; |
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
|
295 | QLabel *label; |
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
|
296 | double d; |
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
|
297 | int j; |
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
|
298 | int total = 0; |
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
|
299 | |
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
|
300 | qDebug() << "refreshFermentables" << this->fermentables << this->fermentables.isArray() << this->fermentables.array().size(); |
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
|
301 | /* During filling the table turn off the cellChanged signal because every cell that is filled |
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
|
302 | * triggers the cellChanged signal. The QTableWidget has no better signal to use. */ |
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
|
303 | this->ignoreChanges = true; |
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
|
304 | |
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
|
305 | const QStringList labels({tr("Fermentable"), tr("EBC"), tr("Type"), tr("Graintype"), tr("When"), tr("Yield"), tr("Amount"), tr("Procent"), tr("100%"), tr("Button")}); |
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
|
306 | ui->fermentablesTable->setColumnCount(10); |
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
|
307 | ui->fermentablesTable->setColumnWidth(0, 350); /* Fermentable */ |
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
|
308 | ui->fermentablesTable->setColumnWidth(1, 50); /* Color */ |
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
|
309 | ui->fermentablesTable->setColumnWidth(2, 75); /* Type */ |
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
|
310 | ui->fermentablesTable->setColumnWidth(3, 75); /* Graintype */ |
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
|
311 | ui->fermentablesTable->setColumnWidth(4, 75); /* Added */ |
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
|
312 | ui->fermentablesTable->setColumnWidth(5, 75); /* Yield */ |
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
|
313 | ui->fermentablesTable->setColumnWidth(6, 75); /* Amount */ |
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
|
314 | ui->fermentablesTable->setColumnWidth(7, 60); /* Procent */ |
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
|
315 | ui->fermentablesTable->setColumnWidth(8, 50); /* 100% */ |
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
|
316 | ui->fermentablesTable->setColumnWidth(9, 80); /* Button */ |
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
|
317 | ui->fermentablesTable->setHorizontalHeaderLabels(labels); |
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
|
318 | ui->fermentablesTable->verticalHeader()->hide(); |
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
|
319 | ui->fermentablesTable->setRowCount(this->fermentables.array().size()); |
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
|
320 | |
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
|
321 | if (this->fermentables.isArray()) { |
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
|
322 | for (int i = 0; i < this->fermentables.array().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
|
323 | QJsonObject obj = this->fermentables.array().at(i).toObject(); |
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
|
324 | |
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
|
325 | w = obj["f_supplier"].toString()+" / "+obj["f_name"].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
|
326 | ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(w)); |
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
|
327 | |
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
|
328 | if (obj["f_color"].isString()) |
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
|
329 | d = QString(obj["f_color"].toString()).toDouble(); |
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
|
330 | 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
|
331 | d = obj["f_color"].toDouble(); |
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
|
332 | w = QString("%1").arg(d, 1, 'f', 0, '0'); |
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
|
333 | item = new QTableWidgetItem(w); |
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
|
334 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
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
|
335 | ui->fermentablesTable->setItem(i, 1, item); |
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
|
336 | |
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
|
337 | if (obj["f_type"].isString()) |
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
|
338 | j = QString(obj["f_type"].toString()).toInt(); |
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
|
339 | 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
|
340 | j = obj["f_type"].toInt(); |
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
|
341 | item = new QTableWidgetItem(f_types[j]); |
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
|
342 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
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
|
343 | ui->fermentablesTable->setItem(i, 2, item); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
344 | |
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
|
345 | if (obj["f_graintype"].isString()) |
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
|
346 | j = QString(obj["f_graintype"].toString()).toInt(); |
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
|
347 | 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
|
348 | j = obj["f_graintype"].toInt(); |
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
|
349 | item = new QTableWidgetItem(f_graintypes[j]); |
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
|
350 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
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
|
351 | ui->fermentablesTable->setItem(i, 3, item); |
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
|
352 | |
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
|
353 | if (obj["f_added"].isString()) |
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
|
354 | j = QString(obj["f_added"].toString()).toInt(); |
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
|
355 | 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
|
356 | j = obj["f_added"].toInt(); |
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
|
357 | item = new QTableWidgetItem(f_added[j]); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
358 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
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
|
359 | ui->fermentablesTable->setItem(i, 4, item); |
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
|
360 | |
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
|
361 | if (obj["f_yield"].isString()) |
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
|
362 | d = QString(obj["f_yield"].toString()).toDouble(); |
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
|
363 | 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
|
364 | d = obj["f_yield"].toDouble(); |
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
|
365 | w = QString("%1%").arg(d, 2, 'f', 1, '0'); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
366 | item = new QTableWidgetItem(w); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
367 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
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
|
368 | ui->fermentablesTable->setItem(i, 5, item); |
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
|
369 | |
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
|
370 | if (obj["f_amount"].isString()) |
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
|
371 | d = QString(obj["f_amount"].toString()).toDouble(); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
372 | 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
|
373 | d = obj["f_amount"].toDouble(); |
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
|
374 | w = QString("%1 Kg").arg(d, 4, 'f', 3, '0'); |
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
|
375 | item = new QTableWidgetItem(w); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
376 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
377 | ui->fermentablesTable->setItem(i, 6, item); |
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
|
378 | |
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
|
379 | if (obj["f_percentage"].isString()) |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
380 | d = QString(obj["f_percentage"].toString()).toDouble(); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
381 | 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
|
382 | d = obj["f_percentage"].toDouble(); |
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
|
383 | w = QString("%1%").arg(d, 2, 'f', 1, '0'); |
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
|
384 | item = new QTableWidgetItem(w); |
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
|
385 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
386 | ui->fermentablesTable->setItem(i, 7, item); |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
387 | |
103
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
388 | QTableWidgetItem *checkBoxItem = new QTableWidgetItem(); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
389 | checkBoxItem->setCheckState((obj["f_adjust_to_total_100"].toInt()) ? Qt::Checked : Qt::Unchecked); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
390 | checkBoxItem->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
391 | ui->fermentablesTable->setItem(i, 8, checkBoxItem); |
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
|
392 | |
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
|
393 | /* Add the Delete row button */ |
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
|
394 | pWidget = new QWidget(); |
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
|
395 | QPushButton* btn_edit = new QPushButton(); |
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
|
396 | btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
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
|
397 | btn_edit->setText(tr("Delete")); |
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
|
398 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_deleteFermentRow_clicked())); |
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
|
399 | pLayout = new QHBoxLayout(pWidget); |
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
|
400 | pLayout->addWidget(btn_edit); |
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
|
401 | pLayout->setContentsMargins(5, 0, 5, 0); |
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
|
402 | pWidget->setLayout(pLayout); |
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
|
403 | ui->fermentablesTable->setCellWidget(i, 9, pWidget); |
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
|
404 | } |
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
|
405 | } |
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
|
406 | |
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
|
407 | this->ignoreChanges = false; |
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
|
408 | } |
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
|
409 | |
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
|
410 | |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
411 | void EditRecipe::refreshHops() |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
412 | { |
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
|
413 | } |
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
|
414 | |
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
|
415 | |
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
|
416 | void EditRecipe::refreshMiscs() |
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
|
417 | { |
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
|
418 | } |
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
|
419 | |
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
|
420 | |
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
|
421 | void EditRecipe::refreshYeasts() |
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
|
422 | { |
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
|
423 | } |
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
|
424 | |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
425 | |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
426 | void EditRecipe::refreshMashs() |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
427 | { |
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
|
428 | } |
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
|
429 | |
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
|
430 | |
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
|
431 | 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
|
432 | { |
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
|
433 | refreshFermentables(); |
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
|
434 | |
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
|
435 | calcFermentables(); |
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
|
436 | } |
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
|
437 | |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
438 | |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
439 | void EditRecipe::calcFermentables() |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
440 | { |
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
|
441 | int 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
|
442 | bool my_100 = false; |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
443 | double psugar = 0, pcara = 0, d, s = 0, x, color; |
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
|
444 | double vol = 0; // Volume sugars after boil |
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
|
445 | double addedS = 0; // Added sugars after boil |
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
|
446 | double addedmass = 0; // Added mass after boil |
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
|
447 | double mvol = 0; // Mash volume |
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
|
448 | double lintner = 0; // Total recipe lintner |
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
|
449 | double mashkg = 0; |
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
|
450 | double sugarsf = 0; // fermentable sugars mash + boil |
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
|
451 | double sugarsm = 0; // fermentable sugars in mash |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
452 | double sugardensity = 1.611; // kg/l in solution |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
453 | double mashtime = 0; // Total mash time |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
454 | double mashtemp = 0; // Average mash temperature |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
455 | double mashinfuse = 0; // Mash infuse amount |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
456 | double colort = 0; // Colors srm * vol totals |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
457 | double colorh = 0; // Colors ebc * vol * kt |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
458 | double colorn = 0; // Colors ebc * pt * pct |
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
|
459 | QJsonObject obj; |
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
|
460 | |
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
|
461 | qDebug() << "calcFermentables()"; |
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
|
462 | |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
463 | /* |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
464 | * Get average mashtemp and mashtime from the Mash schedule. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
465 | * It is possible that the schedule is not (yet) present. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
466 | */ |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
467 | if (this->mashs.array().size() > 0) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
468 | for (i = 0; i < this->mashs.array().size(); i++) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
469 | obj = this->mashs.array().at(i).toObject(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
470 | if (obj["step_type"].toInt() == 0) // Infusion |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
471 | mashinfuse += obj["step_infuse_amount"].toDouble(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
472 | if (obj["step_temp"].toDouble() < 75) { // Ignore mashout |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
473 | mashtime += obj["step_time"].toDouble(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
474 | mashtemp += obj["step_time"].toDouble() * obj["step_temp"].toDouble(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
475 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
476 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
477 | mashtemp = mashtemp / mashtime; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
478 | mvol = mashinfuse; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
479 | qDebug() << " mash time" << mashtime << "temp" << mashtemp << "infuse" << mashinfuse; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
480 | } else { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
481 | qDebug() << " no mash schedule"; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
482 | } |
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
|
483 | |
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
|
484 | if (this->fermentables.array().size() < 1) { |
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
|
485 | qDebug() << " no fermentables, return."; |
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
|
486 | return; |
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
|
487 | } |
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
|
488 | |
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
|
489 | for (i = 0; i < this->fermentables.array().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
|
490 | obj = this->fermentables.array().at(i).toObject(); |
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
|
491 | if (obj["f_adjust_to_total_100"].toInt()) { |
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
|
492 | my_100 = true; |
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
|
493 | } |
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
|
494 | if (obj["f_type"].toInt() == 1 && obj["f_added"].toInt() < 4) // Sugars |
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
|
495 | psugar += obj["f_percentage"].toDouble(); |
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
|
496 | if (obj["f_graintype"].toInt() == 2 && obj["f_added"].toInt() < 4) // Crystal/Cara |
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
|
497 | pcara += obj["f_percentage"].toDouble(); |
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
|
498 | d = obj["f_amount"].toDouble() * (obj["f_yield"].toDouble() / 100) * (1 - obj["f_moisture"].toDouble() / 100); |
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
|
499 | if (obj["f_added"].toInt() == 0) { // Mash |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
500 | if (mvol > 0) { // If mash volume is known |
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
|
501 | mvol += obj["f_amount"].toDouble() * obj["f_moisture"].toDouble() / 100; |
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
|
502 | s += d; |
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
|
503 | } |
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
|
504 | d = ui->efficiencyEdit->value() / 100 * d; |
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
|
505 | sugarsm += d; |
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
|
506 | mashkg += obj["f_amount"].toDouble(); |
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
|
507 | } |
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
|
508 | if (obj["f_added"].toInt() == 0 || obj["f_added"].toInt() == 1) // Mash or boil |
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
|
509 | sugarsf += d; |
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
|
510 | if (obj["f_added"].toInt() == 2 || obj["f_added"].toInt() == 3) { // Fermentation or lagering |
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
|
511 | x = (obj["f_yield"].toDouble() / 100) * (1 - obj["f_moisture"].toDouble() / 100); |
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
|
512 | addedS += obj["f_amount"].toDouble() * x; |
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
|
513 | addedmass += obj["f_amount"].toDouble(); |
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
|
514 | vol += (x * sugardensity + (1 - x) * 1) * obj["f_amount"].toDouble(); |
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
|
515 | } |
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
|
516 | if (obj["f_added"].toInt() == 0 && (obj["f_type"].toInt() == 0 || obj["f_type"].toInt() == 4) && obj["f_color"].toDouble() < 50) { |
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
|
517 | lintner += obj["f_diastatic_power"].toDouble() * obj["f_amount"].toDouble(); |
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
|
518 | } |
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
|
519 | if (obj["f_added"].toInt() < 4) { |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
520 | colort += obj["f_amount"].toDouble() * Utils::ebc_to_srm(obj["f_color"].toDouble()); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
521 | colorh += obj["f_amount"].toDouble() * obj["f_color"].toDouble() * Utils::get_kt(obj["f_color"].toDouble()); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
522 | colorn += (obj["f_percentage"].toDouble() / 100) * obj["f_color"].toDouble(); // For 8.6 Pt wort. |
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
|
523 | } |
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
|
524 | } |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
525 | qDebug() << " colort" << colort << "colorh" << colorh << "colorn" << colorn; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
526 | qDebug() << " psugar" << psugar << "pcara" << pcara << "mvol" << mvol; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
527 | qDebug() << " sugarsf" << sugarsf << "sugarsm" << sugarsm; |
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
|
528 | |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
529 | double og = Utils::estimate_sg(sugarsf + addedS, ui->batch_sizeEdit->value()); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
530 | qDebug() << " OG" << ui->est_ogEdit->value() << og; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
531 | ui->est_ogEdit->setValue(og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
532 | ui->est_og2Edit->setValue(og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
533 | ui->est_og3Edit->setValue(og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
534 | ui->est_ogShow->setValue(og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
535 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
536 | double preboil_sg = Utils::estimate_sg(sugarsm, ui->boil_sizeEdit->value()); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
537 | qDebug() << " preboil SG" << preboil_sg; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
538 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
539 | /* |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
540 | * Color of the wort |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
541 | */ |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
542 | if (ui->color_methodEdit->currentIndex() == 4) { // Naudts |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
543 | color = round(((Utils::sg_to_plato(og) / 8.6) * colorn) + (ui->boil_timeEdit->value() / 60)); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
544 | } else if (ui->color_methodEdit->currentIndex() == 3) { // Hans Halberstadt |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
545 | double bv = 0.925; // Beer loss efficiency |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
546 | double sr = 0.95; // Mash and sparge efficiency |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
547 | color = round((4.46 * bv * sr) / ui->batch_sizeEdit->value() * colorh); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
548 | } else { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
549 | double cw = colort / ui->batch_sizeEdit->value() * 8.34436; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
550 | color = Utils::kw_to_ebc(ui->color_methodEdit->currentIndex(), cw); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
551 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
552 | qDebug() << " color" << ui->est_colorEdit->value() << color; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
553 | ui->est_colorEdit->setValue(color); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
554 | ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(color)); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
555 | ui->est_color2Edit->setValue(color); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
556 | ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(color)); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
557 | ui->est_colorShow->setValue(color); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
558 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
559 | /* |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
560 | * We don't have a equipment profile in recipes, |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
561 | * so we assume a certain guessed mashtun size. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
562 | */ |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
563 | ui->perc_mashShow->setValue(round(mashkg / (ui->boil_sizeEdit->value() / 3) * 100)); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
564 | ui->perc_sugarsShow->setValue(round(psugar)); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
565 | ui->perc_caraShow->setValue(round(pcara)); |
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
|
566 | qDebug() << " lintner" << lintner << " mashkg" << mashkg << "final" << round(lintner / mashkg); |
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
|
567 | ui->lintnerShow->setValue(round(lintner / mashkg)); |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
568 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
569 | /* |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
570 | * Calculate the apparant attenuation. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
571 | */ |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
572 | double svg = 0; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
573 | if (this->yeasts.array().size() > 0) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
574 | for (i = 0; i < this->yeasts.array().size(); i++) { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
575 | obj = this->yeasts.array().at(i).toObject(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
576 | if (obj["y_use"].toInt() == 0) { // Used in primary |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
577 | if (obj["y_attenuation"].toDouble() > svg) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
578 | svg = obj["y_attenuation"].toDouble(); // Take the highest if multiple yeasts. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
579 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
580 | // TODO: brett or others in secondary. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
581 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
582 | qDebug() << " SVG" << svg; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
583 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
584 | if (svg == 0) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
585 | svg = 77.0; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
586 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
587 | double fg; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
588 | if (mashkg > 0 && mashinfuse > 0 && mashtime > 0 && mashtemp > 0) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
589 | fg = Utils::estimate_fg(psugar, pcara, mashinfuse / mashkg, mashtime, mashtemp, svg, og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
590 | else |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
591 | fg = Utils::estimate_fg(psugar, pcara, 0, 0, 0, svg, og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
592 | qDebug() << " FG" << ui->est_fgEdit->value() << fg; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
593 | ui->est_fgEdit->setValue(fg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
594 | ui->est_fg3Edit->setValue(fg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
595 | ui->est_fgShow->setValue(fg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
596 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
597 | double abv = Utils::abvol(og, fg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
598 | qDebug() << " ABV" << ui->est_abvEdit->value() << abv; |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
599 | ui->est_abvEdit->setValue(abv); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
600 | ui->est_abv2Edit->setValue(abv); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
601 | ui->est_abvShow->setValue(abv); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
602 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
603 | /* |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
604 | * Calculate kilocalories/liter. Formula from brouwhulp. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
605 | * Take the alcohol and sugar parts and then combine. |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
606 | */ |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
607 | double alc = 1881.22 * fg * (og - fg) / (1.775 - og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
608 | double sug = 3550 * fg * (0.1808 * og + 0.8192 * fg - 1.0004); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
609 | qDebug() << " kcal" << round((alc + sug) / (12 * 0.0295735296)); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
610 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
611 | // If to_100 then make all amount fields t/o and percent fields r/w |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
612 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
613 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
614 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
615 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
616 | void EditRecipe::on_perc_mash_valueChanged(int value) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
617 | { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
618 | if (value < 90) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
619 | ui->perc_mashShow->setStyleSheet(bar_green); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
620 | else if (value < 100) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
621 | ui->perc_mashShow->setStyleSheet(bar_orange); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
622 | else |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
623 | ui->perc_mashShow->setStyleSheet(bar_red); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
624 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
625 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
626 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
627 | void EditRecipe::on_perc_sugars_valueChanged(int value) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
628 | { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
629 | if (value < 20) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
630 | ui->perc_sugarsShow->setStyleSheet(bar_green); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
631 | else |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
632 | ui->perc_sugarsShow->setStyleSheet(bar_red); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
633 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
634 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
635 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
636 | void EditRecipe::on_perc_cara_valueChanged(int value) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
637 | { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
638 | if (value < 25) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
639 | ui->perc_caraShow->setStyleSheet(bar_green); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
640 | else |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
641 | ui->perc_caraShow->setStyleSheet(bar_red); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
642 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
643 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
644 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
645 | void EditRecipe::on_lintner_valueChanged(int value) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
646 | { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
647 | if (value < 30) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
648 | ui->lintnerShow->setStyleSheet(bar_red); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
649 | else if (value < 40) |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
650 | ui->lintnerShow->setStyleSheet(bar_orange); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
651 | else |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
652 | ui->lintnerShow->setStyleSheet(bar_green); |
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
|
653 | } |
1d14d3bf2465
Added change beerstyle, the fermentables table, and first part of calcFermentables to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents:
100
diff
changeset
|
654 | |
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
|
655 | |
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
|
656 | /* |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
657 | * 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
|
658 | */ |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
659 | 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
|
660 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
661 | 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
|
662 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
663 | 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
|
664 | 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
|
665 | } 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
|
666 | 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
|
667 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
668 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
669 | 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
|
670 | 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
|
671 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
672 | 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
|
673 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
674 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
675 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
676 | 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
|
677 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
678 | 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
|
679 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
680 | /* 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
|
681 | 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
|
682 | 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
|
683 | 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
|
684 | } |
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
|
685 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
686 | 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
|
687 | 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
|
688 | query.prepare("INSERT INTO recipes SET name=:name, " |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
689 | "uuid = :uuid"); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
690 | } 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
|
691 | query.prepare("UPDATE recipes SET name=:name " |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
692 | " 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
|
693 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
694 | //query.bindValue(":name", ui->nameEdit->text()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
695 | //query.bindValue(":notes", ui->notesEdit->toPlainText()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
696 | 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
|
697 | 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
|
698 | } 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
|
699 | 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
|
700 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
701 | 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
|
702 | 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
|
703 | 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
|
704 | 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
|
705 | 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
|
706 | .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
|
707 | .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
|
708 | .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
|
709 | } 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
|
710 | 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
|
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 | 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
|
715 | 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
|
716 | 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
|
717 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
719 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
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 | 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
|
723 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
724 | 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
|
725 | 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
|
726 | 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
|
727 | 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
|
728 | 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
|
729 | 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
|
730 | 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
|
731 | .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
|
732 | .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
|
733 | .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
|
734 | } 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
|
735 | 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
|
736 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
737 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
738 | 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
|
739 | 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
|
740 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
741 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
742 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
744 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | 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
|
746 | 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
|
747 | 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
|
748 | 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
|
749 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet 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 | |
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
|
752 | /* |
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
|
753 | * New beerstyle is selected. |
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
|
754 | */ |
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
|
755 | void 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
|
756 | { |
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
|
757 | QSqlQuery query; |
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
|
758 | |
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
|
759 | if (ui->beerstyleEdit->currentIndex() < 1) |
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
|
760 | return; |
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
|
761 | |
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
|
762 | query.prepare("SELECT * 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
|
763 | 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
|
764 | 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
|
765 | // Skip to the record index. |
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
|
766 | for (int i = 0; i < (ui->beerstyleEdit->currentIndex() - 1); 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
|
767 | 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
|
768 | } |
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
|
769 | // Set relevant fields and update ranges. |
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
|
770 | ui->st_nameEdit->setText(query.value(1).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
|
771 | ui->st_catEdit->setText(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
|
772 | ui->st_catnrEdit->setText(query.value(3).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
|
773 | ui->st_groupEdit->setText(query.value(4).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
|
774 | ui->st_guideEdit->setText(query.value(5).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
|
775 | ui->st_typeEdit->setText(s_types[query.value(6).toInt()]); |
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
|
776 | ui->est_ogShow->setRange(query.value(7).toDouble(), query.value(8).toDouble()); |
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
|
777 | ui->est_fgShow->setRange(query.value(9).toDouble(), query.value(10).toDouble()); |
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
|
778 | ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
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
|
779 | ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
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
|
780 | ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
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
|
781 | ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); |
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
|
782 | |
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
|
783 | is_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
|
784 | } |
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
|
785 | |
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
|
786 | |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
787 | void EditRecipe::colormethod_changed() |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
788 | { |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
789 | calcFermentables(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
790 | is_changed(); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
791 | } |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
792 | |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
101
diff
changeset
|
793 | |
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
|
794 | void EditRecipe::time_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
|
795 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
796 | 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
|
797 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
798 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
799 | |
103
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
800 | void EditRecipe::cell_Fermentable_changed(int nRow, int nCol) |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
801 | { |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
802 | if (this->ignoreChanges) |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
803 | return; |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
804 | |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
805 | qDebug() << "Cell at row " + QString::number(nRow) + " column " + QString::number(nCol) + " was changed."; |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
806 | |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
807 | if (nCol == 8) { // 100% checkbox |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
808 | this->ignoreChanges = true; |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
809 | |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
810 | if (ui->fermentablesTable->item(nRow, nCol)->checkState() == Qt::Checked) { |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
811 | /* |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
812 | * This row is checked. Remove any other checked item. |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
813 | */ |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
814 | for (int i = 0; i < ui->fermentablesTable->rowCount(); i++) { |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
815 | if (i != nRow) { |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
816 | QTableWidgetItem *checkBoxItem = ui->fermentablesTable->item(i, nCol); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
817 | checkBoxItem->setCheckState(Qt::Unchecked); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
818 | ui->fermentablesTable->setItem(i, nCol, checkBoxItem); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
819 | } |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
820 | } |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
821 | } else { |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
822 | /* |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
823 | * Unchecked, start working with amounts instead of percentages. |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
824 | */ |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
825 | } |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
826 | qDebug() << ui->fermentablesTable->item(nRow, nCol)->checkState(); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
827 | this->ignoreChanges = false; |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
828 | } |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
829 | |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
830 | // TODO: some checks and auto fixes. |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
831 | // make_Json(); |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
832 | } |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
833 | |
6da4e93b6ceb
Experiment with checkboxes in the fermentable table.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
834 | |
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
|
835 | void EditRecipe::on_deleteFermentRow_clicked() |
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
|
836 | { |
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
|
837 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
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
|
838 | int row = pb->objectName().toInt(); |
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
|
839 | qDebug() << "Delete row" << row; |
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
|
840 | ui->fermentablesTable->removeRow(row); |
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
|
841 | // make_Json(); |
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
|
842 | } |
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
|
843 | |
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
|
844 | |
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
|
845 | 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
|
846 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
847 | 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
|
848 | 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
|
849 | 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
|
850 | 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
|
851 | 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
|
852 | 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
|
853 | 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
|
854 | 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
|
855 | 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
|
856 | 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
|
857 | 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
|
858 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
859 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
860 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
861 | 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
|
862 | 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
|
863 | } |