Sat, 02 Jul 2022 15:45:01 +0200
Version 0.2.14
128 | 1 | /** |
2 | * EditRecipe.cpp is part of bmsapp. | |
3 | * | |
4 | * tab 4, miscs. | |
5 | * | |
6 | * bmsapp is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * bmsapp is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | ||
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 | 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 | 32 | } |
33 | ||
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 | qDebug() << "refreshMiscs" << 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
|
43 | 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
|
44 | |
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
|
45 | 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
|
46 | 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
|
47 | 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
|
48 | 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
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | 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
|
53 | const QSignalBlocker blocker9(ui->mw_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
|
54 | |
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
|
55 | 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
|
56 | |
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
|
57 | 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
|
58 | 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
|
59 | 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
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | 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
|
64 | 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
|
65 | 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
|
66 | 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
|
67 | 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
|
68 | |
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 | 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
|
70 | |
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
|
71 | 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
|
72 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
73 | 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
|
74 | 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
|
75 | 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
|
76 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
77 | 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
|
78 | 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
|
79 | 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
|
80 | |
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
|
81 | 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
|
82 | 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
|
83 | } 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
|
84 | 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
|
85 | } 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
|
86 | 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
|
87 | } |
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
|
88 | 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
|
89 | 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
|
90 | |
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
|
91 | 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
|
92 | 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
|
93 | 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
|
94 | 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
|
95 | 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
|
96 | 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
|
97 | |
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
|
98 | /* |
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 | * 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
|
100 | * 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
|
101 | */ |
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
|
102 | 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
|
103 | 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
|
104 | 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
|
105 | 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
|
106 | 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
|
107 | 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
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | } 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
|
112 | 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
|
113 | 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
|
114 | } |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
115 | 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
|
116 | 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
|
117 | } |
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
|
118 | 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
|
119 | 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
|
120 | 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
|
121 | 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
|
122 | 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
|
123 | 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
|
124 | 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
|
125 | 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
|
126 | 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
|
127 | 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
|
128 | |
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 | 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
|
130 | 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
|
131 | 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
|
132 | 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
|
133 | 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
|
134 | 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
|
135 | 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
|
136 | 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
|
137 | 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
|
138 | 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
|
139 | } |
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 | |
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 | /* |
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 | * 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
|
143 | */ |
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
|
144 | if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT) { |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
261
diff
changeset
|
145 | 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
|
146 | 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
|
147 | } 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
|
148 | 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
|
149 | } 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
|
150 | 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
|
151 | } 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
|
152 | 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
|
153 | } 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
|
154 | 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
|
155 | } 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
|
156 | 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
|
157 | } 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
|
158 | 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
|
159 | } 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
|
160 | 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
|
161 | 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
|
162 | 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
|
163 | 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
|
164 | 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
|
165 | } 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | 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
|
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 == "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
|
172 | 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
|
173 | 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
|
174 | 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
|
175 | 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
|
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 == "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
|
178 | 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
|
179 | 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
|
180 | 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
|
181 | 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
|
182 | 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
|
183 | } |
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 | } |
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 | } |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
186 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
187 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
188 | |
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
|
189 | /* |
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
|
190 | * 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
|
191 | */ |
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
|
192 | void EditRecipe::brewing_salt_sub(QString salt, double val) |
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
|
193 | { |
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
|
194 | 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
|
195 | |
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
|
196 | 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
|
197 | 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
|
198 | /* |
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
|
199 | * 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
|
200 | */ |
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
|
201 | 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
|
202 | if (salt.contains(recipe->miscs.at(i).name)) { |
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
|
203 | qDebug() << " brewing_salt_sub delete" << salt; |
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
|
204 | 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
|
205 | 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
|
206 | 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
|
207 | } |
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
|
208 | } |
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
|
209 | 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
|
210 | } |
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
|
211 | |
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
|
212 | /* |
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
|
213 | * 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
|
214 | * 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
|
215 | */ |
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
|
216 | 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
|
217 | if (salt.contains(recipe->miscs.at(i).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
|
218 | 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
|
219 | 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
|
220 | 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
|
221 | 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
|
222 | 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
|
223 | 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
|
224 | 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
|
225 | 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
|
226 | } |
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
|
227 | } |
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
|
228 | |
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
|
229 | /* |
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
|
230 | * 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
|
231 | * 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
|
232 | * 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
|
233 | * 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
|
234 | */ |
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 | 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
|
236 | 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
|
237 | 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
|
238 | 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
|
239 | 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
|
240 | 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
|
241 | 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
|
242 | m.type = 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
|
243 | m.use_use = query.value(3).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
|
244 | 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
|
245 | 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
|
246 | 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
|
247 | 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
|
248 | 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
|
249 | 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
|
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 | } |
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 | qDebug() << "brewing_salt_sub, nothing done." << salt << val; |
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 | |
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 | |
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 | * 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
|
259 | */ |
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
|
260 | void EditRecipe::set_brewing_salt(QString salt, double val) |
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
|
261 | { |
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
|
262 | val = round(val * 100.0) / 100.0; |
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
|
263 | qDebug() << "set_brewing_salt" << salt << val; |
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
|
264 | brewing_salt_sub(salt, val); |
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
|
265 | 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
|
266 | 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
|
267 | } |
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
|
268 | |
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
|
269 | |
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
|
270 | 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
|
271 | { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
272 | Miscs newm; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
273 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
274 | 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
|
275 | 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
|
276 | 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
|
277 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
278 | |
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
|
279 | 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
|
280 | 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
|
281 | 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
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | 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
|
286 | 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
|
287 | 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
|
288 | refreshMiscs(); |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
289 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
290 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
291 | |
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
|
292 | 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
|
293 | { |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
294 | if (recipe->locked || recipe->miscs.size() < 1) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
295 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
296 | |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
297 | 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
|
298 | 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
|
299 | 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
|
300 | |
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
|
301 | 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
|
302 | 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
|
303 | 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
|
304 | return; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
305 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
306 | 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
|
307 | is_changed(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
308 | emit refreshAll(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
309 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
310 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
311 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
312 | 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
|
313 | { |
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
|
314 | 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
|
315 | |
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
|
316 | 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
|
317 | |
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
|
318 | 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
|
319 | 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
|
320 | 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
|
321 | } 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
|
322 | 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
|
323 | } |
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
|
324 | 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
|
325 | 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
|
326 | |
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
|
327 | 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
|
328 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
329 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
330 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
331 | 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
|
332 | { |
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
|
333 | 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
|
334 | |
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
|
335 | 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
|
336 | |
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
|
337 | 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
|
338 | 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
|
339 | 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
|
340 | } 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
|
341 | 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
|
342 | 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
|
343 | 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
|
344 | } 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
|
345 | 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
|
346 | } |
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
|
347 | 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
|
348 | 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
|
349 | |
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
|
350 | 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
|
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_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
|
355 | { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
356 | 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
|
357 | 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
|
358 | QString w; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
359 | QTableWidgetItem *item; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
360 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
361 | 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
|
362 | return; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
363 | |
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
|
364 | 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
|
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 | /* |
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 | * 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
|
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 | 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
|
370 | 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
|
371 | 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
|
372 | 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
|
373 | 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
|
374 | 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
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | } |
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
|
380 | 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
|
381 | |
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
|
382 | /* |
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
|
383 | * 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
|
384 | */ |
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
|
385 | 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
|
386 | 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
|
387 | 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
|
388 | 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
|
389 | 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
|
390 | 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
|
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 | /* |
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
|
393 | * 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
|
394 | */ |
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
|
395 | 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
|
396 | 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
|
397 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
398 | 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
|
399 | 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
|
400 | 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
|
401 | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
402 | 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
|
403 | 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
|
404 | 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
|
405 | 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
|
406 | |
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
|
407 | 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
|
408 | 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
|
409 | 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
|
410 | 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
|
411 | 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
|
412 | } 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
|
413 | 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
|
414 | 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
|
415 | 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
|
416 | 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
|
417 | } 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
|
418 | 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
|
419 | 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
|
420 | 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
|
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 | 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
|
423 | 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
|
424 | |
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
|
425 | 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
|
426 | 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
|
427 | 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
|
428 | } 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
|
429 | 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
|
430 | 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
|
431 | } |
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
|
432 | 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
|
433 | 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
|
434 | |
261
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
435 | 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
|
436 | 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
|
437 | refreshMiscs(); |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
438 | /* |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
439 | * 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
|
440 | */ |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
441 | 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
|
442 | 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
|
443 | (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
|
444 | (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
|
445 | 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
|
446 | break; |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
447 | } |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
448 | } |
246893ad04a6
Updated the changes from the product misc editor to the recipe misc editor.
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
449 | 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
|
450 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
451 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
452 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
453 | 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
|
454 | { |
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
|
455 | 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
|
456 | |
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
|
457 | 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
|
458 | |
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 | 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
|
460 | 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
|
461 | 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
|
462 | 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
|
463 | 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
|
464 | 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
|
465 | 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
|
466 | 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
|
467 | 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
|
468 | 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
|
469 | 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
|
470 | 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
|
471 | 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
|
472 | 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
|
473 | } |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
474 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
475 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
476 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
477 | 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
|
478 | { |
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
|
479 | 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
|
480 | |
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
|
481 | 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
|
482 | 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
|
483 | 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
|
484 | 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
|
485 | 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
|
486 | |
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 | 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
|
488 | 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
|
489 | 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
|
490 | 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
|
491 | 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
|
492 | } 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
|
493 | 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
|
494 | 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
|
495 | 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
|
496 | 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
|
497 | } 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
|
498 | 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
|
499 | 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
|
500 | 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
|
501 | 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
|
502 | 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
|
503 | } |
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
|
504 | 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
|
505 | 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
|
506 | |
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
|
507 | 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
|
508 | } |
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
|
509 | |
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
|
510 | |
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
|
511 | 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
|
512 | { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
513 | QSqlQuery query; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
514 | |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
515 | if (recipe->locked) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
516 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
517 | |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
518 | 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
|
519 | 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
|
520 | 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
|
521 | 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
|
522 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
523 | 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
|
524 | 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
|
525 | 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
|
526 | 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
|
527 | 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
|
528 | 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
|
529 | 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
|
530 | 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
|
531 | 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
|
532 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
533 | 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
|
534 | 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
|
535 | 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
|
536 | 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
|
537 | 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
|
538 | |
139
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | 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
|
544 | 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
|
545 | 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
|
546 | 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
|
547 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
548 | 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
|
549 | 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
|
550 | 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
|
551 | 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
|
552 | 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
|
553 | 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
|
554 | else |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
555 | mtimeLabel->setText(""); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
556 | 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
|
557 | 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
|
558 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
559 | 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
|
560 | 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
|
561 | 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
|
562 | 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
|
563 | 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
|
564 | 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
|
565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
570 | 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
|
571 | 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
|
572 | 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
|
573 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
574 | 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
|
575 | 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
|
576 | 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
|
577 | 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
|
578 | 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
|
579 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | 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
|
588 | 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
|
589 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
590 | 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
|
591 | 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
|
592 | 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
|
593 | 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
|
594 | 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
|
595 | 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
|
596 | 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
|
597 | 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
|
598 | 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
|
599 | } 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
|
600 | 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
|
601 | 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
|
602 | } else { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
603 | 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
|
604 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
605 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | 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
|
610 | 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
|
611 | 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
|
612 | 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
|
613 | 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
|
614 | useatEdit->addItem(tr("Bottling")); |
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
|
615 | 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
|
616 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
617 | 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
|
618 | 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
|
619 | 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
|
620 | 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
|
621 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
622 | 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
|
623 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
624 | 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
|
625 | 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
|
626 | 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
|
627 | 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
|
628 | 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
|
629 | 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
|
630 | 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
|
631 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
632 | 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
|
633 | dialog->exec(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
634 | 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
|
635 | 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
|
636 | 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
|
637 | } else { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
638 | /* 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
|
639 | 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
|
640 | 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
|
641 | 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
|
642 | 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
|
643 | 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
|
644 | is_changed(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
645 | } |
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 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
649 | 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
|
650 | 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
|
651 | 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
|
652 | 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
|
653 | 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
|
654 | 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
|
655 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
656 | emit refreshAll(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
657 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
658 | |
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
|
659 | |
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
|
660 | 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
|
661 | { |
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
|
662 | 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
|
663 | |
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
|
664 | 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
|
665 | 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
|
666 | |
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
|
667 | 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
|
668 | 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
|
669 | 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
|
670 | 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
|
671 | 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
|
672 | 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
|
673 | 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
|
674 | const QSignalBlocker blocker9(ui->mw_acidvolEdit); |
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
|
675 | |
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
|
676 | 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
|
677 | 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
|
678 | 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
|
679 | |
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
|
680 | /* |
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
|
681 | * 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
|
682 | */ |
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
|
683 | if (recipe->miscs.at(i).type == MISC_TYPES_WATER_AGENT) { |
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 | 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
|
685 | 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
|
686 | } 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
|
687 | 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
|
688 | } 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
|
689 | 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
|
690 | } 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
|
691 | 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
|
692 | } 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
|
693 | 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
|
694 | } 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
|
695 | 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
|
696 | } 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
|
697 | 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
|
698 | } 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
|
699 | 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
|
700 | } 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
|
701 | 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
|
702 | } 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
|
703 | 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
|
704 | } 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
|
705 | 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
|
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 | } |
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 | } |
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 | } |
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
|
710 | |
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
|
711 |