src/EditRecipeTab4.cpp

Tue, 24 Jan 2023 16:08:16 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 24 Jan 2023 16:08:16 +0100
changeset 474
18b72c518d0d
parent 454
2dfead81c72f
permissions
-rw-r--r--

Only try to save images on existing paths

128
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditRecipe.cpp is part of bmsapp.
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * tab 4, miscs.
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
21 bool EditRecipe::misc_sort_test(const Miscs &D1, const Miscs &D2)
128
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
23 if (D1.use_use > D2.use_use)
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
24 return false;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
25 if (D1.use_use < D2.use_use)
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
26 return true;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
27 if (D1.type > D2.type)
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
28 return false;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
29 if (D1.type < D2.type)
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
30 return true;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
31 return (D1.amount > D2.amount);
128
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 }
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
0f4eee875ea6 More file splitting
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
35 void EditRecipe::refreshMiscs()
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
36 {
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
37 QString w;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
38 QWidget* pWidget;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
39 QHBoxLayout* pLayout;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
40 QTableWidgetItem *item;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
41
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
42 std::sort(recipe->miscs.begin(), recipe->miscs.end(), misc_sort_test);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
43
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
44 const QSignalBlocker blocker1(ui->bs_cacl2Edit);
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
45 const QSignalBlocker blocker2(ui->bs_caso4Edit);
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
46 const QSignalBlocker blocker3(ui->bs_mgso4Edit);
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
47 const QSignalBlocker blocker4(ui->bs_naclEdit);
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
48 const QSignalBlocker blocker5(ui->bs_mgcl2Edit);
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
49 const QSignalBlocker blocker6(ui->bs_nahco3Edit);
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
50 const QSignalBlocker blocker7(ui->bs_caco3Edit);
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
51 const QSignalBlocker blocker8(ui->mw_acidPick);
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
52 const QSignalBlocker blocker9(ui->mw_acidvolEdit);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
53 const QSignalBlocker blocker10(ui->ss_cacl2Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
54 const QSignalBlocker blocker11(ui->ss_caso4Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
55 const QSignalBlocker blocker12(ui->ss_mgso4Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
56 const QSignalBlocker blocker13(ui->ss_naclEdit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
57 const QSignalBlocker blocker14(ui->ss_mgcl2Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
58 const QSignalBlocker blocker15(ui->sp_acidtypeEdit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
59 const QSignalBlocker blocker16(ui->sp_acidvolEdit);
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
60
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
61 const QStringList labels({tr("Ingredient"), tr("Type"), tr("Use at"), tr("Time"), tr("Amount"), tr("Delete"), tr("Edit") });
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
62
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
63 ui->miscsTable->setColumnCount(7);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
64 ui->miscsTable->setColumnWidth(0, 300); /* Ingredient */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
65 ui->miscsTable->setColumnWidth(1, 100); /* Type */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
66 ui->miscsTable->setColumnWidth(2, 100); /* Added */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
67 ui->miscsTable->setColumnWidth(3, 75); /* Time */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
68 ui->miscsTable->setColumnWidth(4, 90); /* Amount */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
69 ui->miscsTable->setColumnWidth(5, 80); /* Delete */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
70 ui->miscsTable->setColumnWidth(6, 80); /* Edit */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
71 ui->miscsTable->setHorizontalHeaderLabels(labels);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
72 ui->miscsTable->verticalHeader()->hide();
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
73 ui->miscsTable->setRowCount(recipe->miscs.size());
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
74
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
75 for (int i = 0; i < recipe->miscs.size(); i++) {
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
76
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
77 ui->miscsTable->setItem(i, 0, new QTableWidgetItem(recipe->miscs.at(i).name));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
78
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
79 item = new QTableWidgetItem(QCoreApplication::translate("MiscType", g_misc_types[recipe->miscs.at(i).type]));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
80 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
81 ui->miscsTable->setItem(i, 1, item);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
82
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
83 item = new QTableWidgetItem(QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
84 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
85 ui->miscsTable->setItem(i, 2, item);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
86
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
87 if (recipe->miscs.at(i).use_use == MISC_USES_BOIL) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
88 item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(i).time, 1, 'f', 0, '0'));
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
89 } else if (recipe->miscs.at(i).use_use == MISC_USES_PRIMARY || recipe->miscs.at(i).use_use == MISC_USES_SECONDARY) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
90 item = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(i).time / 1440, 1, 'f', 0, '0'));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
91 } else {
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
92 item = new QTableWidgetItem(QString(""));
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
93 }
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
94 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
95 ui->miscsTable->setItem(i, 3, item);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
96
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
97 if (recipe->miscs.at(i).amount_is_weight)
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
98 item = new QTableWidgetItem(QString("%1 gr").arg(recipe->miscs.at(i).amount * 1000.0, 3, 'f', 2, '0'));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
99 else
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
100 item = new QTableWidgetItem(QString("%1 ml").arg(recipe->miscs.at(i).amount * 1000.0, 3, 'f', 2, '0'));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
101 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
102 ui->miscsTable->setItem(i, 4, item);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
103
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
104 /*
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
105 * Add the Delete and Edit row buttons.
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
106 * Not for water agents, these are set on the water tab.
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
107 */
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
108 if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT) {
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
109 ui->miscsTable->removeCellWidget(i, 5);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
110 ui->miscsTable->removeCellWidget(i, 6);
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
111 item = new QTableWidgetItem("");
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
112 item->setToolTip(tr("Edit this from the water tab"));
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
113 ui->miscsTable->setItem(i, 5, item);
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
114 item = new QTableWidgetItem("");
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
115 item->setToolTip(tr("Edit this from the water tab"));
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
116 ui->miscsTable->setItem(i, 6, item);
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
117 } else {
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
118 if (ui->miscsTable->item(i, 5)) {
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
119 ui->miscsTable->takeItem(i, 5); /* to remove the old tooltip */
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
120 }
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
121 if (ui->miscsTable->item(i, 6)) {
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
122 ui->miscsTable->takeItem(i, 6);
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
123 }
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
124 pWidget = new QWidget();
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
125 QPushButton* btn_dele = new QPushButton();
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
126 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
127 btn_dele->setText(tr("Delete"));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
128 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMiscRow_clicked()));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
129 pLayout = new QHBoxLayout(pWidget);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
130 pLayout->addWidget(btn_dele);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
131 pLayout->setContentsMargins(5, 0, 5, 0);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
132 pWidget->setLayout(pLayout);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
133 ui->miscsTable->setCellWidget(i, 5, pWidget);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
134
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
135 pWidget = new QWidget();
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
136 QPushButton* btn_edit = new QPushButton();
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
137 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
138 btn_edit->setText(tr("Edit"));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
139 connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMiscRow_clicked()));
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
140 pLayout = new QHBoxLayout(pWidget);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
141 pLayout->addWidget(btn_edit);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
142 pLayout->setContentsMargins(5, 0, 5, 0);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
143 pWidget->setLayout(pLayout);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
144 ui->miscsTable->setCellWidget(i, 6, pWidget);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
145 }
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
146
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
147 /*
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
148 * Update the water agents.
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
149 */
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
150 if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT && recipe->miscs.at(i).use_use == MISC_USES_MASH) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
151 if (recipe->miscs.at(i).name == "CaCl2") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
152 ui->bs_cacl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
153 } else if (recipe->miscs.at(i).name == "CaSO4") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
154 ui->bs_caso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
155 } else if (recipe->miscs.at(i).name == "MgSO4") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
156 ui->bs_mgso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
157 } else if (recipe->miscs.at(i).name == "NaCl") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
158 ui->bs_naclEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
159 } else if (recipe->miscs.at(i).name == "MgCl2") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
160 ui->bs_mgcl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
161 } else if (recipe->miscs.at(i).name == "NaHCO3") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
162 ui->bs_nahco3Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
163 } else if (recipe->miscs.at(i).name == "CaCO3") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
164 ui->bs_caco3Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
165 } else if (recipe->miscs.at(i).name == "Melkzuur" || recipe->miscs.at(i).name == "Lactic") {
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
166 recipe->wa_acid_name = 0;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
167 recipe->wa_acid_perc = my_acids.at(0).AcidPrc;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
168 ui->mw_acidPick->setCurrentIndex(0);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
169 ui->mw_acidpercEdit->setValue(my_acids.at(0).AcidPrc);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
170 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
171 } else if (recipe->miscs.at(i).name == "Zoutzuur" || recipe->miscs.at(i).name == "Hydrochloric") {
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
172 recipe->wa_acid_name = 1;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
173 recipe->wa_acid_perc = my_acids.at(1).AcidPrc;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
174 ui->mw_acidPick->setCurrentIndex(1);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
175 ui->mw_acidpercEdit->setValue(my_acids.at(1).AcidPrc);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
176 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
177 } else if (recipe->miscs.at(i).name == "Fosforzuur" || recipe->miscs.at(i).name == "Phosphoric") {
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
178 recipe->wa_acid_name = 2;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
179 recipe->wa_acid_perc = my_acids.at(2).AcidPrc;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
180 ui->mw_acidPick->setCurrentIndex(2);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
181 ui->mw_acidpercEdit->setValue(my_acids.at(2).AcidPrc);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
182 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
183 } else if (recipe->miscs.at(i).name == "Zwavelzuur" || recipe->miscs.at(i).name == "Sulfuric") {
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
184 recipe->wa_acid_name = 3;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
185 recipe->wa_acid_perc = my_acids.at(3).AcidPrc;
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
186 ui->mw_acidPick->setCurrentIndex(3);
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
187 ui->mw_acidpercEdit->setValue(my_acids.at(3).AcidPrc);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
188 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
189 }
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
190 } else if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT && recipe->miscs.at(i).use_use == MISC_USES_SPARGE) {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
191 if (recipe->miscs.at(i).name == "CaCl2") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
192 ui->ss_cacl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
193 } else if (recipe->miscs.at(i).name == "CaSO4") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
194 ui->ss_caso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
195 } else if (recipe->miscs.at(i).name == "MgSO4") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
196 ui->ss_mgso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
197 } else if (recipe->miscs.at(i).name == "NaCl") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
198 ui->ss_naclEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
199 } else if (recipe->miscs.at(i).name == "MgCl2") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
200 ui->ss_mgcl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
201 } else if (recipe->miscs.at(i).name == "Melkzuur" || recipe->miscs.at(i).name == "Lactic") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
202 recipe->sparge_acid_type = 0;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
203 recipe->sparge_acid_perc = my_acids.at(0).AcidPrc;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
204 ui->sp_acidtypeEdit->setCurrentIndex(0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
205 ui->sp_acidpercEdit->setValue(my_acids.at(0).AcidPrc);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
206 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
207 } else if (recipe->miscs.at(i).name == "Zoutzuur" || recipe->miscs.at(i).name == "Hydrochloric") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
208 recipe->sparge_acid_type = 1;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
209 recipe->sparge_acid_perc = my_acids.at(1).AcidPrc;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
210 ui->sp_acidtypeEdit->setCurrentIndex(1);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
211 ui->sp_acidpercEdit->setValue(my_acids.at(1).AcidPrc);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
212 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
213 } else if (recipe->miscs.at(i).name == "Fosforzuur" || recipe->miscs.at(i).name == "Phosphoric") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
214 recipe->sparge_acid_type = 2;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
215 recipe->sparge_acid_perc = my_acids.at(2).AcidPrc;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
216 ui->sp_acidtypeEdit->setCurrentIndex(2);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
217 ui->sp_acidpercEdit->setValue(my_acids.at(2).AcidPrc);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
218 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
219 } else if (recipe->miscs.at(i).name == "Zwavelzuur" || recipe->miscs.at(i).name == "Sulfuric") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
220 recipe->sparge_acid_type = 3;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
221 recipe->sparge_acid_perc = my_acids.at(3).AcidPrc;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
222 ui->sp_acidtypeEdit->setCurrentIndex(3);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
223 ui->sp_acidpercEdit->setValue(my_acids.at(3).AcidPrc);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
224 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
225 }
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
226 }
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
227 }
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
228 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
229
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
230
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
231 /*
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
232 * Manipulate the memory array and update the miscs table.
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
233 */
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
234 void EditRecipe::brewing_salt_sub(QString salt, double val, int use)
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
235 {
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
236 QTableWidgetItem *item;
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
237
137
ffe8b2e9517b Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
238 val = round(val * 100.0) / 100.0;
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
239 if (val == 0) {
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
240 /*
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
241 * Remove this salt if it is in the table.
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
242 */
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
243 for (int i = 0; i < recipe->miscs.size(); i++) {
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
244 if (salt.contains(recipe->miscs.at(i).name) && recipe->miscs.at(i).use_use == use) {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
245 qDebug() << " brewing_salt_sub delete" << salt << use;
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
246 recipe->miscs.removeAt(i);
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
247 refreshMiscs();
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
248 return;
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
249 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
250 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
251 return;
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
252 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
253
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
254 /*
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
255 * First see if this salt is in the table.
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
256 * If it is, update the amount.
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
257 */
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
258 for (int i = 0; i < recipe->miscs.size(); i++) {
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
259 if (salt.contains(recipe->miscs.at(i).name) && recipe->miscs.at(i).use_use == use) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
260 recipe->miscs[i].amount = val / 1000.0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
261 if (recipe->miscs.at(i).amount_is_weight)
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
262 item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0'));
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
263 else
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
264 item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0'));
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
265 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
266 ui->miscsTable->setItem(i, 4, item);
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
267 return;
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
268 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
269 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
270
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
271 /*
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
272 * We need a new entry. Search in the database is tricky because
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
273 * we are here with possible more names for the same salt. The
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
274 * name can be like 'Lactic Melkzuur'. So we select only the
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
275 * brewing salts and manually check their names.
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
276 */
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
277 QSqlQuery query("SELECT * FROM inventory_miscs WHERE type = 4");
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
278 while (query.next()) {
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
279 if (salt.contains(query.value(1).toString())) {
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
280 qDebug() << " found it, append";
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
281 Miscs m;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
282 m.name = query.value(1).toString();
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
283 m.amount = val / 1000.0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
284 m.type = query.value(2).toInt();
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
285 m.use_use = use;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
286 m.time = query.value(4).toDouble();
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
287 m.amount_is_weight = query.value(5).toInt() ? true:false;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
288 m.cost = query.value(10).toDouble();
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
289 recipe->miscs.append(m);
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
290 refreshMiscs();
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
291 return;
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
292 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
293 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
294
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
295 qDebug() << "brewing_salt_sub, nothing done." << salt << val << use;
136
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
296 }
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
297
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
298
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
299 /*
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
300 * Edit brewing salt and recalculate.
17030224d919 Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
301 */
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
302 void EditRecipe::set_brewing_salt(QString salt, double val, int use)
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
303 {
137
ffe8b2e9517b Added indicators for BUGU and SO4:Cl ratio. Force rounded values for changing brewing salts.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
304 val = round(val * 100.0) / 100.0;
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
305 qDebug() << "set_brewing_salt" << salt << val << use;
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
306 brewing_salt_sub(salt, val, use);
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
307 calcWater();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
308 is_changed();
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
309 }
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
310
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
311
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
312 void EditRecipe::addMiscRow_clicked()
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
313 {
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
314 Miscs newm;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
315
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
316 for (int i = 0; i < recipe->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
317 if (recipe->miscs.at(i).amount == 0)
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
318 return; // Add only one at a time.
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
319 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
320
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
321 newm.name = "Select one";
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
322 newm.amount = 0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
323 newm.type = 0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
324 newm.use_use = 0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
325 newm.time = 0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
326 newm.amount_is_weight = true;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
327 newm.cost = 0;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
328 recipe->miscs.append(newm);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
329 is_changed();
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
330 refreshMiscs();
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
331 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
332
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
333
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
334 void EditRecipe::deleteMiscRow_clicked()
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
335 {
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
336 if (recipe->locked || recipe->miscs.size() < 1)
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
337 return;
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
338
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
339 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
340 int row = pb->objectName().toInt();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
341 qDebug() << "Delete misc row" << row << recipe->miscs.size();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
342
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
343 int rc = QMessageBox::warning(this, tr("Delete misc"), tr("Delete %1").arg(recipe->miscs.at(row).name),
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
344 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
345 if (rc == QMessageBox::No)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
346 return;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
347
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
348 recipe->miscs.removeAt(row);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
349 is_changed();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
350 emit refreshAll();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
351 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
352
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
353
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
354 void EditRecipe::misc_amount_changed(double val)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
355 {
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
356 QTableWidgetItem *item;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
357
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
358 qDebug() << "misc_amount_changed()" << recipe->miscs_row << val;
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
359
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
360 recipe->miscs[recipe->miscs_row].amount = val / 1000.0;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
361 if (recipe->miscs.at(recipe->miscs_row).amount_is_weight) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
362 item = new QTableWidgetItem(QString("%1 gr").arg(recipe->miscs.at(recipe->miscs_row).amount * 1000.0, 3, 'f', 2, '0'));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
363 } else {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
364 item = new QTableWidgetItem(QString("%1 ml").arg(recipe->miscs.at(recipe->miscs_row).amount * 1000.0, 3, 'f', 2, '0'));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
365 }
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
366 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
367 ui->miscsTable->setItem(recipe->miscs_row, 4, item);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
368
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
369 is_changed();
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
370 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
371
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
372
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
373 void EditRecipe::misc_time_changed(int val)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
374 {
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
375 QTableWidgetItem *item;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
376
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
377 qDebug() << "misc_time_changed()" << recipe->miscs_row << val;
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
378
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
379 if (recipe->miscs.at(recipe->miscs_row).use_use == MISC_USES_BOIL) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
380 recipe->miscs[recipe->miscs_row].time = val;
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
381 item = new QTableWidgetItem(QString("%1 min.").arg(val, 1, 'f', 0, '0'));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
382 } else if (recipe->miscs.at(recipe->miscs_row).use_use == MISC_USES_PRIMARY ||
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
383 recipe->miscs.at(recipe->miscs_row).use_use == MISC_USES_SECONDARY) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
384 recipe->miscs[recipe->miscs_row].time = val * 1440;
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
385 item = new QTableWidgetItem(QString("%1 days.").arg(val, 1, 'f', 0, '0'));
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
386 } else {
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
387 item = new QTableWidgetItem(QString(""));
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
388 }
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
389 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
390 ui->miscsTable->setItem(recipe->miscs_row, 3, item);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
391
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
392 is_changed();
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
393 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
394
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
395
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
396 void EditRecipe::misc_select_changed(int val)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
397 {
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
398 QSqlQuery query;
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
399 bool instock = minstockEdit->isChecked();
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
400 QString w;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
401 QTableWidgetItem *item;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
402
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
403 if (val < 1)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
404 return;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
405
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
406 qDebug() << "misc_select_changed()" << recipe->miscs_row << val << instock;
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
407
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
408 /*
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
409 * Search the misc ingredient pointed by the index and instock flag.
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
410 */
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
411 QString sql = "SELECT name,type,use_use,time,amount_is_weight,cost FROM inventory_miscs WHERE ";
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
412 if (instock)
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
413 sql.append("inventory > 0 AND ");
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
414 sql.append("type != 4 ORDER BY name");
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
415 qDebug() << sql;
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
416 query.prepare(sql);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
417 query.exec();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
418 query.first();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
419 for (int i = 0; i < (val - 1); i++) {
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
420 query.next();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
421 }
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
422 qDebug() << "found" << query.value(0).toString();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
423
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
424 /*
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
425 * Replace the misc record contents
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
426 */
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
427 recipe->miscs[recipe->miscs_row].name = query.value(0).toString();
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
428 recipe->miscs[recipe->miscs_row].type = query.value(1).toInt();
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
429 recipe->miscs[recipe->miscs_row].use_use = query.value(2).toInt();
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
430 recipe->miscs[recipe->miscs_row].time = query.value(3).toDouble();
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
431 recipe->miscs[recipe->miscs_row].amount_is_weight = query.value(4).toInt() ? true:false;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
432 recipe->miscs[recipe->miscs_row].cost = query.value(5).toDouble();
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
433
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
434 /*
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
435 * Update the visible fields
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
436 */
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
437 mnameEdit->setText(recipe->miscs.at(recipe->miscs_row).name);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
438 ui->miscsTable->setItem(recipe->miscs_row, 0, new QTableWidgetItem(recipe->miscs.at(recipe->miscs_row).name));
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
439
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
440 item = new QTableWidgetItem(QCoreApplication::translate("MiscType", g_misc_types[recipe->miscs.at(recipe->miscs_row).type]));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
441 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
442 ui->miscsTable->setItem(recipe->miscs_row, 1, item);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
443
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
444 item = new QTableWidgetItem(QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(recipe->miscs_row).use_use]));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
445 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
446 ui->miscsTable->setItem(recipe->miscs_row, 2, item);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
447 useatEdit->setCurrentIndex(recipe->miscs.at(recipe->miscs_row).use_use);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
448
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
449 if (recipe->miscs.at(recipe->miscs_row).use_use == 3 || recipe->miscs.at(recipe->miscs_row).use_use == 4) { // Fermentation stages
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
450 mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).time / 1440);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
451 mtimeEdit->setReadOnly(false);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
452 mtimeLabel->setText(tr("Time in days:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
453 item = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(recipe->miscs_row).time / 1440, 1, 'f', 0, '0'));
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
454 } else if (recipe->miscs.at(recipe->miscs_row).use_use == 2) { // Boil
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
455 mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).time);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
456 mtimeEdit->setReadOnly(false);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
457 mtimeLabel->setText(tr("Time in minutes:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
458 item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(recipe->miscs_row).time, 1, 'f', 0, '0'));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
459 } else {
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
460 mtimeEdit->setReadOnly(true);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
461 mtimeLabel->setText("");
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
462 item = new QTableWidgetItem(QString(""));
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
463 }
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
464 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
465 ui->miscsTable->setItem(recipe->miscs_row, 3, item);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
466
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
467 if (recipe->miscs.at(recipe->miscs_row).amount_is_weight) {
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
468 mamountLabel->setText(tr("Amount in gr:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
469 item = new QTableWidgetItem(QString("%1 gr").arg(recipe->miscs.at(recipe->miscs_row).amount * 1000.0, 3, 'f', 2, '0'));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
470 } else {
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
471 mamountLabel->setText(tr("Amount in ml:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
472 item = new QTableWidgetItem(QString("%1 ml").arg(recipe->miscs.at(recipe->miscs_row).amount * 1000.0, 3, 'f', 2, '0'));
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
473 }
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
474 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
475 ui->miscsTable->setItem(recipe->miscs_row, 4, item);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
476
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
477 qDebug() << "before" << recipe->miscs_row;
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
478 is_changed();
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
479 refreshMiscs();
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
480 /*
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
481 * The order of the list is changed, lookup the item we just added.
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
482 */
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
483 for (int i = 0; i < recipe->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
484 if ((recipe->miscs.at(i).name == query.value(0).toString()) &&
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
485 (recipe->miscs.at(i).type == query.value(1).toInt()) &&
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
486 (recipe->miscs.at(i).use_use == query.value(2).toInt())) {
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
487 recipe->miscs_row = i;
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
488 break;
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
489 }
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
490 }
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
491 qDebug() << "after" << recipe->miscs_row;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
492 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
493
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
494
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
495 void EditRecipe::misc_instock_changed(bool val)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
496 {
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
497 QSqlQuery query;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
498
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
499 qDebug() << "misc_instock_changed()" << recipe->miscs_row << val;
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
500
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
501 this->mselectEdit->setCurrentIndex(-1);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
502 this->mselectEdit->clear();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
503 QString sql = "SELECT name,type,amount_is_weight,inventory FROM inventory_miscs WHERE ";
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
504 if (val)
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
505 sql.append("inventory > 0 AND ");
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
506 sql.append("type != 4 ORDER BY name");
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
507 query.prepare(sql);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
508 query.exec();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
509 query.first();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
510 this->mselectEdit->addItem(""); // Start with empty value
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
511 for (int i = 0; i < query.size(); i++) {
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
512 this->mselectEdit->addItem(query.value(0).toString()+ " (" + QCoreApplication::translate("MiscType", g_misc_types[query.value(1).toInt()]) + ") " +
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
513 QString("%1 %2").arg(query.value(3).toDouble() * 1000.0, 3, 'f', 2, '0').arg(query.value(2).toInt()?"gr":"ml"));
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
514 query.next();
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
515 }
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
516 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
517
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
518
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
519 void EditRecipe::misc_useat_changed(int val)
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
520 {
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
521 QTableWidgetItem *item;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
522
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
523 qDebug() << "misc_useat_changed" << val;
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
524 recipe->miscs[recipe->miscs_row].use_use = val;
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
525 item = new QTableWidgetItem(QCoreApplication::translate("MiscUse", g_misc_uses[val]));
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
526 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
527 ui->miscsTable->setItem(recipe->miscs_row, 2, item);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
528
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
529 if (val == MISC_USES_PRIMARY || val == MISC_USES_SECONDARY) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
530 recipe->miscs[recipe->miscs_row].time = mtimeEdit->value() * 1440;
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
531 mtimeEdit->setReadOnly(false);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
532 mtimeLabel->setText(tr("Time in days:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
533 item = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(recipe->miscs_row).time / 1440, 1, 'f', 0, '0'));
261
246893ad04a6 Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
534 } else if (val == MISC_USES_BOIL) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
535 recipe->miscs[recipe->miscs_row].time = mtimeEdit->value();
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
536 mtimeEdit->setReadOnly(false);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
537 mtimeLabel->setText(tr("Time in minutes:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
538 item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(recipe->miscs_row).time, 1, 'f', 0, '0'));
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
539 } else {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
540 recipe->miscs[recipe->miscs_row].time = 0;
140
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
541 mtimeEdit->setValue(0);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
542 mtimeEdit->setReadOnly(true);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
543 mtimeLabel->setText("");
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
544 item = new QTableWidgetItem(QString(""));
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
545 }
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
546 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
547 ui->miscsTable->setItem(recipe->miscs_row, 3, item);
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
548
6638609328c2 Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
549 is_changed();
131
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
550 }
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
551
0115b97e8c39 Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
552
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
553 void EditRecipe::editMiscRow_clicked()
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
554 {
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
555 QSqlQuery query;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
556
171
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
557 if (recipe->locked)
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
558 return;
6cd2d808d863 Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
559
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
560 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
561 recipe->miscs_row = pb->objectName().toInt();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
562 qDebug() << "Edit misc row" << recipe->miscs_row;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
563 Miscs backup = recipe->miscs.at(recipe->miscs_row);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
564
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
565 QDialog* dialog = new QDialog(this);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
566 dialog->resize(738, 230);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
567 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
568 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
569 buttonBox->setGeometry(QRect(30, 180, 671, 32));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
570 buttonBox->setLayoutDirection(Qt::LeftToRight);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
571 buttonBox->setOrientation(Qt::Horizontal);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
572 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
573 buttonBox->setCenterButtons(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
574
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
575 QLabel *nameLabel = new QLabel(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
576 nameLabel->setObjectName(QString::fromUtf8("nameLabel"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
577 nameLabel->setText(tr("Current ingredient:"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
578 nameLabel->setGeometry(QRect(10, 10, 141, 20));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
579 nameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
580
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
581 mamountLabel = new QLabel(dialog);
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
582 mamountLabel->setObjectName(QString::fromUtf8("mamountLabel"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
583 if (recipe->miscs.at(recipe->miscs_row).amount_is_weight)
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
584 mamountLabel->setText(tr("Amount in gr:"));
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
585 else
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
586 mamountLabel->setText(tr("Amount in ml:"));
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
587 mamountLabel->setGeometry(QRect(10, 70, 141, 20));
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
588 mamountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
589
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
590 mtimeLabel = new QLabel(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
591 mtimeLabel->setObjectName(QString::fromUtf8("mtimeLabel"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
592 if (recipe->miscs.at(recipe->miscs_row).use_use == 3 || recipe->miscs.at(recipe->miscs_row).use_use == 4) // Fermentation stages
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
593 mtimeLabel->setText(tr("Time in days:"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
594 else if (recipe->miscs.at(recipe->miscs_row).use_use == 2) // Boil
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
595 mtimeLabel->setText(tr("Time in minutes:"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
596 else
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
597 mtimeLabel->setText("");
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
598 mtimeLabel->setGeometry(QRect(10, 100, 141, 20));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
599 mtimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
600
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
601 QLabel *selectLabel = new QLabel(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
602 selectLabel->setObjectName(QString::fromUtf8("selectLabel"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
603 selectLabel->setText(tr("Select ingredient:"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
604 selectLabel->setGeometry(QRect(10, 40, 141, 20));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
605 selectLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
606 QLabel *instockLabel = new QLabel(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
607 instockLabel->setObjectName(QString::fromUtf8("instockLabel"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
608 instockLabel->setText(tr("In stock:"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
609 instockLabel->setGeometry(QRect(525, 40, 121, 20));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
610 instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
611
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
612 mselectEdit = new QComboBox(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
613 mselectEdit->setObjectName(QString::fromUtf8("selectEdit"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
614 mselectEdit->setGeometry(QRect(160, 40, 371, 23));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
615
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
616 mnameEdit = new QLineEdit(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
617 mnameEdit->setObjectName(QString::fromUtf8("mnameEdit"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
618 mnameEdit->setText(recipe->miscs.at(recipe->miscs_row).name);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
619 mnameEdit->setGeometry(QRect(160, 10, 511, 23));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
620 mnameEdit->setReadOnly(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
621
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
622 mamountEdit = new QDoubleSpinBox(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
623 mamountEdit->setObjectName(QString::fromUtf8("mamountEdit"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
624 mamountEdit->setGeometry(QRect(160, 70, 121, 24));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
625 mamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
626 mamountEdit->setAccelerated(true);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
627 mamountEdit->setDecimals(2);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
628 mamountEdit->setMaximum(1000000.0);
139
f947c6988e91 Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
629 mamountEdit->setSingleStep(0.1);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
630 mamountEdit->setValue(recipe->miscs.at(recipe->miscs_row).amount * 1000.0);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
631
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
632 mtimeEdit = new QSpinBox(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
633 mtimeEdit->setObjectName(QString::fromUtf8("mtimeEdit"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
634 mtimeEdit->setGeometry(QRect(160, 100, 121, 24));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
635 mtimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
636 mtimeEdit->setAccelerated(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
637 mtimeEdit->setMaximum(10000.0);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
638 if (recipe->miscs.at(recipe->miscs_row).use_use == 3 || recipe->miscs.at(recipe->miscs_row).use_use == 4) { // Fermentation stages
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
639 mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).time / 1440);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
640 mtimeEdit->setReadOnly(false);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
641 } else if (recipe->miscs.at(recipe->miscs_row).use_use == 2) { // Boil
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
642 mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).time);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
643 mtimeEdit->setReadOnly(false);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
644 } else {
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
645 mtimeEdit->setReadOnly(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
646 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
647
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
648 useatEdit = new QComboBox(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
649 useatEdit->setObjectName(QString::fromUtf8("useatEdit"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
650 useatEdit->setGeometry(QRect(160, 130, 161, 23));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
651 useatEdit->addItem(tr("Starter"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
652 useatEdit->addItem(tr("Mash"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
653 useatEdit->addItem(tr("Boil"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
654 useatEdit->addItem(tr("Primary"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
655 useatEdit->addItem(tr("Secondary"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
656 useatEdit->addItem(tr("Bottling"));
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
657 useatEdit->addItem(tr("Sparge"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
658 useatEdit->setCurrentIndex(recipe->miscs.at(recipe->miscs_row).use_use);
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
659
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
660 minstockEdit = new QCheckBox(dialog);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
661 minstockEdit->setObjectName(QString::fromUtf8("minstockEdit"));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
662 minstockEdit->setGeometry(QRect(655, 40, 85, 21));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
663 minstockEdit->setChecked(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
664
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
665 misc_instock_changed(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
666
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
667 connect(mselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::misc_select_changed);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
668 connect(mamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::misc_amount_changed);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
669 connect(mtimeEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditRecipe::misc_time_changed);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
670 connect(useatEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::misc_useat_changed);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
671 connect(minstockEdit, &QCheckBox::stateChanged, this, &EditRecipe::misc_instock_changed);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
672 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
673 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
674
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
675 dialog->setModal(true);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
676 dialog->exec();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
677 if (dialog->result() == QDialog::Rejected) {
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
678 qDebug() << "reject and rollback";
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
679 recipe->miscs[recipe->miscs_row] = backup;
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
680 } else {
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
681 /* Clear time if misc is not used for boil or fermentation. */
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
682 if (! (recipe->miscs.at(recipe->miscs_row).use_use == 2 ||
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
683 recipe->miscs.at(recipe->miscs_row).use_use == 3 ||
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
684 recipe->miscs.at(recipe->miscs_row).use_use == 4)) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
685 if (recipe->miscs.at(recipe->miscs_row).time) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
686 recipe->miscs[recipe->miscs_row].time = 0;
132
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
687 is_changed();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
688 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
689 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
690 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
691
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
692 disconnect(mselectEdit, nullptr, nullptr, nullptr);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
693 disconnect(mamountEdit, nullptr, nullptr, nullptr);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
694 disconnect(mtimeEdit, nullptr, nullptr, nullptr);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
695 disconnect(useatEdit, nullptr, nullptr, nullptr);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
696 disconnect(minstockEdit, nullptr, nullptr, nullptr);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
697 disconnect(buttonBox, nullptr, nullptr, nullptr);
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
698
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
699 emit refreshAll();
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
700 }
9ede9c75cb54 Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
701
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: 140
diff changeset
702
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: 140
diff changeset
703 void EditRecipe::adjustMiscs(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: 140
diff changeset
704 {
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: 140
diff changeset
705 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: 140
diff changeset
706
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: 140
diff changeset
707 if (recipe->miscs.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: 140
diff changeset
708 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: 140
diff changeset
709
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
710 const QSignalBlocker blocker1(ui->bs_cacl2Edit);
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
711 const QSignalBlocker blocker2(ui->bs_caso4Edit);
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
712 const QSignalBlocker blocker3(ui->bs_mgso4Edit);
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
713 const QSignalBlocker blocker4(ui->bs_naclEdit);
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
714 const QSignalBlocker blocker5(ui->bs_mgcl2Edit);
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
715 const QSignalBlocker blocker6(ui->bs_nahco3Edit);
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
716 const QSignalBlocker blocker7(ui->bs_caco3Edit);
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
717 const QSignalBlocker blocker9(ui->mw_acidvolEdit);
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
718 const QSignalBlocker blocker10(ui->ss_cacl2Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
719 const QSignalBlocker blocker11(ui->ss_caso4Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
720 const QSignalBlocker blocker12(ui->ss_mgso4Edit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
721 const QSignalBlocker blocker13(ui->ss_naclEdit);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
722 const QSignalBlocker blocker14(ui->ss_mgcl2Edit);
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
723
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: 140
diff changeset
724 for (int i = 0; i < recipe->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
725 amount = recipe->miscs.at(i).amount * factor;
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
726 recipe->miscs[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: 140
diff changeset
727
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: 140
diff changeset
728 /*
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: 140
diff changeset
729 * Update the water agents.
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: 140
diff changeset
730 */
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
731 if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT && recipe->miscs.at(i).use_use == MISC_USES_MASH) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
732 if (recipe->miscs.at(i).name == "CaCl2") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
733 ui->bs_cacl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
734 } else if (recipe->miscs.at(i).name == "CaSO4") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
735 ui->bs_caso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
736 } else if (recipe->miscs.at(i).name == "MgSO4") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
737 ui->bs_mgso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
738 } else if (recipe->miscs.at(i).name == "NaCl") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
739 ui->bs_naclEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
740 } else if (recipe->miscs.at(i).name == "MgCl2") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
741 ui->bs_mgcl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
742 } else if (recipe->miscs.at(i).name == "NaHCO3") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
743 ui->bs_nahco3Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
744 } else if (recipe->miscs.at(i).name == "CaCO3") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
745 ui->bs_caco3Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
746 } else if (recipe->miscs.at(i).name == "Melkzuur" || recipe->miscs.at(i).name == "Lactic") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
747 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
748 } else if (recipe->miscs.at(i).name == "Zoutzuur" || recipe->miscs.at(i).name == "Hydrochloric") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
749 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
750 } else if (recipe->miscs.at(i).name == "Fosforzuur" || recipe->miscs.at(i).name == "Phosphoric") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
751 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
752 } else if (recipe->miscs.at(i).name == "Zwavelzuur" || recipe->miscs.at(i).name == "Sulfuric") {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
753 ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
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: 140
diff changeset
754 }
359
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
755 } else if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT && recipe->miscs.at(i).use_use == MISC_USES_SPARGE) {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
756 if (recipe->miscs.at(i).name == "CaCl2") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
757 ui->ss_cacl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
758 } else if (recipe->miscs.at(i).name == "CaSO4") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
759 ui->ss_caso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
760 } else if (recipe->miscs.at(i).name == "MgSO4") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
761 ui->ss_mgso4Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
762 } else if (recipe->miscs.at(i).name == "NaCl") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
763 ui->ss_naclEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
764 } else if (recipe->miscs.at(i).name == "MgCl2") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
765 ui->ss_mgcl2Edit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
766 } else if (recipe->miscs.at(i).name == "Melkzuur" || recipe->miscs.at(i).name == "Lactic") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
767 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
768 } else if (recipe->miscs.at(i).name == "Zoutzuur" || recipe->miscs.at(i).name == "Hydrochloric") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
769 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
770 } else if (recipe->miscs.at(i).name == "Fosforzuur" || recipe->miscs.at(i).name == "Phosphoric") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
771 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
772 } else if (recipe->miscs.at(i).name == "Zwavelzuur" || recipe->miscs.at(i).name == "Sulfuric") {
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
773 ui->sp_acidvolEdit->setValue(recipe->miscs.at(i).amount * 1000.0);
dfbb012c631c Redesign of the water tabs in product and recipe editors. Prepare for sparge water salt additions. Acid additions are now automatic or manual for mash and sparge. Fixed error in acid calculation strength. Fixed phophoric SG value.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
774 }
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: 140
diff changeset
775 }
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: 140
diff changeset
776 }
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: 140
diff changeset
777 }
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: 140
diff changeset
778
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: 140
diff changeset
779

mercurial