src/EditProduct.cpp

Tue, 05 Jul 2022 14:31:39 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 05 Jul 2022 14:31:39 +0200
changeset 336
e97f9e87d94b
parent 333
499c95108bbd
child 341
1b1e2d4c1a3e
permissions
-rw-r--r--

IBU method names are now global.

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"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "EditProduct.h"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #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
20 #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
21 #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
22 #include "ChartiSpindel.h"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include "../ui/ui_EditProduct.h"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "Utils.h"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 #include "global.h"
266
5f0782149028 Added export product to forum.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
26 #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
27 #include "database/db_product.h"
265
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 264
diff changeset
28 #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
29
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 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
32 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 QSqlQuery query, wquery, yquery;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
35 qDebug() << "EditProduct record:" << id;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 product = new Product;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 ui->setupUi(this);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 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
39 product->fermentables_use100 = false;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 this->recno = id;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 WindowTitle();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 ui->typeEdit->addItem(tr("Extract"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 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
46 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
47
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 ui->color_methodEdit->addItem("Morey");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 ui->color_methodEdit->addItem("Mosher");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 ui->color_methodEdit->addItem("Daniels");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 ui->color_methodEdit->addItem("Halberstadt");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 ui->color_methodEdit->addItem("Naudts");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
54 for (int i = 0; i < 3; i++)
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
55 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
56
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 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
58 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
59 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
60 }
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 ui->sp_sourceEdit->addItem(tr("Source 1"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 ui->sp_sourceEdit->addItem(tr("Source 2"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 ui->sp_sourceEdit->addItem(tr("Mixed"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 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
67 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 ui->w1_nameEdit->addItem("");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 ui->w2_nameEdit->addItem("");
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
70 while (query.next()) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 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
72 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
73 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 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
76 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 ui->wt_sourceEdit->addItem("");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 while (query.next()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 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
80 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 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
83 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 ui->mash_pickEdit->addItem("");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 while (query.next()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 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
87 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
89 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
90 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
91 query.exec();
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
92 while (query.next()) {
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 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
94 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95
185
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
96 ui->brew_coolwithEdit->addItem("-");
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
97 ui->brew_coolwithEdit->addItem(tr("Emersion chiller"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
98 ui->brew_coolwithEdit->addItem(tr("Counterflow chiller"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
99 ui->brew_coolwithEdit->addItem(tr("Au bain marie"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
100 ui->brew_coolwithEdit->addItem(tr("Natural"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
101
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
102 ui->brew_aerwithEdit->addItem(tr("None"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
103 ui->brew_aerwithEdit->addItem(tr("Air"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
104 ui->brew_aerwithEdit->addItem(tr("Oxygen"));
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
105
187
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
106 ui->bottle_sugarEdit->addItem("");
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
107 ui->keg_sugarEdit->addItem("");
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
108 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
109 query.exec();
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
110 while (query.next()) {
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
111 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
112 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
113 }
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
114
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 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
116 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
117 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
118 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
119
296
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 * Check status of logfiles.
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
122 */
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
123 if (product->stage > PROD_STAGE_BREW) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
124 if (! product->log_brew) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
125 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
126 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
127 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
128 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
129 qDebug() << "should update log_brews";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
130 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
131 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
132 if (! product->log_fermentation) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
133 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
134 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
135 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
136 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
137 qDebug() << "should update log_fermenter";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
138 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
139 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
140 if (! product->log_ispindel) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
141 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
142 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
143 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
144 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
145 qDebug() << "should update log_ispindel";
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 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
148 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
149 if (product->stage > PROD_STAGE_PACKAGE) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
150 if (! product->log_co2pressure) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
151 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
152 query.bindValue(":code", product->code);
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
153 query.exec();
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
154 if (query.first()) {
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
155 qDebug() << "should update log_co2pressure";
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
156 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
157 }
2f4e250cfed9 Added fermenter and iSpindel graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 266
diff changeset
158 }
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 } else {
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
161 /* 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
162 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
163 product->record = -1;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
164 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
165 product->st_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 product->st_letter = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 product->st_guide = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 product->st_category = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 product->st_category_number = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 product->st_type = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178 product->eq_tun_specific_heat = 0.11;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
179 product->eq_tun_material = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
180 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
181 product->eq_tun_weight = 2;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
182 product->eq_top_up_water = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
183 product->eq_trub_chiller_loss = 0.5;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
184 product->eq_evap_rate = 1.8;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
185 product->eq_calc_boil_volume = true;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
186 product->eq_top_up_kettle = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
187 product->eq_hop_utilization = 100;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
188 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
189 product->eq_lauter_deadspace = 0.5;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
190 product->eq_mash_max = 6;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
191 product->eq_efficiency = 75;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
192 product->birth = QDate::currentDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
193 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
194 product->notes = "";
227
7966bf14cc34 Implemented insert a new product. Fixed missing product code edit slot.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
195 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
196 product->efficiency = 75;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
197 product->eq_batch_size = product->batch_size = 20;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
198 product->eq_boil_time = product->boil_time = 60;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
199 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
200 product->type = 2;
181
14a1f7bca79b Added missing est_og3 database field load and save. Added all extra fields in update and insert product. Renamed est_og3Edit on tab 3 to est_og4Edit because est_og3Edit is reserved for the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 179
diff changeset
201 product->est_og = product->est_og3 = product->est_fg = product->est_color = product->est_ibu = product->est_abv = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
202 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
203 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
204 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
205 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
206 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
207 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
208 product->brew_cooling_to = 20;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
209 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
210 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
211 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
212 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
213 product->og = product->fg = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
214 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
215 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
216 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
217 product->package_date = QDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
218 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
219 product->package_infuse_notes = "";
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
220 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
221 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
222 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
223 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
224 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
225 product->taste_rate = 0;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
226 product->taste_date = QDate();
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
227 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
228 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
229 product->sparge_temp = 80;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 product->sparge_ph = 5.4;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 product->sparge_volume = 8;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 product->sparge_source = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 product->sparge_acid_type = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 product->sparge_acid_perc = 80;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 product->sparge_acid_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 product->mash_ph = 5.4;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 product->mash_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 product->calc_acid = true;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 product->w1_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 product->w1_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 product->w1_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 product->w1_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 product->w1_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 product->w1_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 product->w1_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 product->w1_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 product->w1_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 product->w1_cost = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 product->w2_name = "";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 product->w2_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 product->w2_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 product->w2_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 product->w2_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 product->w2_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 product->w2_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 product->w2_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 product->w2_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 product->w2_cost = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 product->wg_amount = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 product->wg_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 product->wg_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 product->wg_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 product->wg_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 product->wg_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 product->wg_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 product->wg_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 product->wb_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 product->wb_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 product->wb_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 product->wb_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 product->wb_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 product->wb_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 product->wb_ph = 7;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 product->wa_acid_name = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 product->wa_acid_perc = 80;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 product->wa_base_name = 0;
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
277 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
278 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
279 product->starter_viability = 100;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
280 product->starter_sg = 1.037;
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
281 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
282 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
283 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
284 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
285 product->divide_factor = 1;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 // Tab generic.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 ui->lockedEdit->setChecked(product->locked);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 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
291 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
292 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
293 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
294 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
295 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
296 ui->nameEdit->setText(product->name);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
297 ui->codeEdit->setText(product->code);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
298 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
299 ui->notesEdit->setPlainText(product->notes);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 ui->typeEdit->setCurrentIndex(product->type);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 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
302 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
303 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
304 ui->efficiencyEdit->setValue(product->efficiency);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
305 if (product->divide_type > 0)
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 297
diff changeset
306 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
307 .arg(product->divide_part + 1)
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
308 .arg(product->divide_parts + 1)));
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
309 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 297
diff changeset
310 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
311 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
312 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
313 ui->est_ogShow->setPrecision(3);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 ui->est_ogShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 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
316 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
317 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
318 ui->est_fgShow->setPrecision(3);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 ui->est_fgShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 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
321 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
322 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
323 ui->est_abvShow->setPrecision(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 ui->est_abvShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 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
326 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
327 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
328 ui->est_colorShow->setPrecision(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 ui->est_colorShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 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
331 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
332 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
333 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
334 ui->est_ibuShow->setPrecision(0);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 ui->est_ibuShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 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
337 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
338 ui->ibu_methodEdit->setCurrentIndex(product->ibu_method);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 ui->est_carbEdit->setValue(product->est_carb);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 ui->est_carbShow->setPrecision(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 ui->est_carbShow->setMarkerTextIsValue(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 ui->est_carbShow->setRange(product->st_carb_min, product->st_carb_max);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 ui->est_carbShow->setValue(product->est_carb);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
345 // Tab equipment.
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 188
diff changeset
346 initEquipment();
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
347
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 // Tab fermentables.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 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
350 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
351 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
352
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 // Tab hops.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 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
355
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 // Tab yeasts.
195
9887278c4fbe The framework to calculate yeast starters added.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
357 initYeast();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 // Tab mashs.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 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
361
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 // Tab waters.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363 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
364 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
365 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 * 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
367 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 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
369 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 bool found = false;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 if (product->w1_name != "") {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 * 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
374 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 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
376 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
377 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 found = query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 if (!found) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 * Try to load default water
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 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
385 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
386 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 found = query.first();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 if (found) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 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
391 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
392 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
393 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
394 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
395 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
396 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
397 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
398 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 product->w1_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 product->w1_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 product->w1_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 product->w1_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 product->w1_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 product->w1_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 product->w1_ph = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 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
409 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
410 ui->w1_mgEdit->setValue(product->w1_magnesium);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 ui->w1_hco3Edit->setValue(product->w1_total_alkalinity * 1.22);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 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
413 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
414 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
415 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
416 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
417
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 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
419 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
420 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
421 } else if (product->w2_name != "") {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422 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
423 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
424 query.exec();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425 if (query.first()) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
435 product->w2_calcium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 product->w2_magnesium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
437 product->w2_total_alkalinity = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 product->w2_sodium = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 product->w2_chloride = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 product->w2_sulfate = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 product->w2_ph = 0;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 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
445 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
446 ui->w2_mgEdit->setValue(product->w2_magnesium);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 ui->w2_hco3Edit->setValue(product->w2_total_alkalinity * 1.22);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 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
449 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
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 ui->mw_acidvolEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459 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
460 ui->sp_tempEdit->setValue(product->sparge_temp);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 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
462 ui->sp_sourceEdit->setCurrentIndex(product->sparge_source);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463 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
464 ui->sp_acidpercEdit->setValue(product->sparge_acid_perc);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 ui->sp_acidvolEdit->setValue(product->sparge_acid_amount);
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
466 check_waters();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
467
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
468 // Tab brewday.
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
469 updateBrewday();
182
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
470 ui->brew_mashphEdit->setValue(product->brew_mash_ph);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
471 ui->brew_mashphShow->setValue(product->mash_ph);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
472 ui->brew_mashsgEdit->setValue(product->brew_mash_sg);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
473 ui->brew_mashsgShow->setValue(0);
545d31130844 Added brewday mash results box.
Michiel Broek <mbroek@mbse.eu>
parents: 181
diff changeset
474 ui->brew_masheffShow->setValue(product->brew_mash_efficiency);
183
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
475 ui->brew_spargetempShow->setValue(product->sparge_temp);
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
476 ui->brew_spargevolShow->setValue(product->sparge_volume);
bce87b8b604b Added brewday sparge and lauter results box.
Michiel Broek <mbroek@mbse.eu>
parents: 182
diff changeset
477 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
478 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
479 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
480
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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 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
498
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
499 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
500 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
501 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
502 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
503 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
504 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
505 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
506
405bb68c1ea4 Added the last groupboxes on the brewday tab.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
507 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
508 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
509 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
510
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
511 // Tab fermentation.
186
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
512 ui->prim_ogShow->setValue(product->brew_fermenter_sg);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
513 ui->prim_startCEdit->setValue(product->primary_start_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
514 ui->prim_maxCEdit->setValue(product->primary_max_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
515 ui->prim_endCEdit->setValue(product->primary_end_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
516 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
517 ui->prim_enddateEdit->setDate(product->primary_end_date);
186
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
518 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
519 ui->sec_tempEdit->setValue(product->secondary_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
520 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
521 ui->sec_enddateEdit->setDate(product->secondary_end_date);
186
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
522 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
523 ui->tert_tempEdit->setValue(product->tertiary_temp);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
524 ui->tert_estsgShow->setValue(product->est_fg);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
525 ui->tert_sgEdit->setValue(product->fg);
96e239584db5 Created the tab fermentation.
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
526 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
527 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
528
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
529 // Tab packaging.
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
530 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
531 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
532 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
533 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
534 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
535 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
536 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
537 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
538 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
539 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
540
91af2c697345 Completed the design of the package and taste tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
541 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
542 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
543 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
544 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
545 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
546
223
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
547 ui->keg_volumeEdit->setValue(product->keg_amount);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
548 ui->keg_carbEdit->setValue(product->keg_carbonation);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
549 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
550 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
551 ui->keg_tempEdit->setValue(product->keg_carbonation_temp);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
552 ui->keg_forcedEdit->setChecked(product->keg_forced_carb);
37bac72eff61 Added keg priming and forced carbonation.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
553
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
554 // 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
555 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
556 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
557 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
558 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
559 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
560 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
561 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
562 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
563 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
564 ui->taste_aftertasteEdit->setText(product->taste_aftertaste);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
565
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
566 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
567
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568 // All signals from tab "Generic"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
569 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
570 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
571 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
572 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
573 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
574 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
575 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
576 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
577 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
578 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
579 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
580 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
581 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
582
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 // All signals from tab "Fermentables"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 ui->fermentablesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 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
586 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
587 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
588 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
589 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
590 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
591
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 // All signals from tab "Hops"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 ui->hopsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 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
595 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
596 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
597
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 // All signals from tab "Miscs"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599 ui->miscsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 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
601
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
602 // All signals from tab "Yeasts"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
603 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
604 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
605 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
606 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
607 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
608 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
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 "Mash"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 ui->mashsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
612 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
613 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
614 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
615
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616 // All signals from tab "Water"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617 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
618 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
619 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
620 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
621 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
622 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
623 connect(ui->bs_caco3Edit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::wb_caco3_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 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
625 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
626 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
627 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
628 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
629 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
630 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
631 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
632 connect(ui->sp_volEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_volume_changed);
67b5c00dd23c Added slots for sparge water volume and temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
633 connect(ui->sp_tempEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_temp_changed);
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
634 connect(ui->sp_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::sp_source_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
635 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
636 connect(ui->sp_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::sp_ph_changed);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
637
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
638 /* 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
639 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
640 calcEfficiencyAfterBoil();
205
ae6109192fb2 First changes for brewdate date edit.
Michiel Broek <mbroek@mbse.eu>
parents: 204
diff changeset
641 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
642 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
643 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
644 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
645 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
646 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
647 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
648 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
649 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
650 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
651 connect(ui->brew_spargephEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::brew_spargeph_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
652 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
653 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
654 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
655 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
656 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
657 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
658 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
659 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
660 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
661 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
662 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
663 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
664 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
665 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
666 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
667 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
668 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
669 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
670 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
671 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
672 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
673
219
fa7cad488e27 Added fermentation stages data. The two graphs are for later.
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
674 /* 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
675 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
676 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
677 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
678 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
679 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
680 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
681 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
682 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
683 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
684 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
685 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
686 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
687 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
688 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
689 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
690 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
691 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
692 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
693 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
694
220
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
695 /* All signals from tab Package */
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
696 calcPack();
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
697 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
698 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
699 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
700 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
701 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
702 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
703 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
704 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
705 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
706 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
707 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
708 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
709 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
710 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
711 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
712 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
713 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
714 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
715 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
716 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
717 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
718
7792a410a277 Added first part of the package tab.
Michiel Broek <mbroek@mbse.eu>
parents: 219
diff changeset
719 /* 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
720 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
721 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
722 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
723 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
724 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
725 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
726 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
727 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
728 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
729 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
730 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
731 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
732
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
733 setStage();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 ui->saveButton->setEnabled(false);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
736 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
737
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 emit refreshAll();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 EditProduct::~EditProduct()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
744 qDebug() << "EditProduct done start";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745 delete ui;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746 emit entry_changed();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
747 qDebug() << "EditProduct done final";
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750
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
751 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
752 {
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
753 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
754 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
755 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
756 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
757 }
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
758
307
afd711e37f68 Log product code and name instead of record number. Added water supply check.
Michiel Broek <mbroek@mbse.eu>
parents: 305
diff changeset
759 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
760 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
761 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
762 } 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
763 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
764 }
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 }
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
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 void EditProduct::refreshAll()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
769 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
770 refreshFermentables();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
771 calcFermentables(); /* Must be before Hops */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 refreshHops();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 calcIBUs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
774 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
775 calcMiscs();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776 refreshYeasts();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
777 calcYeast();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
778 calcMash();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 refreshMashs();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780 refreshWaters();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
781 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
782 calcSupplies();
175
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
786 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787 * 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
788 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
789 void EditProduct::WindowTitle()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
790 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 QString txt;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 if (this->recno < 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
794 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
795 } else {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
796 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
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 if (this->textIsChanged) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800 txt.append((QString(" **")));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
802 setWindowTitle(txt);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 }
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
806 void EditProduct::on_saveButton_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
807 {
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
808 /*
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
809 * 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
810 */
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
811 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
812 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
813 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815 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
816 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
817 return;
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 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
821 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
822 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
823 /*
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
824 * 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
825 */
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
826 this->recno = product->record;
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 }
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
828 inventory_reduce();
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
831 ui->saveButton->setEnabled(false);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
832 this->textIsChanged = false;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833 WindowTitle();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
835
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
836
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837 #include "EditProductTab1.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
838 #include "EditProductTab2.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
839 #include "EditProductTab3.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
840 #include "EditProductTab4.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841 #include "EditProductTab5.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
842 #include "EditProductTab6.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
843 #include "EditProductTab7.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
844 #include "EditProductTab8.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
845 #include "EditProductTab9.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
846 #include "EditProductTab10.cpp"
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
847 #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
848 #include "EditProductTab12.cpp"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
849 #include "EditProductExport.cpp"
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
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
852 void EditProduct::on_deleteButton_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
853 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
854 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
855 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
856 if (rc == QMessageBox::No)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
857 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
858
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
859 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
860
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
861 this->close();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
862 this->setResult(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
863 }
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::is_changed()
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 ui->saveButton->setEnabled(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
869 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
870 this->textIsChanged = true;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
871 WindowTitle();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
872 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
873
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 void EditProduct::on_quitButton_clicked()
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
876 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
877 if (this->textIsChanged) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
878 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
879 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
880 switch (rc) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
881 case QMessageBox::Save:
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
882 on_saveButton_clicked();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
883 break; /* Saved and then Quit */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
884 case QMessageBox::Discard:
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
885 break; /* Quit without Save */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
886 case QMessageBox::Cancel:
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
887 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
888 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
889 }
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 this->close();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
892 this->setResult(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
893 }

mercurial