src/EditRecipeTab3.cpp

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

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 18 Aug 2022 20:34:15 +0200
changeset 401
583148eb6e01
parent 376
81ae1b4e25db
child 454
2dfead81c72f
permissions
-rw-r--r--

Init est_carb field for new products.

127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditRecipe.cpp is part of bmsapp.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Tab 3, hops
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 bool EditRecipe::hop_sort_test(const Hops &D1, const Hops &D2)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
24 if (D1.useat > D2.useat)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 return false;
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
26 if (D1.useat < D2.useat)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 return true;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 /* Same useat moments, test time. */
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
29 if (D1.time < D2.time)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 return false;
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
31 if (D1.time > D2.time)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 return true;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 /* Finally consider the amounts */
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
34 return (D1.amount > D2.amount);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 void EditRecipe::refreshHops()
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 QString w;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 QWidget* pWidget;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 QHBoxLayout* pLayout;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 QTableWidgetItem *item;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 qDebug() << "refreshHops" << recipe->hops.size();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 std::sort(recipe->hops.begin(), recipe->hops.end(), hop_sort_test);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 const QStringList labels({tr("Origin"), tr("Hop"), tr("Type"), tr("Form"), tr("Alpha"), tr("Use at"), tr("Time"),
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 tr("IBU"), tr("Amount"), tr("Delete"), tr("Edit") });
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 ui->hopsTable->setColumnCount(11);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 ui->hopsTable->setColumnWidth(0, 150); /* Origin */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 ui->hopsTable->setColumnWidth(1, 225); /* Hop */
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
54 ui->hopsTable->setColumnWidth(2, 84); /* Type */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
55 ui->hopsTable->setColumnWidth(3, 84); /* Form */
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 ui->hopsTable->setColumnWidth(4, 75); /* Alpha% */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 ui->hopsTable->setColumnWidth(5, 75); /* Added */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 ui->hopsTable->setColumnWidth(6, 75); /* Time */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 ui->hopsTable->setColumnWidth(7, 60); /* IBU */
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
60 ui->hopsTable->setColumnWidth(8, 90); /* Amount */
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 ui->hopsTable->setColumnWidth(9, 80); /* Delete */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 ui->hopsTable->setColumnWidth(10, 80); /* Edit */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 ui->hopsTable->setHorizontalHeaderLabels(labels);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 ui->hopsTable->verticalHeader()->hide();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 ui->hopsTable->setRowCount(recipe->hops.size());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 for (int i = 0; i < recipe->hops.size(); i++) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
69 ui->hopsTable->setItem(i, 0, new QTableWidgetItem(recipe->hops.at(i).origin));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
70 ui->hopsTable->setItem(i, 1, new QTableWidgetItem(recipe->hops.at(i).name));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
72 item = new QTableWidgetItem(QCoreApplication::translate("HopTypes", g_hop_types[recipe->hops.at(i).type]));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 ui->hopsTable->setItem(i, 2, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
76 item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[recipe->hops.at(i).form]));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ui->hopsTable->setItem(i, 3, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
80 item = new QTableWidgetItem(QString("%1%").arg(recipe->hops.at(i).alpha, 2, 'f', 1, '0'));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 ui->hopsTable->setItem(i, 4, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
84 item = new QTableWidgetItem(QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 ui->hopsTable->setItem(i, 5, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
88 if (recipe->hops.at(i).useat == 2 || recipe->hops.at(i).useat == 4) { // Boil or whirlpool
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
89 item = new QTableWidgetItem(QString("%1 min.").arg(recipe->hops.at(i).time, 1, 'f', 0, '0'));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
90 } else if (recipe->hops.at(i).useat == 5) { // Dry-hop
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
91 item = new QTableWidgetItem(QString("%1 days.").arg(recipe->hops.at(i).time / 1440, 1, 'f', 0, '0'));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 } else {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 item = new QTableWidgetItem(QString(""));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 ui->hopsTable->setItem(i, 6, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
98 double ibu = Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->est_og,
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
99 recipe->batch_size, recipe->hops.at(i).amount,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
100 recipe->hops.at(i).time, recipe->hops.at(i).alpha, recipe->ibu_method, 0, recipe->hops.at(i).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
101 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(i).utilisation, recipe->hops.at(i).bu_factor);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 ui->hopsTable->setItem(i, 7, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
106 if (recipe->hops.at(i).amount < 1.0) {
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
107 item = new QTableWidgetItem(QString("%1 gr").arg(recipe->hops.at(i).amount * 1000.0, 2, 'f', 1, '0'));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 } else {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
109 item = new QTableWidgetItem(QString("%1 kg").arg(recipe->hops.at(i).amount, 4, 'f', 3, '0'));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 ui->hopsTable->setItem(i, 8, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 /* Add the Delete row button */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 pWidget = new QWidget();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 QPushButton* btn_dele = new QPushButton();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 btn_dele->setText(tr("Delete"));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
119 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteHopRow_clicked()));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 pLayout = new QHBoxLayout(pWidget);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 pLayout->addWidget(btn_dele);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 pLayout->setContentsMargins(5, 0, 5, 0);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 pWidget->setLayout(pLayout);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 ui->hopsTable->setCellWidget(i, 9, pWidget);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 pWidget = new QWidget();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 QPushButton* btn_edit = new QPushButton();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 btn_edit->setText(tr("Edit"));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
130 connect(btn_edit, SIGNAL(clicked()), this, SLOT(editHopRow_clicked()));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 pLayout = new QHBoxLayout(pWidget);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 pLayout->addWidget(btn_edit);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 pLayout->setContentsMargins(5, 0, 5, 0);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 pWidget->setLayout(pLayout);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 ui->hopsTable->setCellWidget(i, 10, pWidget);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
140 void EditRecipe::hop_Flavour_valueChanged(int value)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 if (value < 20) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 ui->hop_tasteShow->setStyleSheet(bar_20);
230
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
144 ui->hop_tasteShow->setFormat(tr("Very low"));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 } else {
230
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
146 double s1 = 20.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
147 if (value < 40) {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
148 ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
149 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #008C00, stop: 1 #008C00);}").arg(s1).arg(s1));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
150 ui->hop_tasteShow->setFormat(tr("Low"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
151 } else {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
152 double s2 = 40.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
153 if (value < 60) {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
154 ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
155 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: 1 #008C00"
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
156 ");}").arg(s1).arg(s1).arg(s2).arg(s2));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
157 ui->hop_tasteShow->setFormat(tr("Moderate"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
158 } else {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
159 double s3 = 60.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
160 if (value < 80) {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
161 ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
162 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
163 "stop: %6 #00AC00, stop: 1 #00AC00"
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
164 ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
165 ui->hop_tasteShow->setFormat(tr("High"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
166 } else {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
167 double s4 = 80.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
168 ui->hop_tasteShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
169 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
170 "stop: %6 #00AC00, stop: %7 #00AC00, stop: %8 #00CC00, stop: 1 #00CC00"
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
171 ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3).arg(s4).arg(s4));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
172 ui->hop_tasteShow->setFormat(tr("Very high"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
173 }
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
174 }
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
175 }
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
180 void EditRecipe::hop_Aroma_valueChanged(int value)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 if (value < 20) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 ui->hop_aromaShow->setStyleSheet(bar_20);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 ui->hop_aromaShow->setFormat(tr("Very low"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 } else {
230
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
186 double s1 = 20.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
187 if (value < 40) {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
188 ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
189 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #008C00, stop: 1 #008C00);}").arg(s1).arg(s1));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
190 ui->hop_aromaShow->setFormat(tr("Low"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
191 } else {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
192 double s2 = 40.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
193 if (value < 60) {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
194 ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
195 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: 1 #008C00"
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
196 ");}").arg(s1).arg(s1).arg(s2).arg(s2));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
197 ui->hop_aromaShow->setFormat(tr("Moderate"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
198 } else {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
199 double s3 = 60.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
200 if (value < 80) {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
201 ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
202 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
203 "stop: %6 #00AC00, stop: 1 #00AC00"
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
204 ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
205 ui->hop_aromaShow->setFormat(tr("High"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
206 } else {
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
207 double s4 = 80.0 / value;
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
208 ui->hop_aromaShow->setStyleSheet(QString("QProgressBar::chunk {background-color: qlineargradient(x0: 0, x2: 1, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
209 "stop: 0 #004D00, stop: %1 #004D00, stop: %2 #006C00, stop: %3 #006C00, stop: %4 #008C00, stop: %5 #008C00, "
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
210 "stop: %6 #00AC00, stop: %7 #00AC00, stop: %8 #00CC00, stop: 1 #00CC00"
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
211 ");}").arg(s1).arg(s1).arg(s2).arg(s2).arg(s3).arg(s3).arg(s4).arg(s4));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
212 ui->hop_aromaShow->setFormat(tr("Very high"));
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
213 }
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
214 }
b68c0c61d261 Rewritten the hop taste and aroma progress bars to use a gradient.
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
215 }
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 void EditRecipe::calcIBUs()
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 double hop_flavour = 0, hop_aroma = 0, ibus = 0;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 for (int i = 0; i < recipe->hops.size(); i++) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
226 ibus += Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->est_og, recipe->batch_size,
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
227 recipe->hops.at(i).amount,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
228 recipe->hops.at(i).time, recipe->hops.at(i).alpha, recipe->ibu_method, 0, recipe->hops.at(i).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
229 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(i).utilisation, recipe->hops.at(i).bu_factor);
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
230 hop_flavour += Utils::hopFlavourContribution(recipe->hops.at(i).time, recipe->batch_size, recipe->hops.at(i).useat,
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
231 recipe->hops.at(i).amount, recipe->hops.at(i).form);
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
232 hop_aroma += Utils::hopAromaContribution(recipe->hops.at(i).time, recipe->batch_size, recipe->hops.at(i).useat,
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
233 recipe->hops.at(i).amount, recipe->hops.at(i).form);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 hop_flavour = round(hop_flavour * 1000.0 / 5.0) / 10;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 hop_aroma = round(hop_aroma * 1000.0 / 6.0) / 10;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 if (hop_flavour > 100)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 hop_flavour = 100;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 if (hop_aroma > 100)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 hop_aroma = 100;
150
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
242 qDebug() << "ibu" << recipe->est_ibu << ibus << "flavour" << hop_flavour << "aroma" << hop_aroma << "method" << recipe->ibu_method;
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 recipe->est_ibu = ibus;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 ui->est_ibuEdit->setValue(recipe->est_ibu);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 ui->est_ibu2Edit->setValue(recipe->est_ibu);
151
b5b2483f3a3f New recipe, calculate the boil_size. Lot's of ignoreChanges removeals and where needed QSignalBlocker is used. Bottle priming calculation added. In fermentables editor block and release to100 settings only in mash to fermentation steps, bottle and kegging are ignored. Update the IBU slider after hop changes. Set the mash name when another mash profile is selected. Don't backup initial infuse amount if there was no mash table. A small cosmetic layout change on the mash tab.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
247 ui->est_ibuShow->setValue(recipe->est_ibu);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 ui->hop_tasteShow->setValue(hop_flavour);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 ui->hop_aromaShow->setValue(hop_aroma);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
253 void EditRecipe::addHopRow_clicked()
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 Hops newh;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 qDebug() << "Add hop row";
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 for (int i = 0; i < recipe->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
260 if (recipe->hops.at(i).amount == 0 && recipe->hops.at(i).alpha == 0)
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 return; // Add only one at a time.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
264 newh.name = "Select one";
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
265 newh.origin = "";
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
266 newh.amount = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
267 newh.cost = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
268 newh.type = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
269 newh.form = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
270 newh.useat = 2;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
271 newh.time = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
272 newh.alpha = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
273 newh.beta = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
274 newh.hsi = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
275 newh.humulene = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
276 newh.caryophyllene = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
277 newh.cohumulone = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
278 newh.myrcene = 0;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
279 newh.total_oil = 0;
376
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
280 newh.utilisation = 20;
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
281 newh.bu_factor = 1;
129
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
282
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
283 recipe->hops.append(newh);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 emit refreshAll();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
288 void EditRecipe::deleteHopRow_clicked()
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 {
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
290 if (recipe->locked || recipe->hops.size() < 1)
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
291 return;
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
292
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 int row = pb->objectName().toInt();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 qDebug() << "Delete hop row" << row << recipe->hops.size();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
297 int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(recipe->hops.at(row).name),
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 if (rc == QMessageBox::No)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 return;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301
129
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
302 recipe->hops.removeAt(row);
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
303 is_changed();
a9c19eaab018 Blocked hop table edit. Implemented add and delete hop rows. Started the ui of the water tab.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
304 emit refreshAll();
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 void EditRecipe::hop_amount_changed(double val)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 QTableWidgetItem *item;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
312 recipe->hops[recipe->hops_row].amount = val / 1000.0;
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 item = new QTableWidgetItem(QString("%1 gr").arg(val, 2, 'f', 1, '0'));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 ui->hopsTable->setItem(recipe->hops_row, 8, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
317 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).useat, recipe->hops.at(recipe->hops_row).form, recipe->preboil_sg, recipe->est_og,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
318 recipe->batch_size, recipe->hops.at(recipe->hops_row).amount, recipe->hops.at(recipe->hops_row).time,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
319 recipe->hops.at(recipe->hops_row).alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
320 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(recipe->hops_row).utilisation, recipe->hops.at(recipe->hops_row).bu_factor);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 ibuEdit->setValue(ibu);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 ui->hopsTable->setItem(recipe->hops_row, 7, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 calcIBUs();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
332 void EditRecipe::hop_alpha_changed(double val)
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
333 {
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
334 QTableWidgetItem *item;
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
335
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
336 recipe->hops[recipe->hops_row].alpha = val;
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
337 item = new QTableWidgetItem(QString("%1%").arg(val, 2, 'f', 1, '0'));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
338 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
339 ui->hopsTable->setItem(recipe->hops_row, 4, item);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
340
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
341 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).useat, recipe->hops.at(recipe->hops_row).form, recipe->preboil_sg, recipe->est_og,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
342 recipe->batch_size, recipe->hops.at(recipe->hops_row).amount, recipe->hops.at(recipe->hops_row).time,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
343 recipe->hops.at(recipe->hops_row).alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
344 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(recipe->hops_row).utilisation, recipe->hops.at(recipe->hops_row).bu_factor);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
345
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
346 ibuEdit->setValue(ibu);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
347 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
348 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
349 ui->hopsTable->setItem(recipe->hops_row, 7, item);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
350
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
351 calcIBUs();
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
352 is_changed();
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
353 }
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
354
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
355
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 void EditRecipe::hop_time_changed(int val)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 QTableWidgetItem *item;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
360 if (recipe->hops.at(recipe->hops_row).useat == 2 || recipe->hops.at(recipe->hops_row).useat == 4) { // Boil or whirlpool
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 item = new QTableWidgetItem(QString("%1 min.").arg(val, 1, 'f', 0, '0'));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
362 recipe->hops[recipe->hops_row].time = val;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
363 } else if (recipe->hops.at(recipe->hops_row).useat == 5) { // Dry-hop
164
47ee0d1b47e9 Fixed dry-hop days setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
364 item = new QTableWidgetItem(QString("%1 days.").arg(val, 1, 'f', 0, '0'));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
365 recipe->hops[recipe->hops_row].time = val * 1440;
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 } else {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 item = new QTableWidgetItem(QString(""));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
368 recipe->hops[recipe->hops_row].time = val;
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 ui->hopsTable->setItem(recipe->hops_row, 6, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
373 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).useat, recipe->hops.at(recipe->hops_row).form, recipe->preboil_sg, recipe->est_og,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
374 recipe->batch_size, recipe->hops.at(recipe->hops_row).amount, recipe->hops.at(recipe->hops_row).time,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
375 recipe->hops.at(recipe->hops_row).alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
376 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(recipe->hops_row).utilisation, recipe->hops.at(recipe->hops_row).bu_factor);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 ibuEdit->setValue(ibu);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 ui->hopsTable->setItem(recipe->hops_row, 7, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 calcIBUs();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 void EditRecipe::hop_select_changed(int val)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 QSqlQuery query;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 bool instock = hinstockEdit->isChecked();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 QString w;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 QTableWidgetItem *item;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 if (val < 1)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 return;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 /*
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 * Search the hop pointed by the index and instock flag.
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 */
376
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
401 QString sql = "SELECT * FROM inventory_hops ";
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 if (instock)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 sql.append("WHERE inventory > 0 ");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 sql.append("ORDER BY origin,name");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 query.prepare(sql);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 query.exec();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 query.first();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 for (int i = 0; i < (val - 1); i++) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 query.next();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 /*
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413 * Replace the hop record contents
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414 */
376
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
415 recipe->hops[recipe->hops_row].name = query.value("name").toString();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
416 recipe->hops[recipe->hops_row].origin = query.value("origin").toString();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
417 recipe->hops[recipe->hops_row].alpha = query.value("alpha").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
418 recipe->hops[recipe->hops_row].beta = query.value("beta").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
419 recipe->hops[recipe->hops_row].humulene = query.value("humulene").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
420 recipe->hops[recipe->hops_row].caryophyllene = query.value("caryophyllene").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
421 recipe->hops[recipe->hops_row].cohumulone = query.value("cohumulone").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
422 recipe->hops[recipe->hops_row].myrcene = query.value("myrcene").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
423 recipe->hops[recipe->hops_row].hsi = query.value("hsi").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
424 recipe->hops[recipe->hops_row].total_oil = query.value("total_oil").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
425 recipe->hops[recipe->hops_row].type = query.value("type").toInt();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
426 recipe->hops[recipe->hops_row].form = query.value("form").toInt();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
427 recipe->hops[recipe->hops_row].cost = query.value("cost").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
428 recipe->hops[recipe->hops_row].utilisation = query.value("utilisation").toDouble();
81ae1b4e25db Edit Recipe Hop now properly updates the utilisation and bu_factor fields.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
429 recipe->hops[recipe->hops_row].bu_factor = query.value("bu_factor").toDouble();
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431 /*
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 * Update the visible fields
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433 */
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
434 hnameEdit->setText(recipe->hops.at(recipe->hops_row).name);
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
435 horiginEdit->setText(recipe->hops.at(recipe->hops_row).origin);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
437 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).useat, recipe->hops.at(recipe->hops_row).form, recipe->preboil_sg, recipe->est_og,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
438 recipe->batch_size, recipe->hops.at(recipe->hops_row).amount, recipe->hops.at(recipe->hops_row).time,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
439 recipe->hops.at(recipe->hops_row).alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
440 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(recipe->hops_row).utilisation, recipe->hops.at(recipe->hops_row).bu_factor);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 ibuEdit->setValue(ibu);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
443 ui->hopsTable->setItem(recipe->hops_row, 0, new QTableWidgetItem(recipe->hops.at(recipe->hops_row).origin));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
444 ui->hopsTable->setItem(recipe->hops_row, 1, new QTableWidgetItem(recipe->hops.at(recipe->hops_row).name));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
446 QString hoptype = QCoreApplication::translate("HopTypes", g_hop_types[recipe->hops.at(recipe->hops_row).type]);
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
447 item = new QTableWidgetItem(hoptype);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449 ui->hopsTable->setItem(recipe->hops_row, 2, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
451 item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[recipe->hops.at(recipe->hops_row).form]));
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
452 //item = new QTableWidgetItem(hop_forms[recipe->hops.at(recipe->hops_row).form]);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454 ui->hopsTable->setItem(recipe->hops_row, 3, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
455
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
456 item = new QTableWidgetItem(QString("%1%").arg(recipe->hops.at(recipe->hops_row).alpha, 2, 'f', 1, '0'));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 ui->hopsTable->setItem(recipe->hops_row, 4, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 ui->hopsTable->setItem(recipe->hops_row, 7, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464 calcIBUs();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
467
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
468
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
469 void EditRecipe::hop_instock_changed(bool val)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
470 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
471 QSqlQuery query;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
472
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
473 this->hselectEdit->setCurrentIndex(-1);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
474 this->hselectEdit->clear();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475 QString sql = "SELECT origin,name,alpha,inventory FROM inventory_hops ";
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
476 if (val)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
477 sql.append("WHERE inventory > 0 ");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478 sql.append("ORDER BY origin,name");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
479 query.prepare(sql);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
480 query.exec();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
481 query.first();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
482 this->hselectEdit->addItem(""); // Start with empty value
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
483 for (int i = 0; i < query.size(); i++) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
484 this->hselectEdit->addItem(query.value(0).toString()+" - "+query.value(1).toString()+" ("+query.value(2).toString()+"%) "+
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
485 QString("%1 gr").arg(query.value(3).toDouble() * 1000.0, 2, 'f', 1, '0'));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
486 query.next();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
487 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
488 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
489
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
490
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
491 void EditRecipe::hop_useat_changed(int val)
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
492 {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
493 recipe->hops[recipe->hops_row].useat = val;
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
494 QTableWidgetItem *item = new QTableWidgetItem(QCoreApplication::translate("HopUse", g_hop_useat[val]));
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
495 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
496 ui->hopsTable->setItem(recipe->hops_row, 5, item);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
497
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
498 if (val == 2 || val == 4) { // Boil or whirlpool
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
499 htimeLabel->setText(tr("Time in minutes:"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
500 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).time);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
501 htimeEdit->setReadOnly(false);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 } else if (val == 5) { // Dry-hop
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
503 htimeLabel->setText(tr("Time in days:"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
504 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).time / 1440);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
505 htimeEdit->setReadOnly(false);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
506 } else {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
507 htimeLabel->setText("");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
508 htimeEdit->setValue(0);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
509 htimeEdit->setReadOnly(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
510 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
511
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
512 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
513 emit refreshAll();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
514 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
515
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
516
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
517 void EditRecipe::hop_form_changed(int val)
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
518 {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
519 recipe->hops[recipe->hops_row].form = val;
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
520 QTableWidgetItem *item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[val]));
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
521 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
522 ui->hopsTable->setItem(recipe->hops_row, 3, item);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
523
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
524 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).useat, recipe->hops.at(recipe->hops_row).form, recipe->preboil_sg, recipe->est_og,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
525 recipe->batch_size, recipe->hops.at(recipe->hops_row).amount, recipe->hops.at(recipe->hops_row).time,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
526 recipe->hops.at(recipe->hops_row).alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
527 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(recipe->hops_row).utilisation, recipe->hops.at(recipe->hops_row).bu_factor);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
528
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
529 ibuEdit->setValue(ibu);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
530 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
531 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
532 ui->hopsTable->setItem(recipe->hops_row, 7, item);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
533
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
534 is_changed();
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
535 emit refreshAll();
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
536 }
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
537
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
538
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
539 void EditRecipe::editHopRow_clicked()
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
540 {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
541 QSqlQuery query;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
542
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
543 if (recipe->locked)
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
544 return;
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
545
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 recipe->hops_row = pb->objectName().toInt();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
548 qDebug() << "Edit hop row" << recipe->hops_row;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 Hops backup = recipe->hops.at(recipe->hops_row);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 QDialog* dialog = new QDialog(this);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
552 dialog->resize(738, 260);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
553 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
554 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
555 buttonBox->setGeometry(QRect(30, 210, 671, 32));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
556 buttonBox->setLayoutDirection(Qt::LeftToRight);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
557 buttonBox->setOrientation(Qt::Horizontal);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
558 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
559 buttonBox->setCenterButtons(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
560 QLabel *nameLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 nameLabel->setObjectName(QString::fromUtf8("nameLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
562 nameLabel->setText(tr("Current hop:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
563 nameLabel->setGeometry(QRect(10, 10, 141, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 nameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565 QLabel *originLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
566 originLabel->setObjectName(QString::fromUtf8("originLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 originLabel->setText(tr("Origin:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568 originLabel->setGeometry(QRect(10, 40, 141, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
569 originLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 QLabel *amountLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
571 amountLabel->setObjectName(QString::fromUtf8("amountLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 amountLabel->setText(tr("Amount in gr:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
573 amountLabel->setGeometry(QRect(10, 100, 141, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
574 amountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
575 QLabel *alphaLabel = new QLabel(dialog);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
576 alphaLabel->setObjectName(QString::fromUtf8("alphaLabel"));
263
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 258
diff changeset
577 alphaLabel->setText(tr("Alpha percent:"));
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
578 alphaLabel->setGeometry(QRect(420, 100, 121, 20));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
579 alphaLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 htimeLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
581 htimeLabel->setObjectName(QString::fromUtf8("htimeLabel"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
582 if (recipe->hops.at(recipe->hops_row).useat == 5) // Dry-hop
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 htimeLabel->setText(tr("Time in days:"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
584 else if (recipe->hops.at(recipe->hops_row).useat == 2 || recipe->hops.at(recipe->hops_row).useat == 4) // Boil or whirlpool
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 htimeLabel->setText(tr("Time in minutes:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
586 else
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
587 htimeLabel->setText("");
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
588
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
589 htimeLabel->setGeometry(QRect(10, 130, 141, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
590 htimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
591 QLabel *useatLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 useatLabel->setObjectName(QString::fromUtf8("useatLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 useatLabel->setText(tr("Use at:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 useatLabel->setGeometry(QRect(10, 160, 141, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
596 QLabel *formLabel = new QLabel(dialog);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
597 formLabel->setObjectName(QString::fromUtf8("formLabel"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
598 formLabel->setText(tr("Hop form:"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
599 formLabel->setGeometry(QRect(380, 160, 121, 20));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
600 formLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
601 QLabel *selectLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
602 selectLabel->setObjectName(QString::fromUtf8("selectLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
603 selectLabel->setText(tr("Select hop:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
604 selectLabel->setGeometry(QRect(10, 70, 141, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 selectLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606 QLabel *instockLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
607 instockLabel->setObjectName(QString::fromUtf8("instockLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 instockLabel->setText(tr("In stock:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
609 instockLabel->setGeometry(QRect(525, 70, 121, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 QLabel *ibuLabel = new QLabel(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
612 ibuLabel->setObjectName(QString::fromUtf8("maxLabel"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 ibuLabel->setText(tr("Bitterness IBU:"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
614 ibuLabel->setGeometry(QRect(420, 130, 121, 20));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
615 ibuLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617 hselectEdit = new QComboBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
618 hselectEdit->setObjectName(QString::fromUtf8("selectEdit"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619 hselectEdit->setGeometry(QRect(160, 70, 371, 23));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
620
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 hnameEdit = new QLineEdit(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
622 hnameEdit->setObjectName(QString::fromUtf8("hnameEdit"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
623 hnameEdit->setText(recipe->hops.at(recipe->hops_row).name);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 hnameEdit->setGeometry(QRect(160, 10, 511, 23));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
625 hnameEdit->setReadOnly(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
626 horiginEdit = new QLineEdit(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
627 horiginEdit->setObjectName(QString::fromUtf8("horiginEdit"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
628 horiginEdit->setText(recipe->hops.at(recipe->hops_row).origin);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
629 horiginEdit->setGeometry(QRect(160, 40, 511, 23));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
630 horiginEdit->setReadOnly(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 hamountEdit = new QDoubleSpinBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
632 hamountEdit->setObjectName(QString::fromUtf8("hamountEdit"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
633 hamountEdit->setGeometry(QRect(160, 100, 121, 24));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
634 hamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
635 hamountEdit->setAccelerated(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
636 hamountEdit->setDecimals(1);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
637 hamountEdit->setMaximum(1000000.0);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
638 hamountEdit->setSingleStep(0.5);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
639 hamountEdit->setValue(recipe->hops.at(recipe->hops_row).amount * 1000.0);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
640 halphaEdit = new QDoubleSpinBox(dialog);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
641 halphaEdit->setObjectName(QString::fromUtf8("halphaEdit"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
642 halphaEdit->setGeometry(QRect(550, 100, 121, 24));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
643 halphaEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
644 halphaEdit->setAccelerated(true);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
645 halphaEdit->setDecimals(1);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
646 halphaEdit->setMaximum(100.0);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
647 halphaEdit->setSingleStep(0.1);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
648 halphaEdit->setValue(recipe->hops.at(recipe->hops_row).alpha);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
649 htimeEdit = new QSpinBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
650 htimeEdit->setObjectName(QString::fromUtf8("htimeEdit"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
651 htimeEdit->setGeometry(QRect(160, 130, 121, 24));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
652 htimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
653 htimeEdit->setAccelerated(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
654 htimeEdit->setMaximum(10000.0);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
655 if (recipe->hops.at(recipe->hops_row).useat == 2 || recipe->hops.at(recipe->hops_row).useat == 4) { // Boil or whirlpool
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
656 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).time);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
657 htimeEdit->setReadOnly(false);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
658 } else if (recipe->hops.at(recipe->hops_row).useat == 5){ // Dry-hop
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
659 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).time / 1440);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
660 htimeEdit->setReadOnly(false);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
661 } else {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
662 htimeEdit->setReadOnly(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
663 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
664 useatEdit = new QComboBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
665 useatEdit->setObjectName(QString::fromUtf8("useatEdit"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
666 useatEdit->setGeometry(QRect(160, 160, 161, 23));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
667 useatEdit->addItem(tr("Mash"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
668 useatEdit->addItem(tr("First wort"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
669 useatEdit->addItem(tr("Boil"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
670 useatEdit->addItem(tr("Aroma"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
671 useatEdit->addItem(tr("Whirlpool"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
672 useatEdit->addItem(tr("Dry hop"));
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
673 useatEdit->addItem(tr("Bottling"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
674 useatEdit->setCurrentIndex(recipe->hops.at(recipe->hops_row).useat);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
675
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
676 hformEdit = new QComboBox(dialog);
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
677 hformEdit->setObjectName(QString::fromUtf8("formEdit"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
678 hformEdit->setGeometry(QRect(510, 160, 161, 23));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
679 hformEdit->addItem(tr("Pellet"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
680 hformEdit->addItem(tr("Plug"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
681 hformEdit->addItem(tr("Leaf"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
682 hformEdit->addItem(tr("Wet leaf"));
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
683 hformEdit->addItem(tr("Cryo"));
300
2a97905cb637 Added hop co2 extract form. Added hop add at bottling needed for iso and tetra hop.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
684 hformEdit->addItem(tr("Extract"));
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
685 hformEdit->setCurrentIndex(recipe->hops.at(recipe->hops_row).form);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
686
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
687 hinstockEdit = new QCheckBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
688 hinstockEdit->setObjectName(QString::fromUtf8("hinstockEdit"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
689 hinstockEdit->setGeometry(QRect(655, 70, 85, 21));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
690 hinstockEdit->setChecked(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692 ibuEdit = new QDoubleSpinBox(dialog);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
693 ibuEdit->setObjectName(QString::fromUtf8("ibuEdit"));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
694 ibuEdit->setGeometry(QRect(550, 130, 121, 24));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
695 ibuEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
696 ibuEdit->setReadOnly(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
697 ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 ibuEdit->setDecimals(1);
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
699 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).useat, recipe->hops.at(recipe->hops_row).form, recipe->preboil_sg, recipe->est_og,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
700 recipe->batch_size, recipe->hops.at(recipe->hops_row).amount, recipe->hops.at(recipe->hops_row).time,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
701 recipe->hops.at(recipe->hops_row).alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).time,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
702 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(recipe->hops_row).utilisation, recipe->hops.at(recipe->hops_row).bu_factor);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
703 ibuEdit->setValue(ibu);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
704
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
705 hop_instock_changed(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
706
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
707 connect(hselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::hop_select_changed);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
708 connect(hamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::hop_amount_changed);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
709 connect(halphaEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::hop_alpha_changed);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
710 connect(htimeEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditRecipe::hop_time_changed);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
711 connect(useatEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::hop_useat_changed);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
712 connect(hformEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::hop_form_changed);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713 connect(hinstockEdit, &QCheckBox::stateChanged, this, &EditRecipe::hop_instock_changed);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
715 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717 dialog->setModal(true);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
718 dialog->exec();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
719 if (dialog->result() == QDialog::Rejected) {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 qDebug() << "reject and rollback";
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 recipe->hops[recipe->hops_row] = backup;
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
722 } else {
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 /* Clear time if hop is not used for boil, whirlpool or dry-hop. */
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
724 if (! (recipe->hops.at(recipe->hops_row).useat == 2 ||
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
725 recipe->hops.at(recipe->hops_row).useat == 4 ||
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
726 recipe->hops.at(recipe->hops_row).useat == 5)) {
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
727 if (recipe->hops.at(recipe->hops_row).time) {
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
728 recipe->hops[recipe->hops_row].time = 0;
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
729 is_changed();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
730 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
732 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734 disconnect(hselectEdit, nullptr, nullptr, nullptr);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 disconnect(hamountEdit, nullptr, nullptr, nullptr);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
736 disconnect(halphaEdit, nullptr, nullptr, nullptr);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 disconnect(htimeEdit, nullptr, nullptr, nullptr);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 disconnect(useatEdit, nullptr, nullptr, nullptr);
258
70bb9c3ee60f In the recipe editor hops you can now change the alpha percentage and hop form of any hop. We don't need locked values in recipe design.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
739 disconnect(hformEdit, nullptr, nullptr, nullptr);
127
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 disconnect(hinstockEdit, nullptr, nullptr, nullptr);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 disconnect(buttonBox, nullptr, nullptr, nullptr);
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743 emit refreshAll();
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
744 }
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745
475c8b8df67f Split recipes source in tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746
150
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
747 void EditRecipe::adjustHops(double factor)
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
748 {
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
749 double amount;
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
750
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
751 if (recipe->hops.size() == 0)
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
752 return;
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
753
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
754 for (int i = 0; i < recipe->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
755 amount = recipe->hops.at(i).amount * factor;
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
756 recipe->hops[i].amount = amount;
150
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
757 }
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
758 }
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
759
fd568cc1dd0e Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
760

mercurial