src/EditProductTab2.cpp

Sun, 09 Jun 2024 17:00:00 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 09 Jun 2024 17:00:00 +0200
changeset 532
082786891630
parent 530
a4d5daae8389
permissions
-rw-r--r--

Don't update sparge volume when brew is done. Disabled some debug messages.

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 * Tab 2, equipment settings.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * 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
7 * 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
8 * 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
9 * (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
10 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * 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
12 * 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
13 * 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
14 * 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
15 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * 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
17 * 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
18 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
21 void EditProduct::showEquipment()
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
22 {
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
23 ui->eq_nameEdit->setText(product->eq_name);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
24 ui->eq_notesEdit->setPlainText(product->eq_notes);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
25
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
26 /* Mashing */
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
27 ui->tun_volumeEdit->setValue(product->eq_tun_volume);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
28 ui->tun_materialEdit->setText(QCoreApplication::translate("TunMaterial", g_tun_materials[product->eq_tun_material]));
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
29 ui->mash_volumeEdit->setValue(product->eq_mash_volume);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
30 ui->mash_maxEdit->setValue(product->eq_mash_max);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
31 ui->lauter_deadspaceEdit->setValue(product->eq_lauter_deadspace);
527
84091b9cb800 Version 0.4.6a1. Added HLT equipment volume and deadspace settings. In EditProduct the target water selection is now sticky. Changed the water treatment tab. Added a row wich displays the salt adjustments. This can be selected between actual and target values. The treated water show can select between mash or sparge water. The total line will become the final water in the boil kettle. Database update function is expanded with the new settings. Added a popup message warning that the database is upgraded and user action is required for the equipment profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 461
diff changeset
32 ui->HLT_volumeEdit->setValue(product->eq_HLT_volume);
84091b9cb800 Version 0.4.6a1. Added HLT equipment volume and deadspace settings. In EditProduct the target water selection is now sticky. Changed the water treatment tab. Added a row wich displays the salt adjustments. This can be selected between actual and target values. The treated water show can select between mash or sparge water. The total line will become the final water in the boil kettle. Database update function is expanded with the new settings. Added a popup message warning that the database is upgraded and user action is required for the equipment profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 461
diff changeset
33 ui->HLT_deadspaceEdit->setValue(product->eq_HLT_deadspace);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
34
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
35 /* Boiling */
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
36 ui->kettle_volumeEdit->setValue(product->eq_kettle_volume);
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
37 ui->kettle_lossEdit->setValue(product->eq_trub_loss);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
38 ui->eqboil_sizeEdit->setValue(product->eq_boil_size);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
39 ui->evap_rateEdit->setValue(product->eq_evap_rate);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
40 ui->eqboil_timeEdit->setValue(product->eq_boil_time);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
41 ui->topup_kettleEdit->setValue(product->eq_top_up_kettle);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
42 ui->eqbatch_sizeEdit->setValue(product->eq_batch_size);
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
43
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
44 /* Chilling */
423
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
45 ui->chiller_typeEdit->setText(QCoreApplication::translate("ChillerType", g_chiller_types[product->eq_chiller_type]));
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 429
diff changeset
46 ui->brew_coolwithShow->setText(QCoreApplication::translate("ChillerType", g_chiller_types[product->eq_chiller_type]));
423
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
47 ui->chiller_to79Edit->setValue(product->eq_chiller_to79);
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
48 ui->chiller_volumeEdit->setValue(product->eq_chiller_volume);
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
49 ui->chiller_lpmEdit->setValue(product->eq_chiller_lpm);
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
50 ui->chiller_lossEdit->setValue(product->eq_chiller_loss);
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
51
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
52 /* Transfer */
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
53 ui->topup_waterEdit->setValue(product->eq_top_up_water);
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
54 ui->vol_fermenterEdit->setValue((product->eq_batch_size / 1.04) - product->eq_trub_loss - product->eq_chiller_loss);
527
84091b9cb800 Version 0.4.6a1. Added HLT equipment volume and deadspace settings. In EditProduct the target water selection is now sticky. Changed the water treatment tab. Added a row wich displays the salt adjustments. This can be selected between actual and target values. The treated water show can select between mash or sparge water. The total line will become the final water in the boil kettle. Database update function is expanded with the new settings. Added a popup message warning that the database is upgraded and user action is required for the equipment profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 461
diff changeset
55 ui->eq_efficiencyEdit->setValue(product->eq_efficiency);
176
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
56 }
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
57
69a033e099a2 Tab 2 equipent, all editfields placed.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
58
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
59 void EditProduct::initEquipment()
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
60 {
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
61 QSqlQuery query;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
62
529
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
63 /*
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
64 * First see if we need to upgrade HLT settings.
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
65 * Test for default settings, change if possible.
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
66 */
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
67 if (product->eq_HLT_volume == 20 && product->eq_HLT_deadspace == 2) {
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
68 query.prepare("SELECT name,HLT_volume,HLT_deadspace FROM inventory_equipments WHERE name=:name");
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
69 query.bindValue(":name", product->eq_name);
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
70 query.exec();
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
71 if (query.next()) {
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
72 product->eq_HLT_volume = query.value("HLT_volume").toDouble();
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
73 product->eq_HLT_deadspace = query.value("HLT_deadspace").toDouble();
530
a4d5daae8389 Version 0.4.6b1 Update product with calculated sparge supply. This value is now only calculated from the desired sparge estimate plus HLT deadspace. Fixed brewing salts for sparge read-only after brewday. The final water displays the mixed mash and sparge water profile, almost the same as what goes into the boil kettle. The Cl/SO4 ratio display now works on the final water.
Michiel Broek <mbroek@mbse.eu>
parents: 529
diff changeset
74 qDebug() << "== Update equipment HLT settings" << product->eq_HLT_volume << product->eq_HLT_deadspace;
529
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
75 is_changed();
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
76 }
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
77 }
7c9fb24bcc07 Some code cleanup. Upgrade HLT settings during product load if the default settings are detected.
Michiel Broek <mbroek@mbse.eu>
parents: 527
diff changeset
78
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
79 ui->eq_selectEdit->addItem("");
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
80 query.prepare("SELECT name FROM inventory_equipments ORDER BY name");
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
81 query.exec();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
82 while (query.next()) {
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
83 ui->eq_selectEdit->addItem(query.value(0).toString());
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
84 }
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
85 connect(ui->eq_selectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::eq_changed);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
86
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
87 showEquipment();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
88 }
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
89
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
90
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
91 void EditProduct::eq_changed(int val)
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
92 {
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
93 QSqlQuery query;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
94
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
95 if (val == 0)
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
96 return;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
97
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
98 qDebug() << "equipment changed" << val;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
99 query.prepare("SELECT * FROM inventory_equipments ORDER BY name");
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
100 query.exec();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
101 query.first();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
102
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
103 for (int i; i < (val - 1); i++) {
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
104 query.next();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
105 }
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
106 qDebug() << "got" << query.value("name").toString();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
107
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
108 product->eq_name = query.value("name").toString();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
109 product->eq_notes = query.value("notes").toString();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
110 product->eq_boil_size = query.value("boil_size").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
111 product->eq_batch_size = query.value("batch_size").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
112 product->eq_tun_volume = query.value("tun_volume").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
113 product->eq_tun_weight = query.value("tun_weight").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
114 product->eq_tun_specific_heat = query.value("tun_specific_heat").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
115 product->eq_tun_material = query.value("tun_material").toInt();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
116 product->eq_tun_height = query.value("tun_height").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
117 product->eq_top_up_water = query.value("top_up_water").toDouble();
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 454
diff changeset
118 product->eq_trub_loss = query.value("trub_loss").toDouble();
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
119 product->eq_evap_rate = query.value("evap_rate").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
120 product->eq_boil_time = query.value("boil_time").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
121 product->eq_top_up_kettle = query.value("top_up_kettle").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
122 product->eq_lauter_deadspace = query.value("lauter_deadspace").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
123 product->eq_kettle_volume = query.value("kettle_volume").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
124 product->eq_kettle_height = query.value("kettle_height").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
125 product->eq_mash_volume = query.value("mash_volume").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
126 product->eq_mash_max = query.value("mash_max").toDouble();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
127 product->eq_efficiency = query.value("efficiency").toDouble();
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 429
diff changeset
128 product->eq_chiller_type = product->brew_cooling_method = query.value("chiller_type").toInt();
423
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
129 product->eq_chiller_to79 = query.value("chiller_to79").toDouble();
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
130 product->eq_chiller_volume = query.value("chiller_volume").toDouble();
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
131 product->eq_chiller_lpm = query.value("chiller_lpm").toDouble();
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
132 product->eq_chiller_loss = query.value("chiller_loss").toDouble();
527
84091b9cb800 Version 0.4.6a1. Added HLT equipment volume and deadspace settings. In EditProduct the target water selection is now sticky. Changed the water treatment tab. Added a row wich displays the salt adjustments. This can be selected between actual and target values. The treated water show can select between mash or sparge water. The total line will become the final water in the boil kettle. Database update function is expanded with the new settings. Added a popup message warning that the database is upgraded and user action is required for the equipment profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 461
diff changeset
133 product->eq_HLT_volume = query.value("HLT_volume").toDouble();
84091b9cb800 Version 0.4.6a1. Added HLT equipment volume and deadspace settings. In EditProduct the target water selection is now sticky. Changed the water treatment tab. Added a row wich displays the salt adjustments. This can be selected between actual and target values. The treated water show can select between mash or sparge water. The total line will become the final water in the boil kettle. Database update function is expanded with the new settings. Added a popup message warning that the database is upgraded and user action is required for the equipment profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 461
diff changeset
134 product->eq_HLT_deadspace = query.value("HLT_deadspace").toDouble();
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
135 showEquipment();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
136
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
137 /*
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
138 * Now change some important settings and recalculate the recipe parts.
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
139 */
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
140 double factor = product->eq_batch_size / product->batch_size;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
141 double estog = product->est_og;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
142
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
143 const QSignalBlocker blocker1(ui->batch_sizeEdit);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
144 const QSignalBlocker blocker2(ui->boil_sizeEdit);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
145 const QSignalBlocker blocker3(ui->boil_timeEdit);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
146 const QSignalBlocker blocker4(ui->efficiencyEdit);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
147
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
148 product->boil_size = product->eq_boil_size;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
149 product->boil_time = product->eq_boil_time;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
150 product->batch_size = product->eq_batch_size;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
151 product->efficiency = product->eq_efficiency;
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
152 ui->batch_sizeEdit->setValue(product->batch_size);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
153 ui->boil_sizeEdit->setValue(product->boil_size);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
154 ui->boil_timeEdit->setValue(product->boil_time);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
155 ui->efficiencyEdit->setValue(product->efficiency);
454
2dfead81c72f Version 0.3.3. Removed several obsolete debug messages. IBU and Fermentation calculation debug messages are now controlled by conditional defines in global.h. In the brewday tab update the preboil and afterboil reference volumes. In the brewday tab the chiller type is a read only field directy linked to the selected equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 429
diff changeset
156 ui->brew_preboilvolShow->setValue(product->boil_size * 1.04);
461
add4dbef0c81 On the brewday tab, show the afterboil volume inclusive the volume of the immersion chiller in the wort. Added refractometer buttons on the brewday tab. The brew volume cm edit popup shows a message if a immersion chiller is in the wort.
Michiel Broek <mbroek@mbse.eu>
parents: 458
diff changeset
157 ui->brew_aboilvolShow->setValue(product->batch_size * 1.04 + product->eq_chiller_volume);
189
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
158
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
159 calcFermentablesFromOG(estog);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
160 adjustWaters(factor);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
161 calcFermentables();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
162 adjustHops(factor);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
163 adjustMiscs(factor);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
164 adjustYeasts(factor);
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
165 calcIBUs();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
166 calcWater();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
167 calcMash();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
168 is_changed();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
169 emit refreshAll();
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
170 }
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
171
722a4eed545d Added select equipment.
Michiel Broek <mbroek@mbse.eu>
parents: 184
diff changeset
172

mercurial