Sat, 09 Jul 2022 23:05:25 +0200
Increased some labels sizes.
128 | 1 | /** |
2 | * EditRecipe.cpp is part of bmsapp. | |
3 | * | |
4 | * tab 5, yeasts. | |
5 | * | |
6 | * bmsapp is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
11 | * bmsapp is distributed in the yeaste that it will be useful, |
128 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | ||
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
21 | bool EditRecipe::yeast_sort_test(const Yeasts &D1, const Yeasts &D2) |
128 | 22 | { |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
23 | if (D1.use > D2.use) |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
24 | return false; |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
25 | if (D1.use < D2.use) |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
26 | return true; |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
27 | return (D1.amount > D2.amount); |
128 | 28 | } |
29 | ||
30 | ||
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
31 | void EditRecipe::refreshYeasts() |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
32 | { |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
33 | QString w; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
34 | QWidget* pWidget; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
35 | QHBoxLayout* pLayout; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
36 | QTableWidgetItem *item; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
37 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
38 | qDebug() << "refreshYeasts" << recipe->yeasts.size(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
39 | std::sort(recipe->yeasts.begin(), recipe->yeasts.end(), yeast_sort_test); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
40 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
41 | const QStringList labels({tr("Yeast"), tr("Laboratory"), tr("Code"), tr("Type"), tr("Use for"), tr("Min. °C"), tr("Max. °C"), |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
42 | tr("Tol. %"), tr("Attn. %"), tr("Amount"), tr("Delete"), tr("Edit") }); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
43 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
44 | ui->yeastsTable->setColumnCount(12); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
45 | ui->yeastsTable->setColumnWidth(0, 200); /* Yeast */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
46 | ui->yeastsTable->setColumnWidth(1, 125); /* Laboratory */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
47 | ui->yeastsTable->setColumnWidth(2, 80); /* Code */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
48 | ui->yeastsTable->setColumnWidth(3, 80); /* Type */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
49 | ui->yeastsTable->setColumnWidth(4, 100); /* Usage */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
50 | ui->yeastsTable->setColumnWidth(5, 60); /* Min. */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
51 | ui->yeastsTable->setColumnWidth(6, 60); /* Max. */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
52 | ui->yeastsTable->setColumnWidth(7, 60); /* Tolerance */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
53 | ui->yeastsTable->setColumnWidth(8, 60); /* Attenuation */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
54 | ui->yeastsTable->setColumnWidth(9, 90); /* Amount */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
55 | ui->yeastsTable->setColumnWidth(10, 80); /* Delete */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
56 | ui->yeastsTable->setColumnWidth(11, 80); /* Edit */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
57 | ui->yeastsTable->setHorizontalHeaderLabels(labels); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
58 | ui->yeastsTable->verticalHeader()->hide(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
59 | ui->yeastsTable->setRowCount(recipe->yeasts.size()); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
60 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
61 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
62 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
63 | ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(recipe->yeasts.at(i).name)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
64 | ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(recipe->yeasts.at(i).laboratory)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
65 | ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(recipe->yeasts.at(i).product_id)); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
66 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
299
diff
changeset
|
67 | item = new QTableWidgetItem(QCoreApplication::translate("YeastForm", g_yeast_forms[recipe->yeasts.at(i).form])); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
68 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
69 | ui->yeastsTable->setItem(i, 3, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
70 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
299
diff
changeset
|
71 | item = new QTableWidgetItem(QCoreApplication::translate("YeastUse", g_yeast_use[recipe->yeasts.at(i).use])); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
72 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
73 | ui->yeastsTable->setItem(i, 4, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
74 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
75 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).min_temperature, 2, 'f', 1, '0')); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
76 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
77 | ui->yeastsTable->setItem(i, 5, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
78 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
79 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).max_temperature, 2, 'f', 1, '0')); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
80 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
81 | ui->yeastsTable->setItem(i, 6, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
82 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
83 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).tolerance, 2, 'f', 1, '0')); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
84 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
85 | ui->yeastsTable->setItem(i, 7, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
86 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
87 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).attenuation, 2, 'f', 1, '0')); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
88 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
89 | ui->yeastsTable->setItem(i, 8, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
90 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
91 | if (recipe->yeasts.at(i).form == 0) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
92 | item = new QTableWidgetItem(QString("%1 pack").arg(recipe->yeasts.at(i).amount, 1, 'f', 0, '0')); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
93 | else if (recipe->yeasts.at(i).form == 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
94 | item = new QTableWidgetItem(QString("%1 gr").arg(recipe->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
95 | else |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
96 | item = new QTableWidgetItem(QString("%1 ml").arg(recipe->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
97 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
98 | ui->yeastsTable->setItem(i, 9, item); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
99 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
100 | pWidget = new QWidget(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
101 | QPushButton* btn_dele = new QPushButton(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
102 | btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
103 | btn_dele->setText(tr("Delete")); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
104 | connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteYeastRow_clicked())); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
105 | pLayout = new QHBoxLayout(pWidget); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
106 | pLayout->addWidget(btn_dele); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
107 | pLayout->setContentsMargins(5, 0, 5, 0); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
108 | pWidget->setLayout(pLayout); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
109 | ui->yeastsTable->setCellWidget(i, 10, pWidget); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
110 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
111 | pWidget = new QWidget(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
112 | QPushButton* btn_edit = new QPushButton(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
113 | btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
114 | btn_edit->setText(tr("Edit")); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
115 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(editYeastRow_clicked())); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
116 | pLayout = new QHBoxLayout(pWidget); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
117 | pLayout->addWidget(btn_edit); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
118 | pLayout->setContentsMargins(5, 0, 5, 0); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
119 | pWidget->setLayout(pLayout); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
120 | ui->yeastsTable->setCellWidget(i, 11, pWidget); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
121 | } |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
122 | } |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
123 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
124 | |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
125 | /* |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
126 | * The results are not stored line in EditProduct. This is just a hint. |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
127 | */ |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
128 | void EditRecipe::calcYeast() |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
129 | { |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
130 | double sg = recipe->est_og; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
131 | double plato = Utils::sg_to_plato(sg); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
132 | double volume = recipe->batch_size * 0.9; // Volume min trub chiller loss. |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
133 | bool maybe_starter = false; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
134 | double pitchrate = 0.75; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
135 | double initcells = 0; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
136 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
137 | qDebug() << "calcYeast()"; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
138 | ui->yeastProcedure->setCurrentIndex(0); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
139 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
140 | if (recipe->yeasts.size() == 0) |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
141 | return; // No yeast in recipe. |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
142 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
143 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
144 | if (recipe->yeasts.at(i).use == 0) { // Primary |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
145 | if (recipe->yeasts.at(i).form == 1) { |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
146 | /* |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
147 | * Dry yeast, build the formule with the yeast parameters. |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
148 | * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
149 | */ |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
150 | ui->yeastProcedure->setCurrentIndex(2); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
151 | ui->lo_gr_hlEdit->setValue(recipe->yeasts.at(i).gr_hl_lo); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
152 | ui->hi_gr_hlEdit->setValue(recipe->yeasts.at(i).gr_hl_hi); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
153 | ui->lo_sgEdit->setValue(recipe->yeasts.at(i).sg_lo); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
154 | ui->hi_sgEdit->setValue(recipe->yeasts.at(i).sg_hi); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
155 | double og = recipe->yeasts.at(i).sg_lo; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
156 | double f1 = recipe->yeasts.at(i).gr_hl_lo / 100.0; |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
157 | double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
158 | double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
159 | qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
160 | double yeast_grams = round(volume * multiplier * 100.0) / 100.0; // * (100 / dataRecord.starter_viability), 2); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
161 | double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
162 | ui->need_grEdit->setValue(yeast_grams); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
163 | ui->pitch_grEdit->setValue(yeast_gr_hl); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
164 | qDebug() << " need" << yeast_grams << "grams, gr/hl:" << yeast_gr_hl; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
165 | return; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
166 | } else { |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
167 | /* |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
168 | * Liquid, slant, culture etc. |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
169 | * pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
170 | * and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
171 | */ |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
172 | ui->yeastProcedure->setCurrentIndex(1); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
173 | if (recipe->yeasts.at(i).type == 0) { // Lager yeast |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
174 | pitchrate = 1.5; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
175 | if (sg > 1.060) |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
176 | pitchrate = 2.0; |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
177 | } else if (recipe->yeasts.at(i).type == 6) { // Real Kveik |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
178 | pitchrate = 0.075; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
179 | } else { |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
180 | pitchrate = 0.75; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
181 | if (sg > 1.060) |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
182 | pitchrate = 1.0; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
183 | } |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
184 | if (recipe->yeasts.at(i).form == 0) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
185 | initcells = (recipe->yeasts.at(i).cells / 1000000000) * recipe->yeasts.at(i).amount * 0.97; // 97% viability assumed. |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
186 | else |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
187 | initcells = (recipe->yeasts.at(i).cells / 1000000) * recipe->yeasts.at(i).amount * 0.97; |
142
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
188 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
189 | double needed = round(pitchrate * volume * plato * 10.0) / 10.0; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
190 | double starter = 0; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
191 | if (needed > initcells) { |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
192 | maybe_starter = true; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
193 | starter = round(needed / 2.0) / 100.0; // A very rough starter size estimate. |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
194 | } |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
195 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
196 | ui->pitchrateEdit->setValue(pitchrate); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
197 | ui->initcellsEdit->setValue(initcells); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
198 | ui->targetcellsEdit->setValue(needed); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
199 | ui->starterEdit->setValue(starter); |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
200 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
201 | qDebug() << " pitchrate:" << pitchrate << "needed:" << needed << "initcells:" << initcells << "starter" << maybe_starter << "size" << starter; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
202 | } |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
203 | break; |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
204 | } |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
205 | } |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
206 | } |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
207 | |
1caa15a0eefc
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
Michiel Broek <mbroek@mbse.eu>
parents:
141
diff
changeset
|
208 | |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
209 | void EditRecipe::addYeastRow_clicked() |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
210 | { |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
211 | Yeasts newy; |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
212 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
213 | qDebug() << "Add yeast row"; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
214 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
215 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
216 | if (recipe->yeasts.at(i).amount == 0) |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
217 | return; // Add only one at a time. |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
218 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
219 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
220 | newy.name = "Select one"; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
221 | newy.laboratory = ""; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
222 | newy.product_id = ""; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
223 | newy.amount = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
224 | newy.type = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
225 | newy.form = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
226 | newy.min_temperature = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
227 | newy.max_temperature = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
228 | newy.flocculation = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
229 | newy.attenuation = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
230 | newy.cells = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
231 | newy.tolerance = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
232 | newy.inventory = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
233 | newy.use = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
234 | newy.sta1 = false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
235 | newy.bacteria = false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
236 | newy.harvest_top = false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
237 | newy.harvest_time = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
238 | newy.pitch_temperature = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
239 | newy.pofpos = false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
240 | newy.zymocide = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
241 | newy.gr_hl_lo = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
242 | newy.sg_lo = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
243 | newy.gr_hl_hi = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
244 | newy.sg_hi = 0; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
245 | newy.cost = 0; |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
246 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
247 | recipe->yeasts.append(newy); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
248 | emit refreshAll(); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
249 | } |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
250 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
251 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
252 | void EditRecipe::deleteYeastRow_clicked() |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
253 | { |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
254 | if (recipe->locked || recipe->yeasts.size() < 1) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
255 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
256 | |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
257 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
258 | int row = pb->objectName().toInt(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
259 | qDebug() << "Delete yeast row" << row << recipe->yeasts.size(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
260 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
261 | int rc = QMessageBox::warning(this, tr("Delete yeast"), tr("Delete %1").arg(recipe->yeasts.at(row).name), |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
262 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
263 | if (rc == QMessageBox::No) |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
264 | return; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
265 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
266 | recipe->yeasts.removeAt(row); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
267 | is_changed(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
268 | emit refreshAll(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
269 | } |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
270 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
271 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
272 | void EditRecipe::yeast_amount_changed(double val) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
273 | { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
274 | QTableWidgetItem *item; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
275 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
276 | qDebug() << "yeast_amount_changed()" << recipe->yeasts_row << val; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
277 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
278 | if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
279 | recipe->yeasts[recipe->yeasts_row].amount = val; |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
280 | item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
281 | } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
282 | recipe->yeasts[recipe->yeasts_row].amount = val / 1000.0; |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
283 | item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
284 | } else { |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
285 | recipe->yeasts[recipe->yeasts_row].amount = val / 1000.0; |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
286 | item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
287 | } |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
288 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
289 | ui->yeastsTable->setItem(recipe->yeasts_row, 9, item); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
290 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
291 | calcYeast(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
292 | is_changed(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
293 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
294 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
295 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
296 | void EditRecipe::yeast_select_changed(int val) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
297 | { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
298 | QSqlQuery query; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
299 | bool instock = yinstockEdit->isChecked(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
300 | QString w; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
301 | QTableWidgetItem *item; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
302 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
303 | if (val < 1) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
304 | return; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
305 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
306 | qDebug() << "yeast_select_changed()" << recipe->yeasts_row << val << instock; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
307 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
308 | /* |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
309 | * Search the yeast pointed by the index and instock flag. |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
310 | */ |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
311 | QString sql = "SELECT name,laboratory,product_id,type,form,min_temperature,max_temperature,flocculation,attenuation," |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
312 | "cells,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide," |
299
8021e09ab6a3
Fixed select yeasts in recipes and poducts.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
313 | "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost FROM inventory_yeasts "; |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
314 | if (instock) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
315 | sql.append("WHERE inventory > 0 "); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
316 | sql.append("ORDER BY laboratory,product_id,name"); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
317 | query.prepare(sql); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
318 | query.exec(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
319 | query.first(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
320 | for (int i = 0; i < (val - 1); i++) { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
321 | query.next(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
322 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
323 | qDebug() << "found" << query.value(0).toString() << query.value(2).toString(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
324 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
325 | /* |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
326 | * Replace the yeast record contents |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
327 | */ |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
328 | recipe->yeasts[recipe->yeasts_row].name = query.value(0).toString(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
329 | recipe->yeasts[recipe->yeasts_row].laboratory = query.value(1).toString(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
330 | recipe->yeasts[recipe->yeasts_row].product_id = query.value(2).toString(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
331 | recipe->yeasts[recipe->yeasts_row].type = query.value(3).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
332 | recipe->yeasts[recipe->yeasts_row].form = query.value(4).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
333 | recipe->yeasts[recipe->yeasts_row].min_temperature = query.value(5).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
334 | recipe->yeasts[recipe->yeasts_row].max_temperature = query.value(6).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
335 | recipe->yeasts[recipe->yeasts_row].flocculation = query.value(7).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
336 | recipe->yeasts[recipe->yeasts_row].attenuation = query.value(8).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
337 | recipe->yeasts[recipe->yeasts_row].cells = query.value(9).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
338 | recipe->yeasts[recipe->yeasts_row].tolerance = query.value(10).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
339 | recipe->yeasts[recipe->yeasts_row].sta1 = query.value(11).toInt() ? true:false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
340 | recipe->yeasts[recipe->yeasts_row].bacteria = query.value(12).toInt() ? true:false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
341 | recipe->yeasts[recipe->yeasts_row].harvest_top = query.value(13).toInt() ? true:false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
342 | recipe->yeasts[recipe->yeasts_row].harvest_time = query.value(14).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
343 | recipe->yeasts[recipe->yeasts_row].pitch_temperature = query.value(15).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
344 | recipe->yeasts[recipe->yeasts_row].pofpos = query.value(16).toInt() ? true:false; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
345 | recipe->yeasts[recipe->yeasts_row].zymocide = query.value(17).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
346 | recipe->yeasts[recipe->yeasts_row].gr_hl_lo = query.value(18).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
347 | recipe->yeasts[recipe->yeasts_row].sg_lo = query.value(19).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
348 | recipe->yeasts[recipe->yeasts_row].gr_hl_hi = query.value(20).toInt(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
349 | recipe->yeasts[recipe->yeasts_row].sg_hi = query.value(21).toDouble(); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
350 | recipe->yeasts[recipe->yeasts_row].cost = query.value(22).toDouble(); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
351 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
352 | /* |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
353 | * Update the visible fields |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
354 | */ |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
355 | ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).name); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
356 | ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).laboratory); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
357 | yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).product_id); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
358 | if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
359 | yamountEdit->setDecimals(0); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
360 | yamountEdit->setSingleStep(1.0); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
361 | yamountLabel->setText(tr("Total packs:")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
362 | } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
363 | yamountEdit->setDecimals(1); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
364 | yamountEdit->setSingleStep(0.5); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
365 | yamountLabel->setText(tr("Amount in gr:")); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
366 | } else { |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
367 | yamountEdit->setDecimals(1); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
368 | yamountEdit->setSingleStep(0.5); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
369 | yamountLabel->setText(tr("Amount in ml:")); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
370 | } |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
371 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
372 | ui->yeastsTable->setItem(recipe->yeasts_row, 0, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).name)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
373 | ui->yeastsTable->setItem(recipe->yeasts_row, 1, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).laboratory)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
374 | ui->yeastsTable->setItem(recipe->yeasts_row, 2, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).product_id)); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
375 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
299
diff
changeset
|
376 | item = new QTableWidgetItem(QCoreApplication::translate("YeastForm", g_yeast_forms[recipe->yeasts.at(recipe->yeasts_row).form])); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
377 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
378 | ui->yeastsTable->setItem(recipe->yeasts_row, 3, item); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
379 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
380 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).min_temperature, 2, 'f', 1, '0')); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
381 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
382 | ui->yeastsTable->setItem(recipe->yeasts_row, 5, item); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
383 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
384 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).max_temperature, 2, 'f', 1, '0')); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
385 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
386 | ui->yeastsTable->setItem(recipe->yeasts_row, 6, item); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
387 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
388 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).tolerance, 2, 'f', 1, '0')); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
389 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
390 | ui->yeastsTable->setItem(recipe->yeasts_row, 7, item); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
391 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
392 | item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).attenuation, 2, 'f', 1, '0')); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
393 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
394 | ui->yeastsTable->setItem(recipe->yeasts_row, 8, item); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
395 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
396 | calcYeast(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
397 | is_changed(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
398 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
399 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
400 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
401 | void EditRecipe::yeast_instock_changed(bool val) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
402 | { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
403 | QSqlQuery query; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
404 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
405 | qDebug() << "yeast_instock_changed()" << recipe->yeasts_row << val; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
406 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
407 | this->yselectEdit->setCurrentIndex(-1); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
408 | this->yselectEdit->clear(); |
299
8021e09ab6a3
Fixed select yeasts in recipes and poducts.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
409 | QString sql = "SELECT name,laboratory,product_id,inventory FROM inventory_yeasts "; |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
410 | if (val) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
411 | sql.append("WHERE inventory > 0 "); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
412 | sql.append("ORDER BY laboratory,product_id,name"); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
413 | query.prepare(sql); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
414 | query.exec(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
415 | query.first(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
416 | this->yselectEdit->addItem(""); // Start with empty value |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
417 | for (int i = 0; i < query.size(); i++) { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
418 | this->yselectEdit->addItem(query.value(1).toString()+" - "+query.value(2).toString()+" "+query.value(0).toString() + |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
419 | QString(" (%1 gr)").arg(query.value(3).toDouble() * 1000.0, 2, 'f', 1, '0')); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
420 | query.next(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
421 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
422 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
423 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
424 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
425 | void EditRecipe::yeast_useat_changed(int val) |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
426 | { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
427 | qDebug() << "yeast_useat_changed()" << recipe->yeasts_row << val; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
428 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
429 | recipe->yeasts[recipe->yeasts_row].use = val; |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
299
diff
changeset
|
430 | QTableWidgetItem *item = new QTableWidgetItem(QCoreApplication::translate("YeastUse", g_yeast_use[val])); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
431 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
432 | ui->yeastsTable->setItem(recipe->yeasts_row, 5, item); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
433 | is_changed(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
434 | emit refreshAll(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
435 | } |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
436 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
437 | |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
438 | void EditRecipe::editYeastRow_clicked() |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
439 | { |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
440 | QSqlQuery query; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
441 | |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
442 | if (recipe->locked) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
443 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
444 | |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
445 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
446 | recipe->yeasts_row = pb->objectName().toInt(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
447 | qDebug() << "Edit yeast row" << recipe->yeasts_row; |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
448 | Yeasts backup = recipe->yeasts.at(recipe->yeasts_row); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
449 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
450 | QDialog* dialog = new QDialog(this); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
451 | dialog->resize(738, 260); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
452 | QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
453 | buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
454 | buttonBox->setGeometry(QRect(30, 210, 671, 32)); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
455 | buttonBox->setLayoutDirection(Qt::LeftToRight); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
456 | buttonBox->setOrientation(Qt::Horizontal); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
457 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
458 | buttonBox->setCenterButtons(true); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
459 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
460 | QLabel *nameLabel = new QLabel(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
461 | nameLabel->setObjectName(QString::fromUtf8("nameLabel")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
462 | nameLabel->setText(tr("Yeast name:")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
463 | nameLabel->setGeometry(QRect(10, 10, 141, 20)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
464 | nameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
465 | QLabel *laboratoryLabel = new QLabel(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
466 | laboratoryLabel->setObjectName(QString::fromUtf8("laboratoryLabel")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
467 | laboratoryLabel->setText(tr("Laboratory:")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
468 | laboratoryLabel->setGeometry(QRect(10, 40, 141, 20)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
469 | laboratoryLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
470 | QLabel *product_idLabel = new QLabel(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
471 | product_idLabel->setObjectName(QString::fromUtf8("product_idLabel")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
472 | product_idLabel->setText(tr("Laboratory:")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
473 | product_idLabel->setGeometry(QRect(10, 70, 141, 20)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
474 | product_idLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
475 | QLabel *selectLabel = new QLabel(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
476 | selectLabel->setObjectName(QString::fromUtf8("selectLabel")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
477 | selectLabel->setText(tr("Select yeast:")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
478 | selectLabel->setGeometry(QRect(10,100, 141, 20)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
479 | selectLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
480 | QLabel *instockLabel = new QLabel(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
481 | instockLabel->setObjectName(QString::fromUtf8("instockLabel")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
482 | instockLabel->setText(tr("In stock:")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
483 | instockLabel->setGeometry(QRect(525,100, 121, 20)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
484 | instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
485 | yamountLabel = new QLabel(dialog); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
486 | yamountLabel->setObjectName(QString::fromUtf8("amountLabel")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
487 | if (recipe->yeasts.at(recipe->yeasts_row).form == 0) |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
488 | yamountLabel->setText(tr("Total packs:")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
489 | else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
490 | yamountLabel->setText(tr("Amount in gr:")); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
491 | else |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
492 | yamountLabel->setText(tr("Amount in ml:")); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
493 | yamountLabel->setGeometry(QRect(10, 130, 141, 20)); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
494 | yamountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
495 | QLabel *useatLabel = new QLabel(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
496 | useatLabel->setObjectName(QString::fromUtf8("useatLabel")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
497 | useatLabel->setText(tr("Use at:")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
498 | useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
499 | useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
500 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
501 | ynameEdit = new QLineEdit(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
502 | ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
503 | ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).name); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
504 | ynameEdit->setGeometry(QRect(160, 10, 511, 23)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
505 | ynameEdit->setReadOnly(true); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
506 | ylaboratoryEdit = new QLineEdit(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
507 | ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
508 | ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).laboratory); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
509 | ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
510 | ylaboratoryEdit->setReadOnly(true); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
511 | yproduct_idEdit = new QLineEdit(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
512 | yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
513 | yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).product_id); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
514 | yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
515 | yproduct_idEdit->setReadOnly(true); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
516 | yselectEdit = new QComboBox(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
517 | yselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
518 | yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
519 | yinstockEdit = new QCheckBox(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
520 | yinstockEdit->setObjectName(QString::fromUtf8("yinstockEdit")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
521 | yinstockEdit->setGeometry(QRect(655,100, 85, 21)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
522 | yinstockEdit->setChecked(true); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
523 | yamountEdit = new QDoubleSpinBox(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
524 | yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
525 | yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
526 | yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
527 | yamountEdit->setAccelerated(true); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
528 | if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
529 | yamountEdit->setDecimals(0); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
530 | yamountEdit->setSingleStep(1.0); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
531 | yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
532 | } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
533 | yamountEdit->setDecimals(1); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
534 | yamountEdit->setSingleStep(0.5); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
535 | yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount * 1000.0); |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
536 | } else { |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
537 | yamountEdit->setDecimals(1); |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
538 | yamountEdit->setSingleStep(0.5); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
539 | yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount * 1000.0); |
152
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
540 | } |
58e4ce7dd217
Fixed vanishing mash profiles from some recipes. All ingnoreChanges flags removed and replaced by blocking signals. Update prompts and yeast amounts depending on the yeast form. Save water profile names fixed.
Michiel Broek <mbroek@mbse.eu>
parents:
150
diff
changeset
|
541 | yamountEdit->setMaximum(1000000000.0); |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
542 | useatEdit = new QComboBox(dialog); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
543 | useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
544 | useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
545 | useatEdit->addItem(tr("Primary")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
546 | useatEdit->addItem(tr("Secondary")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
547 | useatEdit->addItem(tr("Tertiary")); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
548 | useatEdit->addItem(tr("Bottle")); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
549 | useatEdit->setCurrentIndex(recipe->yeasts.at(recipe->yeasts_row).use); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
550 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
551 | yeast_instock_changed(true); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
552 | |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
553 | connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::yeast_select_changed); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
554 | connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::yeast_amount_changed); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
555 | connect(useatEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::yeast_useat_changed); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
556 | connect(yinstockEdit, &QCheckBox::stateChanged, this, &EditRecipe::yeast_instock_changed); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
557 | connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
558 | connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
559 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
560 | dialog->setModal(true); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
561 | dialog->exec(); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
562 | if (dialog->result() == QDialog::Rejected) { |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
563 | qDebug() << "reject and rollback"; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
564 | recipe->yeasts[recipe->yeasts_row] = backup; |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
565 | } else { |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
566 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
567 | } |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
568 | |
143
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
569 | disconnect(yselectEdit, nullptr, nullptr, nullptr); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
570 | disconnect(yamountEdit, nullptr, nullptr, nullptr); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
571 | disconnect(useatEdit, nullptr, nullptr, nullptr); |
8414844c9f8b
Added all yeast edit functions and the popup editor window.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
572 | disconnect(yinstockEdit, nullptr, nullptr, nullptr); |
141
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
573 | disconnect(buttonBox, nullptr, nullptr, nullptr); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
574 | |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
575 | emit refreshAll(); |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
576 | } |
eea8a9e7e1f6
Upgrade yeasts fields if needed during recipe startup. Added yeast table.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
577 | |
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:
143
diff
changeset
|
578 | |
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:
143
diff
changeset
|
579 | void EditRecipe::adjustYeasts(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:
143
diff
changeset
|
580 | { |
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:
143
diff
changeset
|
581 | 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:
143
diff
changeset
|
582 | |
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:
143
diff
changeset
|
583 | if (recipe->yeasts.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:
143
diff
changeset
|
584 | 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:
143
diff
changeset
|
585 | |
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:
143
diff
changeset
|
586 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
587 | if (recipe->yeasts.at(i).form == 1) { // Only adjust dry yeast |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
588 | amount = recipe->yeasts.at(i).amount * factor; |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
171
diff
changeset
|
589 | recipe->yeasts[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:
143
diff
changeset
|
590 | } |
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:
143
diff
changeset
|
591 | } |
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:
143
diff
changeset
|
592 | } |
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:
143
diff
changeset
|
593 |