src/EditEquipment.cpp

Sat, 08 Jun 2024 15:54:30 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 08 Jun 2024 15:54:30 +0200
changeset 527
84091b9cb800
parent 462
1654ff5446c7
permissions
-rw-r--r--

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.

30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditEquipment.cpp is part of bmsapp.
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
17 #include "MainWindow.h"
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "EditEquipment.h"
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "../ui/ui_EditEquipment.h"
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
20 #include "global.h"
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 EditEquipment::EditEquipment(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditEquipment)
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 QSqlQuery query, query2;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 qDebug() << "EditEquipment record:" << id;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 ui->setupUi(this);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 this->recno = id;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 WindowTitle();
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
32
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
33 for (int i = 0; i < 4; i++)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
34 ui->tun_materialEdit->addItem(QCoreApplication::translate("TunMaterial", g_tun_materials[i]));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
35
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
36 for (int i = 0; i < 5; i++)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
37 ui->chiller_typeEdit->addItem(QCoreApplication::translate("ChillerType", g_chiller_types[i]));
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 if (id >= 0) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 query.prepare("SELECT * FROM inventory_equipments WHERE record = :recno");
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 query.bindValue(":recno", id);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 query.exec();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 query.next();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
45 ui->nameEdit->setText(query.value("name").toString());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
46 ui->boil_sizeEdit->setValue(query.value("boil_size").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
47 ui->batch_sizeEdit->setValue(query.value("batch_size").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
48 ui->tun_volumeEdit->setValue(query.value("tun_volume").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
49 ui->tun_weightEdit->setValue(query.value("tun_weight").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
50 ui->tun_specific_heatEdit->setValue(query.value("tun_specific_heat").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
51 ui->tun_materialEdit->setCurrentIndex(query.value("tun_material").toInt());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
52 ui->tun_heightEdit->setValue(query.value("tun_height").toDouble() * 100.0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
53 ui->top_up_waterEdit->setValue(query.value("top_up_water").toDouble());
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
54 ui->trub_lossEdit->setValue(query.value("trub_loss").toDouble());
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
55 ui->evap_rateEdit->setValue(query.value("evap_rate").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
56 ui->boil_timeEdit->setValue(query.value("boil_time").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
57 ui->top_up_kettleEdit->setValue(query.value("top_up_kettle").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
58 ui->notesEdit->setPlainText(query.value("notes").toString());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
59 ui->lauter_deadspaceEdit->setValue(query.value("lauter_deadspace").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
60 ui->kettle_volumeEdit->setValue(query.value("kettle_volume").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
61 ui->kettle_heightEdit->setValue(query.value("kettle_height").toDouble() * 100.0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
62 ui->mash_volumeEdit->setValue(query.value("mash_volume").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
63 ui->mash_maxEdit->setValue(query.value("mash_max").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
64 ui->efficiencyEdit->setValue(query.value("efficiency").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
65 ui->chiller_typeEdit->setCurrentIndex(query.value("chiller_type").toInt());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
66 ui->chiller_to79Edit->setValue(query.value("chiller_to79").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
67 ui->chiller_lossEdit->setValue(query.value("chiller_loss").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
68 ui->chiller_volumeEdit->setValue(query.value("chiller_volume").toDouble());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
69 ui->chiller_lpmEdit->setValue(query.value("chiller_lpm").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: 462
diff changeset
70 ui->HLT_volumeEdit->setValue(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: 462
diff changeset
71 ui->HLT_deadspaceEdit->setValue(query.value("HLT_deadspace").toDouble());
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 /*
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 * Now we have loaded this record, check if this equipment is
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 * being used by a product. If so, make the name field read-only.
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 query2.prepare("SELECT eq_name FROM products WHERE eq_name=:name");
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
77 query2.bindValue(":name", query.value("name").toString());
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 query2.exec();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 inuse = query2.size();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 ui->nameEdit->setReadOnly(inuse > 0);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 } else {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 /* Set some defaults */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 ui->boil_sizeEdit->setValue(18);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 ui->batch_sizeEdit->setValue(15.3);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 ui->tun_volumeEdit->setValue(20);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 ui->tun_weightEdit->setValue(2);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 ui->tun_specific_heatEdit->setValue(0.11);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 ui->tun_materialEdit->setCurrentIndex(0);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 ui->tun_heightEdit->setValue(20);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 ui->top_up_waterEdit->setValue(0);
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
91 ui->trub_lossEdit->setValue(0.5);
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 ui->evap_rateEdit->setValue(1.8);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 ui->boil_timeEdit->setValue(90);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 ui->top_up_kettleEdit->setValue(0);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 ui->lauter_deadspaceEdit->setValue(0.5);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 ui->kettle_volumeEdit->setValue(20);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 ui->kettle_heightEdit->setValue(20);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 ui->mash_volumeEdit->setValue(18);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 ui->mash_maxEdit->setValue(6);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 ui->efficiencyEdit->setValue(75);
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
101 ui->chiller_typeEdit->setCurrentIndex(1);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
102 ui->chiller_to79Edit->setValue(10);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
103 ui->chiller_lossEdit->setValue(0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
104 ui->chiller_volumeEdit->setValue(0.5);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
105 ui->chiller_lpmEdit->setValue(0);
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: 462
diff changeset
106 ui->HLT_volumeEdit->setValue(20);
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: 462
diff changeset
107 ui->HLT_deadspaceEdit->setValue(2);
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 inuse = 0;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 }
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
110 /* Block select no chiller used */
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
111 qobject_cast<QStandardItemModel*>(ui->chiller_typeEdit->model())->item(CHILLER_TYPE_NONE)->setEnabled(false);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
112 chiller_setup(ui->chiller_typeEdit->currentIndex());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
113
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 connect(ui->boil_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 connect(ui->tun_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 connect(ui->tun_weightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 connect(ui->tun_materialEdit, &QComboBox::currentTextChanged, this, &EditEquipment::material_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 connect(ui->tun_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 connect(ui->top_up_waterEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
122 connect(ui->trub_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 connect(ui->evap_rateEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 connect(ui->boil_timeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 connect(ui->top_up_kettleEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed()));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 connect(ui->lauter_deadspaceEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 connect(ui->kettle_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 connect(ui->kettle_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 connect(ui->mash_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 connect(ui->mash_maxEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
133 connect(ui->chiller_typeEdit, &QComboBox::currentTextChanged, this, &EditEquipment::chiller_changed);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
134 connect(ui->chiller_to79Edit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
135 connect(ui->chiller_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
136 connect(ui->chiller_lpmEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
137 connect(ui->chiller_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
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: 462
diff changeset
138 connect(ui->HLT_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
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: 462
diff changeset
139 connect(ui->HLT_deadspaceEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 calcBatchVolume();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 ui->saveButton->setEnabled(false);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 ui->deleteButton->setEnabled((inuse == 0 && id >= 0) ? true:false);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 EditEquipment::~EditEquipment()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 delete ui;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 emit entry_changed();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 /*
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 * Window header, mark any change with '**'
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 void EditEquipment::WindowTitle()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 QString txt;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 if (this->recno < 0) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 txt = QString(tr("BMSapp - Add new equipment"));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 } else {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 txt = QString(tr("BMSapp - Edit equipment %1").arg(this->recno));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 if (this->textIsChanged) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 txt.append((QString(" **")));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 setWindowTitle(txt);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 void EditEquipment::on_saveButton_clicked()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 QSqlQuery query;
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
177 QString sql = "";
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 /* If there are errors in the form, show a message and do "return;" */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 if (ui->nameEdit->text().length() < 2) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 QMessageBox::warning(this, tr("Edit Equipment"), tr("Name empty or too short."));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 return;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 if (this->textIsChanged) {
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
186 if (this->recno == -1) {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
187 sql = "INSERT INTO";
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
188 } else {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
189 sql = "UPDATE";
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
190 }
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
191 sql.append(" inventory_equipments SET name=:name, boil_size=:boil_size, "
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
194 "top_up_water=:top_up_water, trub_loss=:trub_loss, evap_rate=:evap_rate, "
462
1654ff5446c7 Removed the last bits of equipent calc_volume setting. Changed to the equipment setup screen using suffixes in the fields. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 458
diff changeset
195 "boil_time=:boil_time, top_up_kettle=:top_up_kettle, "
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
196 "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
198 "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, "
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: 462
diff changeset
199 "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss, "
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: 462
diff changeset
200 "HLT_volume=:HLT_volume, HLT_deadspace=:HLT_deadspace");
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
201 if (this->recno == -1) {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
202 sql.append(", uuid=:uuid");
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
203 } else {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
204 sql.append(" WHERE record = :recno");
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
205 }
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
206 query.prepare(sql);
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 query.bindValue(":name", ui->nameEdit->text());
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 query.bindValue(":boil_size", QString("%1").arg(ui->boil_sizeEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 query.bindValue(":batch_size", QString("%1").arg(ui->batch_sizeEdit->value(), 3, 'f', 2, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 query.bindValue(":tun_volume", QString("%1").arg(ui->tun_volumeEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 query.bindValue(":tun_weight", QString("%1").arg(ui->tun_weightEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 query.bindValue(":tun_specific_heat", QString("%1").arg(ui->tun_specific_heatEdit->value(), 4, 'f', 3, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 query.bindValue(":tun_material", ui->tun_materialEdit->currentIndex());
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0'));
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
216 query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0'));
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 query.bindValue(":notes", ui->notesEdit->toPlainText());
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 query.bindValue(":mash_volume", QString("%1").arg(ui->mash_volumeEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 query.bindValue(":mash_max", QString("%1").arg(ui->mash_maxEdit->value(), 2, 'f', 1, '0'));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 query.bindValue(":efficiency", QString("%1").arg(ui->efficiencyEdit->value(), 2, 'f', 1, '0'));
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
227 query.bindValue(":chiller_type", ui->chiller_typeEdit->currentIndex());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
228 query.bindValue(":chiller_to79", QString("%1").arg(ui->chiller_to79Edit->value(), 1, 'f', 0, '0'));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
229 query.bindValue(":chiller_volume", QString("%1").arg(ui->chiller_volumeEdit->value(), 3, 'f', 2, '0'));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
230 query.bindValue(":chiller_lpm", QString("%1").arg(ui->chiller_lpmEdit->value(), 3, 'f', 2, '0'));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
231 query.bindValue(":chiller_loss", QString("%1").arg(ui->chiller_lossEdit->value(), 3, 'f', 2, '0'));
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: 462
diff changeset
232 query.bindValue(":HLT_volume", QString("%1").arg(ui->HLT_volumeEdit->value(), 2, 'f', 1, '0'));
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: 462
diff changeset
233 query.bindValue(":HLT_deadspace", QString("%1").arg(ui->HLT_deadspaceEdit->value(), 2, 'f', 1, '0'));
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
234
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 if (this->recno == -1) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 } else {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 query.bindValue(":recno", this->recno);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 query.exec();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 if (query.lastError().isValid()) {
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
242 qWarning() << "EditEquipment" << query.lastError();
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 QMessageBox::warning(this, tr("Database error"),
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 tr("MySQL error: %1\n%2\n%3")
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 .arg(query.lastError().nativeErrorCode())
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 .arg(query.lastError().driverText())
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 .arg(query.lastError().databaseText()));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 } else {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 qDebug() << "EditEquipment Saved";
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 ui->saveButton->setEnabled(false);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 this->textIsChanged = false;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 WindowTitle();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
259 void EditEquipment::on_cloneButton_clicked()
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
260 {
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
261 QSqlQuery query;
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
262
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
263 query.prepare("INSERT INTO inventory_equipments SET name=:name, boil_size=:boil_size, "
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
264 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
265 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
266 "top_up_water=:top_up_water, trub_loss=:trub_loss, evap_rate=:evap_rate, "
462
1654ff5446c7 Removed the last bits of equipent calc_volume setting. Changed to the equipment setup screen using suffixes in the fields. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 458
diff changeset
267 "boil_time=:boil_time, top_up_kettle=:top_up_kettle, "
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
268 "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
269 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
270 "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, "
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: 462
diff changeset
271 "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss, "
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: 462
diff changeset
272 "HLT_volume=:HLT_volume, HLT_deadspace=:HLT_deadspace, uuid=:uuid");
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
273
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
274 query.bindValue(":name", ui->nameEdit->text() + " [copy]");
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
275 query.bindValue(":boil_size", QString("%1").arg(ui->boil_sizeEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
276 query.bindValue(":batch_size", QString("%1").arg(ui->batch_sizeEdit->value(), 3, 'f', 2, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
277 query.bindValue(":tun_volume", QString("%1").arg(ui->tun_volumeEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
278 query.bindValue(":tun_weight", QString("%1").arg(ui->tun_weightEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
279 query.bindValue(":tun_specific_heat", QString("%1").arg(ui->tun_specific_heatEdit->value(), 4, 'f', 3, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
280 query.bindValue(":tun_material", ui->tun_materialEdit->currentIndex());
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
281 query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
282 query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0'));
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
283 query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0'));
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
284 query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
285 query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
286 query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
287 query.bindValue(":notes", ui->notesEdit->toPlainText());
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
288 query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
289 query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
290 query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
291 query.bindValue(":mash_volume", QString("%1").arg(ui->mash_volumeEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
292 query.bindValue(":mash_max", QString("%1").arg(ui->mash_maxEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
293 query.bindValue(":efficiency", QString("%1").arg(ui->efficiencyEdit->value(), 2, 'f', 1, '0'));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
294 query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
295 query.bindValue(":chiller_type", ui->chiller_typeEdit->currentIndex());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
296 query.bindValue(":chiller_to79", QString("%1").arg(ui->chiller_to79Edit->value(), 1, 'f', 0, '0'));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
297 query.bindValue(":chiller_volume", QString("%1").arg(ui->chiller_volumeEdit->value(), 3, 'f', 2, '0'));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
298 query.bindValue(":chiller_lpm", QString("%1").arg(ui->chiller_lpmEdit->value(), 3, 'f', 2, '0'));
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
299 query.bindValue(":chiller_loss", QString("%1").arg(ui->chiller_lossEdit->value(), 3, 'f', 2, '0'));
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: 462
diff changeset
300 query.bindValue(":HLT_volume", QString("%1").arg(ui->HLT_volumeEdit->value(), 2, 'f', 1, '0'));
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: 462
diff changeset
301 query.bindValue(":HLT_deadspace", QString("%1").arg(ui->HLT_deadspaceEdit->value(), 2, 'f', 1, '0'));
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
302 query.exec();
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
303 if (query.lastError().isValid()) {
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
304 qWarning() << "EditEquipment" << query.lastError();
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
305 QMessageBox::warning(this, tr("Database error"),
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
306 tr("MySQL error: %1\n%2\n%3")
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
307 .arg(query.lastError().nativeErrorCode())
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
308 .arg(query.lastError().driverText())
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
309 .arg(query.lastError().databaseText()));
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
310 } else {
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
311 qDebug() << "EditEquipment Saved";
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
312 }
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
313 }
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
314
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
315
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 void EditEquipment::on_deleteButton_clicked()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 QSqlQuery query;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
320 int rc = QMessageBox::warning(this, tr("Delete equipment"), tr("Delete %1").arg(ui->nameEdit->text()),
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
321 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
322 if (rc == QMessageBox::No)
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
323 return;
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
324
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 query.prepare("DELETE FROM inventory_equipments WHERE record = :recno");
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 query.bindValue(":recno", this->recno);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 query.exec();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 if (query.lastError().isValid()) {
385
09af9f46518f All profile and inventory editors now log warnings if something went wrong. Also added a Clone button. Delete now asks for confirmation.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
329 qWarning() << "EditEquipment" << query.lastError();
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 QMessageBox::warning(this, tr("Database error"),
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 tr("MySQL error: %1\n%2\n%3")
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 .arg(query.lastError().nativeErrorCode())
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 .arg(query.lastError().driverText())
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 .arg(query.lastError().databaseText()));
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 } else {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 qDebug() << "EditEquipment Deleted" << this->recno;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 this->close();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 this->setResult(1);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 void EditEquipment::calcBatchVolume()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 double batch = ui->boil_sizeEdit->value() - (ui->evap_rateEdit->value() * ui->boil_timeEdit->value() / 60) + ui->top_up_kettleEdit->value();
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
347 double fermenter = round(((batch / 1.04) + ui->top_up_waterEdit->value() - ui->trub_lossEdit->value() - ui->chiller_lossEdit->value()) * 100) / 100.0;
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 batch = round(batch * 100) / 100.0;
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
349 if (ui->batch_sizeEdit->value() != batch)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
350 qDebug() << "Batch volue updated to" << batch;
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 ui->batch_sizeEdit->setValue(batch);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 ui->vol_fermenterEdit->setValue(fermenter);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 void EditEquipment::is_changed()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 calcBatchVolume();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 ui->saveButton->setEnabled(true);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 ui->deleteButton->setEnabled((inuse == 0 && this->recno >= 0) ? true:false);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 this->textIsChanged = true;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 WindowTitle();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 void EditEquipment::material_changed()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 switch (ui->tun_materialEdit->currentIndex()) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 case 0: ui->tun_specific_heatEdit->setValue(0.11); break;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 case 1: ui->tun_specific_heatEdit->setValue(0.22); break;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 case 2: ui->tun_specific_heatEdit->setValue(0.46); break;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 case 3: ui->tun_specific_heatEdit->setValue(0.092); break;
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 is_changed();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
378 void EditEquipment::chiller_setup(int val)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
379 {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
380 if (val == CHILLER_TYPE_IMMERSION) {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
381 ui->chiller_volumeEdit->setReadOnly(false);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
382 ui->chiller_volumeEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
383 ui->chiller_volumeEdit->setFixedSize(101, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
384 if (ui->chiller_volumeEdit->value() == 0)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
385 ui->chiller_volumeEdit->setValue(0.5);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
386 } else {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
387 ui->chiller_volumeEdit->setReadOnly(true);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
388 ui->chiller_volumeEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
389 ui->chiller_volumeEdit->setFixedSize(86, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
390 ui->chiller_volumeEdit->setValue(0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
391 }
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
392
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
393 if (val == CHILLER_TYPE_COUNTERFLOW) {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
394 ui->chiller_to79Edit->setReadOnly(true);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
395 ui->chiller_to79Edit->setButtonSymbols(QAbstractSpinBox::NoButtons);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
396 ui->chiller_to79Edit->setFixedSize(86, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
397 ui->chiller_to79Edit->setValue(0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
398
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
399 ui->chiller_lpmEdit->setReadOnly(false);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
400 ui->chiller_lpmEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
401 ui->chiller_lpmEdit->setFixedSize(101, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
402 if (ui->chiller_lpmEdit->value() == 0)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
403 ui->chiller_lpmEdit->setValue(2.5);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
404
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
405 ui->chiller_lossEdit->setReadOnly(false);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
406 ui->chiller_lossEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
407 ui->chiller_lossEdit->setFixedSize(101, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
408 if (ui->chiller_lossEdit->value() == 0)
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: 419
diff changeset
409 ui->chiller_lossEdit->setValue(0.4);
419
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
410
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
411 } else {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
412 ui->chiller_to79Edit->setReadOnly(false);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
413 ui->chiller_to79Edit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
414 ui->chiller_to79Edit->setFixedSize(101, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
415 int time = 5;
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
416 if (val == CHILLER_TYPE_AUBAINMARIE)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
417 time = 20;
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
418 if (val == CHILLER_TYPE_NOCHILL)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
419 time = 240;
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
420 if (ui->chiller_to79Edit->value() == 0)
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
421 ui->chiller_to79Edit->setValue(time);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
422
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
423 ui->chiller_lpmEdit->setReadOnly(true);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
424 ui->chiller_lpmEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
425 ui->chiller_lpmEdit->setFixedSize(86, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
426 ui->chiller_lpmEdit->setValue(0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
427
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
428 ui->chiller_lossEdit->setReadOnly(true);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
429 ui->chiller_lossEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
430 ui->chiller_lossEdit->setFixedSize(86, 24);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
431 ui->chiller_lossEdit->setValue(0);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
432 }
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
433 }
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
434
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
435
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
436 void EditEquipment::chiller_changed()
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
437 {
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
438 const QSignalBlocker blocker1(ui->chiller_to79Edit);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
439 const QSignalBlocker blocker2(ui->chiller_volumeEdit);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
440 const QSignalBlocker blocker3(ui->chiller_lpmEdit);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
441 const QSignalBlocker blocker4(ui->chiller_lossEdit);
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
442
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
443 chiller_setup(ui->chiller_typeEdit->currentIndex());
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
444 is_changed();
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
445 }
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
446
d49f38cc76a0 The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
447
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 void EditEquipment::on_quitButton_clicked()
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449 {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450 if (this->textIsChanged) {
60
0d65238ebedc Updated translations and some messages.
Michiel Broek <mbroek@mbse.eu>
parents: 30
diff changeset
451 int rc = QMessageBox::warning(this, tr("Equipment changed"), tr("This equipment has been modified. Save changes?"),
30
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
452 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453 switch (rc) {
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454 case QMessageBox::Save:
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
455 on_saveButton_clicked();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456 break; /* Saved and then Quit */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 case QMessageBox::Discard:
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 break; /* Quit without Save */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459 case QMessageBox::Cancel:
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 return; /* Return to the editor page */
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 }
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464 this->close();
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 this->setResult(1);
0fec6a1abd13 Added inventory equipment table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466 }

mercurial