src/EditProduct.cpp

Thu, 18 Aug 2022 20:34:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 18 Aug 2022 20:34:15 +0200
changeset 401
583148eb6e01
parent 397
877420a13815
child 409
9c78dd948aae
permissions
-rw-r--r--

Init est_carb field for new products.

175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditProduct.cpp is part of bmsapp.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "MainWindow.h"
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 365
diff changeset
18 #include "callout.h"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "EditProduct.h"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "PrinterDialog.h"
332
146874d7bb47 Added carbonation chart to it's own function. Added this chart to DetailCO2meter too.
Michiel Broek <mbroek@mbse.eu>
parents: 307
diff changeset
21 #include "ChartCarbonate.h"
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 332
diff changeset
22 #include "ChartFermenter.h"
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 332
diff changeset
23 #include "ChartiSpindel.h"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "../ui/ui_EditProduct.h"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 #include "Utils.h"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include "global.h"
266
5f0782149028 Added export product to forum.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
27 #include "config.h"
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
28 #include "database/db_product.h"
265
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 264
diff changeset
29 #include "database/db_recipe.h"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 EditProduct::EditProduct(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditProduct)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 QSqlQuery query, wquery, yquery;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
36 qDebug() << "EditProduct record:" << id;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 product = new Product;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 ui->setupUi(this);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 product->fermentables_row = product->hops_row = product->miscs_row = product->yeasts_row = product->mashs_row = -1;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 product->fermentables_use100 = false;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 this->recno = id;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 WindowTitle();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 ui->typeEdit->addItem(tr("Extract"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 ui->typeEdit->addItem(tr("Partial Mash"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 ui->typeEdit->addItem(tr("All Grain"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 ui->color_methodEdit->addItem("Morey");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 ui->color_methodEdit->addItem("Mosher");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 ui->color_methodEdit->addItem("Daniels");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 ui->color_methodEdit->addItem("Halberstadt");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 ui->color_methodEdit->addItem("Naudts");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
55 for (int i = 0; i < 3; i++)
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
56 ui->ibu_methodEdit->addItem(g_ibu_method[i]);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 for (int i = 0; i < my_acids.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 ui->mw_acidPick->addItem(my_acids.at(i).name_en);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 ui->sp_acidtypeEdit->addItem(my_acids.at(i).name_en);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 query.prepare("SELECT name FROM inventory_waters ORDER BY record");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 ui->w1_nameEdit->addItem("");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 ui->w2_nameEdit->addItem("");
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
67 while (query.next()) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 ui->w1_nameEdit->addItem(query.value(0).toString());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 ui->w2_nameEdit->addItem(query.value(0).toString());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 query.prepare("SELECT name FROM profile_water ORDER BY name");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 ui->wt_sourceEdit->addItem("");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 while (query.next()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 ui->wt_sourceEdit->addItem(query.value(0).toString());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 query.prepare("SELECT name FROM profile_mash ORDER BY name");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 ui->mash_pickEdit->addItem("");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 while (query.next()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 ui->mash_pickEdit->addItem(query.value(0).toString());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
86 ui->beerstyleEdit->addItem(product->st_name); // First add a dummy, the current style
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 query.prepare("SELECT style_guide,style_letter,name FROM profile_styles ORDER BY style_guide,style_letter,name");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 query.exec();
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
89 while (query.next()) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 ui->beerstyleEdit->addItem(query.value(0).toString()+" "+query.value(1).toString()+" "+query.value(2).toString());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92
341
1b1e2d4c1a3e Cooling method dropdown table loads from a global table. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
93 for (int i = 0; i < 5; i++)
1b1e2d4c1a3e Cooling method dropdown table loads from a global table. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
94 ui->brew_coolwithEdit->addItem(QCoreApplication::translate("ChillerType", g_chiller_types[i]));
185
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
95
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
96 ui->brew_aerwithEdit->addItem(tr("None"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
97 ui->brew_aerwithEdit->addItem(tr("Air"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
98 ui->brew_aerwithEdit->addItem(tr("Oxygen"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
99
187
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
100 ui->bottle_sugarEdit->addItem("");
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
101 ui->keg_sugarEdit->addItem("");
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
102 query.prepare("SELECT name FROM inventory_fermentables WHERE type = '1' OR type = '3' ORDER BY name"); // Sugars or dry extract
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
103 query.exec();
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
104 while (query.next()) {
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
105 ui->bottle_sugarEdit->addItem(query.value(0).toString());
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
106 ui->keg_sugarEdit->addItem(query.value(0).toString());
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
107 }
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
108
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
109 ui->spargeGroup->setId(ui->w1_spButton, 0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
110 ui->spargeGroup->setId(ui->w2_spButton, 1);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
111 ui->spargeGroup->setId(ui->wg_spButton, 2);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
112
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 if (id >= 0) {
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
114 if (! DB_product::load(product, this, id))
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 return;
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
116 qInfo() << "EditProduct" << product->code << "," << product->name;
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
117
296
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
118 /*
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
119 * Check status of logfiles.
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
120 */
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
121 if (product->stage > PROD_STAGE_BREW) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
122 if (! product->log_brew) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
123 query.prepare("SELECT datetime FROM log_brews WHERE code=:code");
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
124 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
125 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
126 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
127 qDebug() << "should update log_brews";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
128 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
129 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
130 if (! product->log_fermentation) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
131 query.prepare("SELECT datetime FROM log_fermenter WHERE code=:code");
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
132 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
133 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
134 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
135 qDebug() << "should update log_fermenter";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
136 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
137 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
138 if (! product->log_ispindel) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
139 query.prepare("SELECT datetime FROM log_ispindel WHERE code=:code");
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
140 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
141 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
142 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
143 qDebug() << "should update log_ispindel";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
144 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
145 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
146 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
147 if (product->stage > PROD_STAGE_PACKAGE) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
148 if (! product->log_co2pressure) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
149 query.prepare("SELECT datetime FROM log_co2pressure WHERE code=:code");
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
150 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
151 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
152 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
153 qDebug() << "should update log_co2pressure";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
154 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
155 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
156 }
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 } else {
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
159 /* New product, set some defaults */
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
160 qInfo() << "EditProduct, start new product";
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
161 product->record = -1;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
162 product->locked = product->log_brew = product->log_fermentation = product->log_ispindel = product->log_co2pressure = false;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 product->st_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 product->st_letter = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 product->st_guide = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 product->st_category = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 product->st_category_number = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 product->st_type = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 product->st_og_min = 1.025; product->st_og_max = 1.100;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 product->st_fg_min = 1.000; product->st_fg_max = 1.020;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 product->st_ibu_min = 5; product->st_ibu_max = 200;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 product->st_color_min = 3; product->st_color_max = 100;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 product->st_carb_min = 1.0; product->st_carb_max = 4.5;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 product->st_abv_min = 1; product->st_abv_max = 15;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
175 product->eq_name = product->eq_notes = product->name = product->code = "";
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
176 product->eq_tun_specific_heat = 0.11;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
177 product->eq_tun_material = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
178 product->eq_tun_volume = product->eq_tun_height = 20;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
179 product->eq_tun_weight = 2;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
180 product->eq_top_up_water = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
181 product->eq_trub_chiller_loss = 0.5;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
182 product->eq_evap_rate = 1.8;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
183 product->eq_calc_boil_volume = true;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
184 product->eq_top_up_kettle = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
185 product->eq_hop_utilization = 100;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
186 product->eq_lauter_volume = product->eq_lauter_height = product->eq_kettle_volume = product->eq_kettle_height = product->eq_mash_volume = 20;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
187 product->eq_lauter_deadspace = 0.5;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
188 product->eq_mash_max = 6;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
189 product->eq_efficiency = 75;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
190 product->birth = QDate::currentDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
191 product->stage = product->inventory_reduced = PROD_STAGE_PLAN;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 product->notes = "";
227
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
193 product->color_method = product->ibu_method = 0;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 product->efficiency = 75;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
195 product->eq_batch_size = product->batch_size = 20;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
196 product->eq_boil_time = product->boil_time = 60;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
197 product->eq_boil_size = product->boil_size = product->batch_size + (round(product->batch_size * product->boil_time / 60.0) / 10.0);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 product->type = 2;
401
583148eb6e01 Init est_carb field for new products.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
199 product->est_og = product->est_og3 = product->est_fg = product->est_color = product->est_ibu = product->est_abv = product->est_carb = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
200 product->brew_date_start = product->brew_date_end = QDateTime();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
201 product->brew_mash_ph = product->brew_mash_sg = product->brew_mash_efficiency = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
202 product->brew_sparge_temperature = product->brew_sparge_volume = product->brew_sparge_est = product->brew_sparge_ph = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
203 product->brew_preboil_volume = product->brew_preboil_sg = product->brew_preboil_ph = product->brew_preboil_efficiency = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
204 product->brew_aboil_volume = product->brew_aboil_sg = product->brew_aboil_ph = product->brew_aboil_efficiency = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
205 product->brew_cooling_method = product->brew_cooling_time = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
206 product->brew_cooling_to = 20;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
207 product->brew_whirlpool9 = product->brew_whirlpool7 = product->brew_whirlpool6 = product->brew_whirlpool2 = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
208 product->brew_fermenter_volume = product->brew_fermenter_extrawater = product->brew_fermenter_tcloss = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
209 product->brew_aeration_time = product->brew_aeration_speed = product->brew_aeration_type = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
210 product->brew_fermenter_sg = product->brew_fermenter_ibu = product->brew_fermenter_color = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
211 product->og = product->fg = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
212 product->primary_start_temp = product->primary_max_temp = product->primary_end_temp = product->primary_end_sg = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
213 product->primary_end_date = product->secondary_end_date = QDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
214 product->secondary_temp = product->secondary_end_sg = product->tertiary_temp = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
215 product->package_date = QDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
216 product->package_volume = product->package_infuse_amount = product->package_infuse_abv = product->package_abv = product->package_ph = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
217 product->package_infuse_notes = "";
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
218 product->bottle_amount = product->bottle_carbonation = product->bottle_priming_amount = product->bottle_carbonation_temp = 0;
227
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
219 product->keg_amount = product->keg_carbonation = product->keg_priming_amount = product->keg_carbonation_temp = 0;
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
220 product->keg_pressure = 0;
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
221 product->bottle_priming_water = product->keg_priming_water = 0;
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
222 product->bottle_priming_sugar = product->keg_priming_sugar = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
223 product->taste_rate = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
224 product->taste_date = QDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
225 product->taste_notes = product->taste_color = product->taste_transparency = product->taste_head = "";
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
226 product->taste_aroma = product->taste_taste = product->taste_mouthfeel = product->taste_aftertaste = "";
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 product->sparge_temp = 80;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 product->sparge_ph = 5.4;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 product->sparge_volume = 8;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 product->sparge_source = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 product->sparge_acid_type = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 product->sparge_acid_perc = 80;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 product->sparge_acid_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 product->mash_ph = 5.4;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 product->mash_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 product->calc_acid = true;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 product->w1_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 product->w1_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 product->w1_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 product->w1_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 product->w1_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 product->w1_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 product->w1_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 product->w1_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 product->w1_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 product->w1_cost = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 product->w2_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 product->w2_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 product->w2_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 product->w2_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 product->w2_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 product->w2_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 product->w2_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 product->w2_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 product->w2_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 product->w2_cost = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 product->wg_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 product->wg_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 product->wg_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 product->wg_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 product->wg_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 product->wg_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 product->wg_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 product->wg_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 product->wb_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 product->wb_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 product->wb_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 product->wb_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 product->wb_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 product->wb_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 product->wb_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 product->wa_acid_name = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 product->wa_acid_perc = 80;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 product->wa_base_name = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
275 product->starter_enable = false;
196
f7954f2d4451 Internal product record stores the starter steps in array format.
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
276 product->starter_type = product->prop_type[0] = product->prop_type[1] = product->prop_type[2] = product->prop_type[3] = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
277 product->starter_viability = 100;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
278 product->starter_sg = 1.037;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
279 product->yeast_prod_date = QDate();
196
f7954f2d4451 Internal product record stores the starter steps in array format.
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
280 product->yeast_pitchrate = product->prop_volume[0] = product->prop_volume[1] = product->prop_volume[2] = product->prop_volume[3] = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
281 product->divide_type = product->divide_parts = product->divide_part = 0;
260
42b88d85fefc Fix default divide_size field in products. Update miscs table column 6 and 7 tooltips and display of the buttons after sort. After a new misc product is selected, update the current row index because the row may be moved. Fix some display misc values in the checklist, they were not multiplied by 1000. Fix display of some bars if the value was 24.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
282 product->divide_size = 0;
42b88d85fefc Fix default divide_size field in products. Update miscs table column 6 and 7 tooltips and display of the buttons after sort. After a new misc product is selected, update the current row index because the row may be moved. Fix some display misc values in the checklist, they were not multiplied by 1000. Fix display of some bars if the value was 24.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
283 product->divide_factor = 1;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 // Tab generic.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 ui->lockedEdit->setChecked(product->locked);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 ui->st_nameEdit->setText(product->st_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 ui->st_groupEdit->setText(product->st_letter);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 ui->st_guideEdit->setText(product->st_guide);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 ui->st_catEdit->setText(product->st_category);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 ui->st_catnrEdit->setText(QString("%1").arg(product->st_category_number));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 297
diff changeset
293 ui->st_typeEdit->setText(QCoreApplication::translate("BeerType", g_style_types[product->st_type]));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 ui->nameEdit->setText(product->name);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
295 ui->codeEdit->setText(product->code);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
296 ui->birthEdit->setText(product->birth.toString("dd MMM yyyy"));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 ui->notesEdit->setPlainText(product->notes);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 ui->typeEdit->setCurrentIndex(product->type);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 ui->batch_sizeEdit->setValue(product->batch_size);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 ui->boil_sizeEdit->setValue(product->boil_size);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 ui->boil_timeEdit->setValue(product->boil_time);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 ui->efficiencyEdit->setValue(product->efficiency);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
303 if (product->divide_type > 0)
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 297
diff changeset
304 ui->splitatEdit->setText(QString(tr("%1, part %2 of %3").arg(QCoreApplication::translate("Splitter", g_prod_split[product->divide_type]))
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
305 .arg(product->divide_part + 1)
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
306 .arg(product->divide_parts + 1)));
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
307 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 297
diff changeset
308 ui->splitatEdit->setText(QCoreApplication::translate("Splitter", g_prod_split[product->divide_type]));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 ui->est_ogEdit->setValue(product->est_og);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 ui->est_ogShow->setRange(product->st_og_min, product->st_og_max);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 ui->est_ogShow->setPrecision(3);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 ui->est_ogShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 ui->est_ogShow->setValue(product->est_og);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 ui->est_fgEdit->setValue(product->est_fg);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 ui->est_fgShow->setRange(product->st_fg_min, product->st_fg_max);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 ui->est_fgShow->setPrecision(3);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 ui->est_fgShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 ui->est_fgShow->setValue(product->est_fg);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 ui->est_abvEdit->setValue(product->est_abv);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 ui->est_abvShow->setRange(product->st_abv_min, product->st_abv_max);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 ui->est_abvShow->setPrecision(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 ui->est_abvShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 ui->est_abvShow->setValue(product->est_abv);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 ui->est_colorEdit->setValue(product->est_color);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(product->est_color));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 ui->est_colorShow->setPrecision(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 ui->est_colorShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 ui->est_colorShow->setRange(product->st_color_min, product->st_color_max);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 ui->est_colorShow->setValue(product->est_color);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 ui->color_methodEdit->setCurrentIndex(product->color_method);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 ui->est_ibuEdit->setValue(product->est_ibu);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 ui->est_ibuShow->setPrecision(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 ui->est_ibuShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 ui->est_ibuShow->setRange(product->st_ibu_min, product->st_ibu_max);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 ui->est_ibuShow->setValue(product->est_ibu);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 ui->ibu_methodEdit->setCurrentIndex(product->ibu_method);
397
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
337 ui->est_bottle_co2Edit->setValue(product->bottle_carbonation);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
338 ui->est_bottle_co2Show->setPrecision(1);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
339 ui->est_bottle_co2Show->setMarkerTextIsValue(true);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
340 ui->est_bottle_co2Show->setRange(product->st_carb_min, product->st_carb_max);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
341 ui->est_bottle_co2Show->setValue(product->bottle_carbonation);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
342 ui->est_kegs_co2Edit->setValue(product->keg_carbonation);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
343 ui->est_kegs_co2Show->setPrecision(1);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
344 ui->est_kegs_co2Show->setMarkerTextIsValue(true);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
345 ui->est_kegs_co2Show->setRange(product->st_carb_min, product->st_carb_max);
877420a13815 Edit Product, split CO2 package pressure in bottles and kegs. BU:RE code cleanup. calcPack() sets the CO2 values on the first tab. Show final EBC on tab 1 if the stage is after brew. Show final ABV and energy on tab 1 if fermentation is done. Removed wrong bottle priming calculation from calcFermentables() because calcPack() does this.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
346 ui->est_kegs_co2Show->setValue(product->keg_carbonation);
395
7212b980a527 Added Bitterness Unit to Real Extract unit calculation and display. In product use final values if possible for the BU:GU and BU:RE calculations depending on the product stage.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
347 calcStyle();
7212b980a527 Added Bitterness Unit to Real Extract unit calculation and display. In product use final values if possible for the BU:GU and BU:RE calculations depending on the product stage.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
348 ui->est_buguShow->setPrecision(2);
7212b980a527 Added Bitterness Unit to Real Extract unit calculation and display. In product use final values if possible for the BU:GU and BU:RE calculations depending on the product stage.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
349 ui->est_buguShow->setMarkerTextIsValue(true);
7212b980a527 Added Bitterness Unit to Real Extract unit calculation and display. In product use final values if possible for the BU:GU and BU:RE calculations depending on the product stage.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
350 ui->est_bufguShow->setPrecision(2);
7212b980a527 Added Bitterness Unit to Real Extract unit calculation and display. In product use final values if possible for the BU:GU and BU:RE calculations depending on the product stage.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
351 ui->est_bufguShow->setMarkerTextIsValue(true);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
353 // Tab equipment.
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 188
diff changeset
354 initEquipment();
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
355
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 // Tab fermentables.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 ui->est_og2Edit->setValue(product->est_og);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 ui->est_color2Edit->setValue(product->est_color);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(product->est_color));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 // Tab hops.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 ui->est_ibu2Edit->setValue(product->est_ibu);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364 // Tab yeasts.
195
9887278c4fbe The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
365 initYeast();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 // Tab mashs.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 ui->mash_nameEdit->setText(product->mash_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 // Tab waters.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 qDebug() << "water 1" << product->w1_name << "default" << my_default_water;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 if (product->w1_ph > 4.0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 * Water data seems present, use that and set the name between []
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 ui->w1_nameEdit->setPlaceholderText(QString("["+product->w1_name+"]"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 bool found = false;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 if (product->w1_name != "") {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 * We have a name, but do we know it?
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 query.prepare("SELECT * FROM inventory_waters WHERE name=:water");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 query.bindValue(":water", product->w1_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 found = query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 if (!found) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 * Try to load default water
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 query.prepare("SELECT * FROM inventory_waters WHERE record=:record");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 query.bindValue(":record", my_default_water);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 found = query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 if (found) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 product->w1_calcium = query.value(3).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 product->w1_magnesium = query.value(8).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 product->w1_total_alkalinity = query.value(11).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 product->w1_sodium = query.value(7).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 product->w1_chloride = query.value(6).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 product->w1_sulfate = query.value(5).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 product->w1_ph = query.value(9).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 ui->w1_nameEdit->setCurrentIndex(query.value(0).toInt());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 product->w1_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 product->w1_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 product->w1_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410 product->w1_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 product->w1_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 product->w1_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413 product->w1_ph = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
415 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 ui->w1_volEdit->setValue(product->w1_amount);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 ui->w1_caEdit->setValue(product->w1_calcium);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 ui->w1_mgEdit->setValue(product->w1_magnesium);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
419 ui->w1_hco3Edit->setValue(Utils::Bicarbonate(product->w1_total_alkalinity, product->w1_ph));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 ui->w1_caco3Edit->setValue(product->w1_total_alkalinity);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421 ui->w1_naEdit->setValue(product->w1_sodium);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422 ui->w1_clEdit->setValue(product->w1_chloride);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423 ui->w1_so4Edit->setValue(product->w1_sulfate);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424 ui->w1_phEdit->setValue(product->w1_ph);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426 qDebug() << "water 2" << product->w2_name;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
427 if (product->w2_ph > 4.0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428 ui->w2_nameEdit->setPlaceholderText(QString("["+product->w2_name+"]"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 } else if (product->w2_name != "") {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430 query.prepare("SELECT * FROM inventory_waters WHERE name=:water");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431 query.bindValue(":water", product->w2_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433 if (query.first()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
434 product->w2_calcium = query.value(3).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
435 product->w2_magnesium = query.value(8).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 product->w2_total_alkalinity = query.value(11).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
437 product->w2_sodium = query.value(7).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 product->w2_chloride = query.value(6).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 product->w2_sulfate = query.value(5).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 product->w2_ph = query.value(9).toDouble();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 ui->w2_nameEdit->setCurrentIndex(query.value(0).toInt());
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 product->w2_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 product->w2_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 product->w2_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 product->w2_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 product->w2_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 product->w2_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449 product->w2_ph = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
451 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
452 ui->w2_volEdit->setValue(product->w2_amount);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453 ui->w2_caEdit->setValue(product->w2_calcium);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454 ui->w2_mgEdit->setValue(product->w2_magnesium);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
455 ui->w2_hco3Edit->setValue(Utils::Bicarbonate(product->w2_total_alkalinity, product->w2_ph));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456 ui->w2_caco3Edit->setValue(product->w2_total_alkalinity);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 ui->w2_naEdit->setValue(product->w2_sodium);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 ui->w2_clEdit->setValue(product->w2_chloride);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459 ui->w2_so4Edit->setValue(product->w2_sulfate);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 ui->w2_phEdit->setValue(product->w2_ph);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 ui->mw_autoEdit->setChecked(product->calc_acid);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 ui->mw_phEdit->setReadOnly(! product->calc_acid);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463 ui->mw_phEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464 ui->mw_acidvolEdit->setReadOnly(product->calc_acid);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 ui->mw_acidvolEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
466 ui->sp_phEdit->setReadOnly(! product->calc_acid);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
467 ui->sp_phEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::UpDownArrows : QAbstractSpinBox::NoButtons);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
468 ui->sp_acidvolEdit->setReadOnly(product->calc_acid);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
469 ui->sp_acidvolEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
470 ui->sp_volEdit->setValue(product->sparge_volume);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
471 ui->sp_phEdit->setValue(product->sparge_ph);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
472 ui->sp_acidtypeEdit->setCurrentIndex(product->sparge_acid_type);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
473 ui->sp_acidpercEdit->setValue(product->sparge_acid_perc);
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
474 check_waters();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
476 // Tab brewday.
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
477 updateBrewday();
182
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
478 ui->brew_mashphEdit->setValue(product->brew_mash_ph);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
479 ui->brew_mashphShow->setValue(product->mash_ph);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
480 ui->brew_mashsgEdit->setValue(product->brew_mash_sg);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
481 ui->brew_mashsgShow->setValue(0);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
482 ui->brew_masheffShow->setValue(product->brew_mash_efficiency);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
483 ui->brew_spargetempEdit->setValue(product->sparge_temp);
183
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
484 ui->brew_spargevolShow->setValue(product->sparge_volume);
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
485 ui->brew_spargeestShow->setValue(product->brew_sparge_est);
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
486 ui->brew_spargephEdit->setValue(product->brew_sparge_ph);
185
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
487 ui->brew_spargephShow->setValue(product->sparge_ph);
183
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
488
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
489 ui->brew_preboilphEdit->setValue(product->brew_preboil_ph);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
490 ui->brew_preboilsgEdit->setValue(product->brew_preboil_sg);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
491 ui->brew_preboilvolEdit->setValue(product->brew_preboil_volume);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
492 ui->brew_preboilvolShow->setValue(product->boil_size * 1.04);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
493 ui->brew_preboileffShow->setValue(product->brew_preboil_efficiency);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
494 ui->brew_aboilphEdit->setValue(product->brew_aboil_ph);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
495 ui->brew_aboilsgEdit->setValue(product->brew_aboil_sg);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
496 ui->brew_aboilvolEdit->setValue(product->brew_aboil_volume);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
497 ui->brew_aboilvolShow->setValue(product->batch_size * 1.04);
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
498 ui->brew_aboileffShow->setValue(product->brew_aboil_efficiency);
185
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
499 ui->brew_whirlpool9Edit->setValue(product->brew_whirlpool9);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
500 ui->brew_whirlpool7Edit->setValue(product->brew_whirlpool7);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
501 ui->brew_whirlpool6Edit->setValue(product->brew_whirlpool6);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
502 ui->brew_whirlpool2Edit->setValue(product->brew_whirlpool2);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
503 ui->brew_cooltoEdit->setValue(product->brew_cooling_to);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
504 ui->brew_coolwithEdit->setCurrentIndex(product->brew_cooling_method);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
505 ui->brew_cooltimeEdit->setValue(product->brew_cooling_time);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
506
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
507 ui->brew_trublossEdit->setValue(product->brew_fermenter_tcloss);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
508 ui->brew_topupwaterEdit->setValue(product->brew_fermenter_extrawater);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
509 ui->brew_tofermentEdit->setValue(product->brew_fermenter_volume);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
510 ui->brew_fermentsgShow->setValue(product->brew_fermenter_sg);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
511 ui->brew_fermentcolorShow->setValue(product->brew_fermenter_color);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
512 ui->brew_fermentcolorShow->setStyleSheet(Utils::ebc_to_style(product->brew_fermenter_color));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
513 ui->brew_fermentibuShow->setValue(product->brew_fermenter_ibu);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
514
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
515 ui->brew_aerwithEdit->setCurrentIndex(product->brew_aeration_type);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
516 ui->brew_aertimeEdit->setValue(product->brew_aeration_time);
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
517 ui->brew_aerspeedEdit->setValue(product->brew_aeration_speed);
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
518
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
519 // Tab fermentation.
186
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
520 ui->prim_ogShow->setValue(product->brew_fermenter_sg);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
521 ui->prim_startCEdit->setValue(product->primary_start_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
522 ui->prim_maxCEdit->setValue(product->primary_max_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
523 ui->prim_endCEdit->setValue(product->primary_end_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
524 ui->prim_endsgEdit->setValue(product->primary_end_sg);
218
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
525 ui->prim_enddateEdit->setDate(product->primary_end_date);
186
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
526 ui->prim_attShow->setValue(Utils::calc_svg(product->brew_fermenter_sg, product->primary_end_sg));
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
527 ui->sec_tempEdit->setValue(product->secondary_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
528 ui->sec_sgEdit->setValue(product->secondary_end_sg);
218
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
529 ui->sec_enddateEdit->setDate(product->secondary_end_date);
186
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
530 ui->sec_attShow->setValue(Utils::calc_svg(product->brew_fermenter_sg, product->secondary_end_sg));
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
531 ui->tert_tempEdit->setValue(product->tertiary_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
532 ui->tert_estsgShow->setValue(product->est_fg);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
533 ui->tert_sgEdit->setValue(product->fg);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
534 ui->tert_attShow->setValue(Utils::calc_svg(product->brew_fermenter_sg, product->fg));
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
535 ui->tert_abvShow->setValue(Utils::abvol(product->brew_fermenter_sg, product->fg));
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
536
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
537 // Tab packaging.
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
538 ui->pack_dateEdit->setDate(product->package_date);
187
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
539 ui->pack_carbloShow->setValue(product->st_carb_min);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
540 ui->pack_carbhiShow->setValue(product->st_carb_max);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
541 ui->pack_volumeEdit->setValue(product->package_volume);
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
542 ui->pack_volumeEdit->setMaximum(product->brew_fermenter_volume);
187
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
543 ui->pack_addvolEdit->setValue(product->package_infuse_amount);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
544 ui->pack_addabvEdit->setValue(product->package_infuse_abv);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
545 ui->pack_notesEdit->setText(product->package_infuse_notes);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
546 ui->pack_abvShow->setValue(product->package_abv);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
547 ui->pack_phEdit->setValue(product->package_ph);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
548
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
549 ui->bottle_volumeEdit->setValue(product->bottle_amount);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
550 ui->bottle_carbEdit->setValue(product->bottle_carbonation);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
551 ui->bottle_sug_amountShow->setValue(product->bottle_priming_amount);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
552 ui->bottle_sug_waterEdit->setValue(product->bottle_priming_water);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
553 ui->bottle_tempEdit->setValue(product->bottle_carbonation_temp);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
554
223
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
555 ui->keg_volumeEdit->setValue(product->keg_amount);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
556 ui->keg_carbEdit->setValue(product->keg_carbonation);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
557 ui->keg_sug_amountShow->setValue(product->keg_priming_amount);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
558 ui->keg_sug_waterEdit->setValue(product->keg_priming_water);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
559 ui->keg_tempEdit->setValue(product->keg_carbonation_temp);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
560 ui->keg_forcedEdit->setChecked(product->keg_forced_carb);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
561
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
562 // Tab taste.
225
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
563 ui->taste_dateEdit->setDate(product->taste_date);
187
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
564 ui->taste_rateEdit->setValue(product->taste_rate);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
565 ui->taste_notesEdit->setPlainText(product->taste_notes);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
566 ui->taste_colorEdit->setText(product->taste_color);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
567 ui->taste_transparencyEdit->setText(product->taste_transparency);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
568 ui->taste_headEdit->setText(product->taste_head);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
569 ui->taste_aromaEdit->setText(product->taste_aroma);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
570 ui->taste_tasteEdit->setText(product->taste_taste);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
571 ui->taste_mouthfeelEdit->setText(product->taste_mouthfeel);
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
572 ui->taste_aftertasteEdit->setText(product->taste_aftertaste);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
573
218
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
574 qDebug() << "== Start connecting ==";
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
575
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576 // All signals from tab "Generic"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
577 connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditProduct::is_changed);
227
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
578 connect(ui->codeEdit, &QLineEdit::textChanged, this, &EditProduct::code_changed);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
579 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditProduct::name_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(notes_changed()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
581 connect(ui->typeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::brew_type_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
582 connect(ui->batch_sizeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::batch_size_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 connect(ui->boil_timeEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditProduct::boil_time_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 connect(ui->efficiencyEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::efficiency_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 connect(ui->beerstyleEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::style_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
586 connect(ui->est_ogEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::est_og_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
587 connect(ui->color_methodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::colormethod_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
588 connect(ui->ibu_methodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::ibumethod_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
589 connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditProduct::locked_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
590
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
591 // All signals from tab "Fermentables"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 ui->fermentablesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 connect(ui->est_og2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::est_og_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 connect(ui->perc_mashShow, &QProgressBar::valueChanged, this, &EditProduct::ferment_perc_mash_valueChanged);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 connect(ui->perc_sugarsShow, &QProgressBar::valueChanged, this, &EditProduct::ferment_perc_sugars_valueChanged);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596 connect(ui->perc_caraShow, &QProgressBar::valueChanged, this, &EditProduct::ferment_perc_cara_valueChanged);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
597 connect(ui->lintnerShow, &QProgressBar::valueChanged, this, &EditProduct::ferment_lintner_valueChanged);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 connect(ui->addFermentable, SIGNAL(clicked()), this, SLOT(addFermentRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 // All signals from tab "Hops"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
601 ui->hopsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
602 connect(ui->hop_tasteShow, &QProgressBar::valueChanged, this, &EditProduct::hop_Flavour_valueChanged);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
603 connect(ui->hop_aromaShow, &QProgressBar::valueChanged, this, &EditProduct::hop_Aroma_valueChanged);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
604 connect(ui->addHop, SIGNAL(clicked()), this, SLOT(addHopRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606 // All signals from tab "Miscs"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
607 ui->miscsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 connect(ui->addMisc, SIGNAL(clicked()), this, SLOT(addMiscRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
609
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 // All signals from tab "Yeasts"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 connect(ui->addYeast, SIGNAL(clicked()), this, SLOT(addYeastRow_clicked()));
195
9887278c4fbe The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
612 connect(ui->stmethodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_method_changed);
9887278c4fbe The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
613 connect(ui->startersgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_starter_sg_changed);
198
904591820c3d Added yeast viability calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
614 connect(ui->productionButton1, SIGNAL(clicked()), this, SLOT(yeast_prod_date_today()));
904591820c3d Added yeast viability calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
615 connect(ui->productionButton2, SIGNAL(clicked()), this, SLOT(yeast_prod_date_clear()));
904591820c3d Added yeast viability calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
616 connect(ui->productionEdit, &QDateEdit::dateChanged, this, &EditProduct::yeast_prod_date_changed);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
618 // All signals from tab "Mash"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619 ui->mashsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
620 connect(ui->addMash, SIGNAL(clicked()), this, SLOT(addMashRow_clicked()));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 connect(ui->mash_pickEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::mash_select_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
622 connect(ui->mash_nameEdit, &QLineEdit::textChanged, this, &EditProduct::mash_name_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
623
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 // All signals from tab "Water"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
625 connect(ui->bs_cacl2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_cacl2_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
626 connect(ui->bs_caso4Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_caso4_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
627 connect(ui->bs_mgso4Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_mgso4_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
628 connect(ui->bs_naclEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_nacl_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
629 connect(ui->bs_mgcl2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_mgcl2_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
630 connect(ui->bs_nahco3Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_nahco3_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 connect(ui->bs_caco3Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_caco3_changed);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
632 connect(ui->ss_cacl2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_cacl2_changed);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
633 connect(ui->ss_caso4Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_caso4_changed);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
634 connect(ui->ss_mgso4Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_mgso4_changed);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
635 connect(ui->ss_naclEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_nacl_changed);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
636 connect(ui->ss_mgcl2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_mgcl2_changed);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
637 connect(ui->mw_autoEdit, &QCheckBox::stateChanged, this, &EditProduct::mw_calc_acid_clicked);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
638 connect(ui->mw_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::mw_ph_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
639 connect(ui->mw_acidvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::mw_acid_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
640 connect(ui->mw_acidPick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::mw_type_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
641 connect(ui->wt_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::wt_target_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
642 connect(ui->w1_nameEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::w1_name_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
643 connect(ui->w2_nameEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::w2_name_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
644 connect(ui->w2_volEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::w2_volume_changed);
264
67b5c00dd23c Added slots for sparge water volume and temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
645 connect(ui->sp_volEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_volume_changed);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
646 connect(ui->spargeGroup, SIGNAL(buttonClicked(int)), this, SLOT(sp_group_changed(int)));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
647 connect(ui->sp_acidtypeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::sp_type_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
648 connect(ui->sp_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_ph_changed);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
649 connect(ui->sp_acidvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_acid_changed);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
650
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
651 /* All signals from tab Brewday */
218
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
652 calcEfficiencyBeforeBoil();
725da10db56c Fixed wrong colors of the bars on the fermentation tab. Don't show 100% SVG if OG or FG data is missing. Changed prompts om the fermentation tab.
Michiel Broek <mbroek@mbse.eu>
parents: 214
diff changeset
653 calcEfficiencyAfterBoil();
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
654 connect(ui->brew_startButton1, SIGNAL(clicked()), this, SLOT(brew_date_today()));
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
655 connect(ui->brew_startButton2, SIGNAL(clicked()), this, SLOT(brew_date_clear()));
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
656 connect(ui->brew_startDate, &QDateEdit::dateChanged, this, &EditProduct::brew_start_date_changed);
214
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
657 connect(ui->brew_startTime, &QTimeEdit::timeChanged, this, &EditProduct::brew_start_time_changed);
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
658 connect(ui->brew_endDate, &QDateEdit::dateChanged, this, &EditProduct::brew_end_date_changed);
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
659 connect(ui->brew_endTime, &QTimeEdit::timeChanged, this, &EditProduct::brew_end_time_changed);
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
660 connect(ui->brew_endButton1, SIGNAL(clicked()), this, SLOT(brew_end_today()));
641540dc6ef2 Added the brew end date and time settings. Added a confirm button the is only displayed if everything is ready for the next step. This check includes that the end of the brew is at least two hours after the start. This completes the brewday tab page.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
661 connect(ui->brew_ackButton, SIGNAL(clicked()), this, SLOT(brew_date_ack()));
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
662 connect(ui->brew_mashphEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_mashph_changed);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
663 connect(ui->brew_mashsgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_mashsg_changed);
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
664 connect(ui->brew_spargephEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_spargeph_changed);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 341
diff changeset
665 connect(ui->brew_spargetempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_temp_changed);
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
666 connect(ui->brew_preboilphEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_preboilph_changed);
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
667 connect(ui->brew_preboilsgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_preboilsg_changed);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
668 connect(ui->brew_preboilvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_preboilvol_changed);
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
669 connect(ui->brew_preboilButton, SIGNAL(clicked()), this, SLOT(brew_preboil_button()));
207
3b164a0aea90 Implemented brewday mah ph edit, mash sg edit, sparge ph edit, pre and after boil ph edit.
Michiel Broek <mbroek@mbse.eu>
parents: 205
diff changeset
670 connect(ui->brew_aboilphEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_aboilph_changed);
209
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
671 connect(ui->brew_aboilsgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_aboilsg_changed);
19c50b1f58d3 Implemented pre and after boil volume and sg settings included all calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 207
diff changeset
672 connect(ui->brew_aboilvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_aboilvol_changed);
212
8b84dd3579ef Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents: 210
diff changeset
673 connect(ui->brew_aboilButton, SIGNAL(clicked()), this, SLOT(brew_aboil_button()));
210
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
674 connect(ui->brew_coolwithEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::brew_cooling_method_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
675 connect(ui->brew_cooltoEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_cooling_to_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
676 connect(ui->brew_cooltimeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_cooling_time_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
677 connect(ui->brew_whirlpool9Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_whirlpool9_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
678 connect(ui->brew_whirlpool7Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_whirlpool7_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
679 connect(ui->brew_whirlpool6Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_whirlpool6_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
680 connect(ui->brew_whirlpool2Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_whirlpool2_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
681 connect(ui->brew_aerwithEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::brew_aerwith_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
682 connect(ui->brew_aerspeedEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_aerspeed_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
683 connect(ui->brew_aertimeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_aertime_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
684 connect(ui->brew_trublossEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_trubloss_changed);
b45bd6da5220 Implemented brewday change cooling, aeration, whirlpool and fermenter volumes values. All editable values on the brewday tab are now functional.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
685 connect(ui->brew_topupwaterEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_topupwater_changed);
213
a167ee979cac Added brew_log popup window.
Michiel Broek <mbroek@mbse.eu>
parents: 212
diff changeset
686 connect(ui->brew_logButton, SIGNAL(clicked()), this, SLOT(brew_log_button()));
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
687
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
688 /* All signals from tab Fermentation */
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
689 connect(ui->prim_startCEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::primary_start_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
690 connect(ui->prim_maxCEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::primary_peak_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
691 connect(ui->prim_endCEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::primary_end_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
692 connect(ui->prim_endsgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::primary_sg_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
693 connect(ui->prim_endsgButton, SIGNAL(clicked()), this, SLOT(primary_sg_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
694 connect(ui->prim_enddateEdit, &QDateEdit::dateChanged, this, &EditProduct::primary_date_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
695 connect(ui->prim_enddateButton, SIGNAL(clicked()), this, SLOT(primary_date_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
696 connect(ui->prim_ackButton, SIGNAL(clicked()), this, SLOT(primary_date_ack()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
697 connect(ui->sec_tempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::secondary_temp_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
698 connect(ui->sec_sgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::secondary_sg_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
699 connect(ui->sec_sgButton, SIGNAL(clicked()), this, SLOT(secondary_sg_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
700 connect(ui->sec_enddateEdit, &QDateEdit::dateChanged, this, &EditProduct::secondary_date_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
701 connect(ui->sec_enddateButton, SIGNAL(clicked()), this, SLOT(secondary_date_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
702 connect(ui->sec_ackButton, SIGNAL(clicked()), this, SLOT(secondary_date_ack()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
703 connect(ui->tert_tempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::tertiary_temp_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
704 connect(ui->tert_sgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::tertiary_sg_changed);
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
705 connect(ui->tert_sgButton, SIGNAL(clicked()), this, SLOT(tertiary_sg_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
706 connect(ui->ferm_log1Button, SIGNAL(clicked()), this, SLOT(ferm_log1_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
707 connect(ui->ferm_log2Button, SIGNAL(clicked()), this, SLOT(ferm_log2_button()));
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
708
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
709 /* All signals from tab Package */
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
710 calcPack();
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
711 connect(ui->pack_dateEdit, &QDateEdit::dateChanged, this, &EditProduct::pack_date_changed);
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
712 connect(ui->pack_dateButton, SIGNAL(clicked()), this, SLOT(pack_date_button()));
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
713 connect(ui->pack_ackButton, SIGNAL(clicked()), this, SLOT(pack_date_ack()));
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
714 connect(ui->pack_volumeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::pack_volume_changed);
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
715 connect(ui->pack_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::pack_ph_changed);
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
716 connect(ui->pack_addvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::pack_infusion_vol_changed);
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
717 connect(ui->pack_addabvEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::pack_infusion_abv_changed);
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
718 connect(ui->pack_notesEdit, &QLineEdit::textChanged, this, &EditProduct::pack_infusion_txt_changed);
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
719 connect(ui->pack_abvShow, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::pack_abv_changed);
221
54828816233f Added bottles priming calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
720 connect(ui->bottle_volumeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::bottle_volume_changed);
54828816233f Added bottles priming calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
721 connect(ui->bottle_carbEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::bottle_co2_changed);
54828816233f Added bottles priming calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
722 connect(ui->bottle_sugarEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::bottle_sugar_changed);
54828816233f Added bottles priming calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
723 connect(ui->bottle_sug_waterEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::bottle_water_changed);
54828816233f Added bottles priming calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
724 connect(ui->bottle_tempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::bottle_temp_changed);
223
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
725 connect(ui->keg_volumeEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::kegs_volume_changed);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
726 connect(ui->keg_carbEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::kegs_co2_changed);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
727 connect(ui->keg_sugarEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::kegs_sugar_changed);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
728 connect(ui->keg_sug_waterEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::kegs_water_changed);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
729 connect(ui->keg_tempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::kegs_temp_changed);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
730 connect(ui->keg_forcedEdit, &QCheckBox::stateChanged, this, &EditProduct::kegs_forced_changed);
297
c8f0ecc8a1cc Added co2pressure (carbonation) log graph.
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
731 connect(ui->carb_logButton, SIGNAL(clicked()), this, SLOT(carb_log_button()));
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
732
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
733 /* All signals from tab Tasting */
225
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
734 connect(ui->taste_dateEdit, &QDateEdit::dateChanged, this, &EditProduct::taste_date_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
735 connect(ui->taste_dateButton, SIGNAL(clicked()), this, SLOT(taste_date_button()));
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
736 connect(ui->taste_ackButton, SIGNAL(clicked()), this, SLOT(taste_date_ack()));
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
737 connect(ui->taste_rateEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::taste_rate_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
738 connect(ui->taste_colorEdit, &QLineEdit::textChanged, this, &EditProduct::taste_color_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
739 connect(ui->taste_transparencyEdit, &QLineEdit::textChanged, this, &EditProduct::taste_transparency_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
740 connect(ui->taste_headEdit, &QLineEdit::textChanged, this, &EditProduct::taste_head_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
741 connect(ui->taste_aromaEdit, &QLineEdit::textChanged, this, &EditProduct::taste_aroma_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
742 connect(ui->taste_tasteEdit, &QLineEdit::textChanged, this, &EditProduct::taste_taste_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
743 connect(ui->taste_mouthfeelEdit, &QLineEdit::textChanged, this, &EditProduct::taste_mouthfeel_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
744 connect(ui->taste_aftertasteEdit, &QLineEdit::textChanged, this, &EditProduct::taste_aftertaste_changed);
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
745 connect(ui->taste_notesEdit, SIGNAL(textChanged()), this, SLOT(taste_notes_changed()));
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
746
184
da148d6b4c95 Added brewday boil box. The setLocked function changed into setStage. Fixed bug that resetted the efficiency to the equipment default.
Michiel Broek <mbroek@mbse.eu>
parents: 183
diff changeset
747 setStage();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
748
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 ui->saveButton->setEnabled(false);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750 ui->deleteButton->setEnabled((id >= 0 && ! product->locked) ? true:false);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756 EditProduct::~EditProduct()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 qDebug() << "EditProduct done start";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
759 delete ui;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
760 emit entry_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 qDebug() << "EditProduct done final";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
762 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764
190
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
765 void EditProduct::calcSupplies()
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
766 {
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
767 if (product->inventory_reduced > PROD_STAGE_PACKAGE) {
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
768 ui->ok_pmptLabel->setVisible(false);
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
769 ui->ok_pmptIcon->setVisible(false);
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
770 return;
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
771 }
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
772
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
773 qDebug() << "calcSupplies() f:" << product->fermentables_ok << "h:" << product->hops_ok << "m:" << product->miscs_ok << "y:" << product->yeasts_ok << "w:" << product->waters_ok;
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
774 if (product->fermentables_ok && product->hops_ok && product->miscs_ok && product->yeasts_ok && product->waters_ok) {
190
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
775 ui->ok_pmptIcon->setPixmap(QPixmap(QString::fromUtf8(":/icons/silk/tick.png")));
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
776 } else {
191
7446ee2fb427 Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents: 190
diff changeset
777 ui->ok_pmptIcon->setPixmap(QPixmap(QString::fromUtf8(":/icons/silk/cancel.png")));
190
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
778 }
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
779 }
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
780
bb6c06910f0f Added calcSupplies() which shows if ingredients are in stock to brew the recipe. In tab 3, changed the fermentables numbers into more readable enum constants. Disable delete and edit buttons in fermentables rows for bottle and kegs sugars. Better mash time calculation in calcFermentables. Added check supplies. Added recalculate volumes. Update inventory when a fermentable is replaced. Added tooltips in brewing salts fields in the miscs table.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
781
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
782 void EditProduct::refreshAll()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
783 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
784 refreshFermentables();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785 calcFermentables(); /* Must be before Hops */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
786 refreshHops();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 refreshMiscs();
194
ea8cce5e7eb9 Added calcMiscs(). In miscs check supplies. Update inventory check when setting a new brewing salt. Use enum constants to make code more readable.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
789 calcMiscs();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
790 refreshYeasts();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 calcYeast();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792 calcMash();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 refreshMashs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
794 refreshWaters();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
795 calcWater();
191
7446ee2fb427 Added hops inventory check. Include all whirlpool steps in ibu calculations. Calculate the ibus in the fermenter including top up water. Use enum constants for the hops. Update the invenory state when replacing a hop.
Michiel Broek <mbroek@mbse.eu>
parents: 190
diff changeset
796 calcSupplies();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
797 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
798
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
799
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 * Window header, mark any change with '**'
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
802 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 void EditProduct::WindowTitle()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
804 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
805 QString txt;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
806
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
807 if (this->recno < 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
808 txt = QString(tr("BMSapp - Add new product"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
809 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
810 txt = QString(tr("BMSapp - Edit product %1").arg(this->recno));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
811 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
812
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
813 if (this->textIsChanged) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 txt.append((QString(" **")));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
816 setWindowTitle(txt);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
817 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
819
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
820 void EditProduct::on_saveButton_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
821 {
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
822 /*
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
823 * If there are errors in the form, show a message and do "return;"
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
824 */
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
825 if (ui->nameEdit->text().length() < 2) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
826 QMessageBox::warning(this, tr("Edit Product"), tr("Name empty or too short."));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 if (ui->st_nameEdit->text().length() < 2) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830 QMessageBox::warning(this, tr("Edit Product"), tr("No beerstyle selected."));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
831 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
832 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 if (this->textIsChanged) {
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
835 product->record = this->recno;
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
836 if (DB_product::save(product, this)) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837 /*
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
838 * If this was a new record, update the global recno.
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
839 */
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
840 this->recno = product->record;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841 }
305
35ce719998e1 Added reduce inventory for all process stages. Added block fermentable to block buttons and inventory when the fermentable has been reduced. Added block hop to block buttons and inventory when the fermentable has been reduced. Added block misc to block buttons and inventory when the fermentable has been reduced. Added block yeast to block buttons and inventory when the fermentable has been reduced.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
842 inventory_reduce();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
843 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
844
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
845 ui->saveButton->setEnabled(false);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
846 this->textIsChanged = false;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
847 WindowTitle();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
848 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
849
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
850
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
851 #include "EditProductTab1.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
852 #include "EditProductTab2.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
853 #include "EditProductTab3.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
854 #include "EditProductTab4.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
855 #include "EditProductTab5.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
856 #include "EditProductTab6.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
857 #include "EditProductTab7.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
858 #include "EditProductTab8.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
859 #include "EditProductTab9.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
860 #include "EditProductTab10.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
861 #include "EditProductTab11.cpp"
225
448e4187cada Implemented the tasting tab. On the generic tab, show the ingredients check or the read only prompt on the same place depending on the product stage. Fixed the yeasts ingredients in stock check. Reordered the tab order of all edit fields. It looks like this module is ready and needs testing.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
862 #include "EditProductTab12.cpp"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
863 #include "EditProductExport.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
864
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
865
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
866 void EditProduct::on_deleteButton_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
867 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
868 int rc = QMessageBox::warning(this, tr("Delete product"), tr("Delete %1").arg(product->name),
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
869 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
870 if (rc == QMessageBox::No)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
871 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
872
248
1a7a5dffba58 Moved product record load, save and delete to a separate file and use passed record data.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
873 DB_product::dele(this, this->recno);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
874
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
875 this->close();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
876 this->setResult(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
877 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
878
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
879
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
880 void EditProduct::is_changed()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
881 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
882 ui->saveButton->setEnabled(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
883 ui->deleteButton->setEnabled(((this->recno >= 0) ? true:false) && ! product->locked);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
884 this->textIsChanged = true;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
885 WindowTitle();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
886 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
887
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
888
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
889 void EditProduct::on_quitButton_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
890 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
891 if (this->textIsChanged) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
892 int rc = QMessageBox::warning(this, tr("Product changed"), tr("The product has been modified. Save changes?"),
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
893 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
894 switch (rc) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
895 case QMessageBox::Save:
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
896 on_saveButton_clicked();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
897 break; /* Saved and then Quit */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
898 case QMessageBox::Discard:
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
899 break; /* Quit without Save */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
900 case QMessageBox::Cancel:
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
901 return; /* Return to the editor page */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
902 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
903 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
904
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
905 this->close();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
906 this->setResult(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
907 }

mercurial