Fri, 20 May 2022 22:06:06 +0200
Version 0.2.1. Updated translations.
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 | { |
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
|
23 | if (D1.m_use_use > D2.m_use_use) |
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; |
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
|
25 | if (D1.m_use_use < D2.m_use_use) |
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; |
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
|
27 | if (D1.m_type > D2.m_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
|
28 | return false; |
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
|
29 | if (D1.m_type < D2.m_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
|
30 | return true; |
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
|
31 | return (D1.m_amount > D2.m_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 | |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
71 | ui->miscsTable->setItem(i, 0, new QTableWidgetItem(recipe->miscs.at(i).m_name)); |
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 | |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
73 | item = new QTableWidgetItem(misc_types[recipe->miscs.at(i).m_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 | |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
77 | item = new QTableWidgetItem(misc_uses[recipe->miscs.at(i).m_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 | |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
81 | if (recipe->miscs.at(i).m_use_use == 2) { // Boil |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
82 | item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(i).m_time, 1, 'f', 0, '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
|
83 | } else if (recipe->miscs.at(i).m_use_use == 3 || recipe->miscs.at(i).m_use_use == 4) { // Primary or secondary |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
84 | item = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(i).m_time / 1440, 1, 'f', 0, '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
|
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 | |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
91 | if (recipe->miscs.at(i).m_amount_is_weight) |
135
e68b27ad8a40
Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
92 | item = new QTableWidgetItem(QString("%1 gr").arg(recipe->miscs.at(i).m_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 |
135
e68b27ad8a40
Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
94 | item = new QTableWidgetItem(QString("%1 ml").arg(recipe->miscs.at(i).m_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 | */ |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
102 | if (recipe->miscs.at(i).m_type == 4) { |
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); |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
105 | } 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
|
106 | 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
|
107 | 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
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | 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
|
112 | 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
|
113 | 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
|
114 | 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
|
115 | 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
|
116 | |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
117 | 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
|
118 | 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
|
119 | 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
|
120 | 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
|
121 | 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
|
122 | 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
|
123 | 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
|
124 | 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
|
125 | 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
|
126 | 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
|
127 | } |
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 | /* |
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 | * 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
|
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
|
132 | if (recipe->miscs.at(i).m_type == 4) { |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
133 | if (recipe->miscs.at(i).m_name == "CaCl2") { |
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 | ui->bs_cacl2Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
135 | } else if (recipe->miscs.at(i).m_name == "CaSO4") { |
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 | ui->bs_caso4Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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 | } else if (recipe->miscs.at(i).m_name == "MgSO4") { |
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->bs_mgso4Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
139 | } else if (recipe->miscs.at(i).m_name == "NaCl") { |
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 | ui->bs_naclEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
141 | } else if (recipe->miscs.at(i).m_name == "MgCl2") { |
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 | ui->bs_mgcl2Edit->setValue(recipe->miscs.at(i).m_amount * 1000.0); |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
143 | } else if (recipe->miscs.at(i).m_name == "NaHCO3") { |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
144 | ui->bs_nahco3Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
145 | } else if (recipe->miscs.at(i).m_name == "CaCO3") { |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
146 | ui->bs_caco3Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
147 | } else if (recipe->miscs.at(i).m_name == "Melkzuur" || recipe->miscs.at(i).m_name == "Lactic") { |
0115b97e8c39
Added global variables, C++ lovers will hate that. Added global acid data. Fixed several load and save errors in the json arrays in the recipe record. Added first part of the miscs table. The first part of the water tab has values.
Michiel Broek <mbroek@mbse.eu>
parents:
128
diff
changeset
|
148 | 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
|
149 | 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
|
150 | 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
|
151 | ui->mw_acidpercEdit->setValue(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
|
152 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
153 | } else if (recipe->miscs.at(i).m_name == "Zoutzuur" || recipe->miscs.at(i).m_name == "Hydrochloric") { |
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
|
154 | 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
|
155 | 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
|
156 | 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
|
157 | ui->mw_acidpercEdit->setValue(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
|
158 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
159 | } else if (recipe->miscs.at(i).m_name == "Fosforzuur" || recipe->miscs.at(i).m_name == "Phosphoric") { |
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 = 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
|
161 | 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
|
162 | 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
|
163 | ui->mw_acidpercEdit->setValue(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
|
164 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
165 | } else if (recipe->miscs.at(i).m_name == "Zwavelzuur" || recipe->miscs.at(i).m_name == "Sulfuric") { |
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 = 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
|
167 | 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
|
168 | 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
|
169 | ui->mw_acidpercEdit->setValue(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
|
170 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
171 | } |
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 | } |
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 | } |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
174 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
175 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
176 | |
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
|
177 | /* |
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
|
178 | * 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
|
179 | */ |
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
|
180 | 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
|
181 | { |
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
|
182 | 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
|
183 | |
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
|
184 | 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
|
185 | 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
|
186 | /* |
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
|
187 | * 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
|
188 | */ |
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 | for (int i = 0; i < recipe->miscs.size(); 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
|
190 | if (salt.contains(recipe->miscs.at(i).m_name)) { |
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 | 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
|
192 | 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
|
193 | 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
|
194 | 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
|
195 | } |
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
|
196 | } |
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 | qDebug() << " brewing_salt_sub delete error"; |
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 | 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
|
199 | } |
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 | /* |
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
|
202 | * 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
|
203 | * 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
|
204 | */ |
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 | for (int i = 0; i < recipe->miscs.size(); 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
|
206 | if (salt.contains(recipe->miscs.at(i).m_name)) { |
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 | recipe->miscs[i].m_amount = val / 1000.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
|
208 | if (recipe->miscs.at(i).m_amount_is_weight) |
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 | 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
|
210 | 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
|
211 | 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
|
212 | 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
|
213 | 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
|
214 | 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
|
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 | } |
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
|
217 | |
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
|
218 | /* |
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
|
219 | * 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
|
220 | * 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
|
221 | * 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
|
222 | * 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
|
223 | */ |
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 | 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
|
225 | 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
|
226 | 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
|
227 | 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
|
228 | Miscs 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
|
229 | m.m_name = 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
|
230 | m.m_amount = val / 1000.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
|
231 | m.m_type = query.value(2).toInt(); |
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 | m.m_use_use = query.value(3).toInt(); |
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 | m.m_time = query.value(4).toDouble(); |
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 | m.m_amount_is_weight = query.value(5).toInt() ? true:false; |
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 | m.m_cost = query.value(10).toDouble(); |
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 | 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
|
237 | 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
|
238 | 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
|
239 | } |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
240 | } |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
241 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
242 | 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
|
243 | } |
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
|
244 | |
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
|
245 | |
17030224d919
Remove some water search debug messages. Added signals and slots for mash water pH and volume changes. Added manual pH adjust.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
246 | /* |
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 | * 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
|
248 | */ |
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
|
249 | 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
|
250 | { |
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
|
251 | 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
|
252 | 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
|
253 | 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
|
254 | 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
|
255 | 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
|
256 | } |
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
|
257 | |
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
|
258 | |
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
|
259 | 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
|
260 | { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
261 | Miscs newm; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
262 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
263 | for (int i = 0; i < recipe->miscs.size(); i++) { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
264 | if (recipe->miscs.at(i).m_amount == 0) |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
265 | 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
|
266 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
267 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
268 | newm.m_name = "Select one"; |
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
|
269 | newm.m_amount = 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
|
270 | newm.m_type = 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
|
271 | newm.m_use_use = 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
|
272 | newm.m_time = 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
|
273 | newm.m_amount_is_weight = 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
|
274 | newm.m_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
|
275 | 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
|
276 | 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
|
277 | emit refreshAll(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
278 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
279 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
280 | |
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
|
281 | 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
|
282 | { |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
283 | if (recipe->locked || recipe->miscs.size() < 1) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
284 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
285 | |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
286 | 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
|
287 | 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
|
288 | 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
|
289 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
290 | int rc = QMessageBox::warning(this, tr("Delete misc"), tr("Delete %1").arg(recipe->miscs.at(row).m_name), |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
291 | 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
|
292 | 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
|
293 | return; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
294 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
295 | 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
|
296 | is_changed(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
297 | emit refreshAll(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
298 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
299 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
300 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
301 | 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
|
302 | { |
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
|
303 | 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
|
304 | |
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
|
305 | 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
|
306 | |
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
|
307 | recipe->miscs[recipe->miscs_row].m_amount = val / 1000.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
|
308 | if (recipe->miscs.at(recipe->miscs_row).m_amount_is_weight) { |
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
|
309 | item = new QTableWidgetItem(QString("%1 gr").arg(recipe->miscs.at(recipe->miscs_row).m_amount * 1000.0, 3, 'f', 2, '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
|
310 | } 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
|
311 | item = new QTableWidgetItem(QString("%1 ml").arg(recipe->miscs.at(recipe->miscs_row).m_amount * 1000.0, 3, 'f', 2, '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
|
312 | } |
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
|
313 | 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
|
314 | 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
|
315 | |
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 | 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
|
317 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
318 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
319 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
320 | 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
|
321 | { |
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
|
322 | 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
|
323 | |
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
|
324 | 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
|
325 | |
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 | if (recipe->miscs.at(recipe->miscs_row).m_use_use == 2) { // Boil |
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 | recipe->miscs[recipe->miscs_row].m_time = 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
|
328 | item = new QTableWidgetItem(QString("%1 min.").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
|
329 | } else if (recipe->miscs.at(recipe->miscs_row).m_use_use == 3 || recipe->miscs.at(recipe->miscs_row).m_use_use == 4) { // Primary or secondary |
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
|
330 | recipe->miscs[recipe->miscs_row].m_time = val * 1440; |
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
|
331 | 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
|
332 | } 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
|
333 | 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
|
334 | } |
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 | 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
|
336 | 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
|
337 | |
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
|
338 | 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
|
339 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
340 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
341 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
342 | 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
|
343 | { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
344 | 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
|
345 | 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
|
346 | QString w; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
347 | QTableWidgetItem *item; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
348 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
349 | 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
|
350 | return; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
351 | |
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
|
352 | 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
|
353 | |
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
|
354 | /* |
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
|
355 | * 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
|
356 | */ |
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 | 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
|
358 | 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
|
359 | 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
|
360 | 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
|
361 | 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
|
362 | 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
|
363 | 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
|
364 | 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
|
365 | 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
|
366 | 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
|
367 | } |
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 | 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
|
369 | |
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 | /* |
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 | * 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
|
372 | */ |
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 | recipe->miscs[recipe->miscs_row].m_name = 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
|
374 | recipe->miscs[recipe->miscs_row].m_type = query.value(1).toInt(); |
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 | recipe->miscs[recipe->miscs_row].m_use_use = query.value(2).toInt(); |
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 | recipe->miscs[recipe->miscs_row].m_time = query.value(3).toDouble(); |
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 | recipe->miscs[recipe->miscs_row].m_amount_is_weight = query.value(4).toInt() ? true: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
|
378 | recipe->miscs[recipe->miscs_row].m_cost = query.value(5).toDouble(); |
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 | /* |
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 | * 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
|
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 | mnameEdit->setText(recipe->miscs.at(recipe->miscs_row).m_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
|
384 | ui->miscsTable->setItem(recipe->miscs_row, 0, new QTableWidgetItem(recipe->miscs.at(recipe->miscs_row).m_name)); |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
385 | |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
386 | item = new QTableWidgetItem(misc_types[recipe->miscs.at(recipe->miscs_row).m_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
|
387 | 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
|
388 | 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
|
389 | |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
390 | item = new QTableWidgetItem(misc_uses[recipe->miscs.at(recipe->miscs_row).m_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
|
391 | 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
|
392 | ui->miscsTable->setItem(recipe->miscs_row, 2, 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
|
393 | useatEdit->setCurrentIndex(recipe->miscs.at(recipe->miscs_row).m_use_use); |
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 | |
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
|
395 | if (recipe->miscs.at(recipe->miscs_row).m_use_use == 3 || recipe->miscs.at(recipe->miscs_row).m_use_use == 4) { // Fermentation stages |
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
|
396 | mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).m_time / 1440); |
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
|
397 | 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
|
398 | mtimeLabel->setText(tr("Time in days:")); |
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 = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(recipe->miscs_row).m_time / 1440, 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
|
400 | } else if (recipe->miscs.at(recipe->miscs_row).m_use_use == 2) { // Boil |
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 | mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).m_time); |
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
|
402 | 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
|
403 | mtimeLabel->setText(tr("Time in minutes:")); |
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 | item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(recipe->miscs_row).m_time, 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
|
405 | } 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
|
406 | 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
|
407 | 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
|
408 | 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
|
409 | } |
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 | 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
|
411 | 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
|
412 | |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
413 | if (recipe->miscs.at(recipe->miscs_row).m_amount_is_weight) { |
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 | mamountLabel->setText(tr("Amount in gr:")); |
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 | item = new QTableWidgetItem(QString("%1 gr").arg(recipe->miscs.at(recipe->miscs_row).m_amount * 1000.0, 3, 'f', 2, '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
|
416 | } 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
|
417 | 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
|
418 | item = new QTableWidgetItem(QString("%1 ml").arg(recipe->miscs.at(recipe->miscs_row).m_amount * 1000.0, 3, 'f', 2, '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
|
419 | } |
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->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
|
421 | 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
|
422 | |
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 | is_changed(); |
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 | emit refreshAll(); |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
425 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
426 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
427 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
428 | 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
|
429 | { |
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
|
430 | 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
|
431 | |
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
|
432 | 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
|
433 | |
f947c6988e91
Fixed complains about missing signals. Added add misc row, misc amount changed, misc time changed, misc select changed and misc instock changed. Silence false changed trigger.
Michiel Broek <mbroek@mbse.eu>
parents:
137
diff
changeset
|
434 | 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
|
435 | 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
|
436 | 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
|
437 | 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
|
438 | 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
|
439 | 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
|
440 | 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
|
441 | 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
|
442 | 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
|
443 | 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
|
444 | for (int i = 0; i < query.size(); i++) { |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
445 | this->mselectEdit->addItem(query.value(0).toString()+ " (" + 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
|
446 | 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
|
447 | 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
|
448 | } |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
449 | } |
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 | 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
|
453 | { |
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
|
454 | 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
|
455 | |
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
|
456 | qDebug() << "misc_useat_changed" << val; |
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
|
457 | recipe->miscs[recipe->miscs_row].m_use_use = val; |
154
1af9f7b7f317
Moved QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
152
diff
changeset
|
458 | item = new QTableWidgetItem(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
|
459 | 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
|
460 | 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
|
461 | |
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
|
462 | if (val == 3 || val == 4) { // Fermentation stages |
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
|
463 | recipe->miscs[recipe->miscs_row].m_time = mtimeEdit->value() * 1440; |
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
|
464 | 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
|
465 | mtimeLabel->setText(tr("Time in days:")); |
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
|
466 | item = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(recipe->miscs_row).m_time / 1440, 1, 'f', 0, '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
|
467 | } else if (val == 2) { // Boil |
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
|
468 | recipe->miscs[recipe->miscs_row].m_time = mtimeEdit->value(); |
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
|
469 | 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
|
470 | mtimeLabel->setText(tr("Time in minutes:")); |
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
|
471 | item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(recipe->miscs_row).m_time, 1, 'f', 0, '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
|
472 | } else { |
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
|
473 | recipe->miscs[recipe->miscs_row].m_time = 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
|
474 | 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
|
475 | 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
|
476 | 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
|
477 | 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
|
478 | } |
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 | 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
|
480 | 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
|
481 | |
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
|
482 | 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
|
483 | } |
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
|
484 | |
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
|
485 | |
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
|
486 | 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
|
487 | { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
488 | QSqlQuery query; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
489 | |
171
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
490 | if (recipe->locked) |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
491 | return; |
6cd2d808d863
Implemented recipe lock setting.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
492 | |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
493 | 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
|
494 | 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
|
495 | 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
|
496 | 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
|
497 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
498 | 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
|
499 | 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
|
500 | 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
|
501 | 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
|
502 | 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
|
503 | 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
|
504 | 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
|
505 | 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
|
506 | 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
|
507 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
508 | 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
|
509 | 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
|
510 | 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
|
511 | 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
|
512 | 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
|
513 | |
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
|
514 | 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
|
515 | mamountLabel->setObjectName(QString::fromUtf8("mamountLabel")); |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
516 | if (recipe->miscs.at(recipe->miscs_row).m_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
|
517 | 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
|
518 | 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
|
519 | 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
|
520 | 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
|
521 | 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
|
522 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
523 | 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
|
524 | mtimeLabel->setObjectName(QString::fromUtf8("mtimeLabel")); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
525 | if (recipe->miscs.at(recipe->miscs_row).m_use_use == 3 || recipe->miscs.at(recipe->miscs_row).m_use_use == 4) // Fermentation stages |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
526 | mtimeLabel->setText(tr("Time in days:")); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
527 | else if (recipe->miscs.at(recipe->miscs_row).m_use_use == 2) // Boil |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
528 | 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
|
529 | else |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
530 | mtimeLabel->setText(""); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
531 | 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
|
532 | 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
|
533 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
534 | 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
|
535 | 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
|
536 | 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
|
537 | 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
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | 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
|
544 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
545 | 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
|
546 | 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
|
547 | 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
|
548 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
549 | 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
|
550 | mnameEdit->setObjectName(QString::fromUtf8("mnameEdit")); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
551 | mnameEdit->setText(recipe->miscs.at(recipe->miscs_row).m_name); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
552 | 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
|
553 | 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
|
554 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
555 | 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
|
556 | 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
|
557 | 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
|
558 | 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
|
559 | 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
|
560 | 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
|
561 | 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
|
562 | mamountEdit->setSingleStep(0.1); |
132
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
563 | mamountEdit->setValue(recipe->miscs.at(recipe->miscs_row).m_amount * 1000.0); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
564 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | mtimeEdit->setMaximum(10000.0); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
571 | if (recipe->miscs.at(recipe->miscs_row).m_use_use == 3 || recipe->miscs.at(recipe->miscs_row).m_use_use == 4) { // Fermentation stages |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
572 | mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).m_time / 1440); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
573 | 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
|
574 | } else if (recipe->miscs.at(recipe->miscs_row).m_use_use == 2) { // Boil |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
575 | mtimeEdit->setValue(recipe->miscs.at(recipe->miscs_row).m_time); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
576 | 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
|
577 | } else { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
578 | 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
|
579 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
580 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | 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
|
588 | 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
|
589 | useatEdit->addItem(tr("Bottling")); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
590 | useatEdit->setCurrentIndex(recipe->miscs.at(recipe->miscs_row).m_use_use); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
591 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
592 | 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
|
593 | 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
|
594 | 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
|
595 | 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
|
596 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
597 | 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
|
598 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
599 | 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
|
600 | 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
|
601 | 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
|
602 | 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
|
603 | 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
|
604 | 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
|
605 | 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
|
606 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
607 | 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
|
608 | dialog->exec(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
609 | 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
|
610 | 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
|
611 | 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
|
612 | } else { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
613 | /* Clear time if misc is not used for boil or fermentation. */ |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
614 | if (! (recipe->miscs.at(recipe->miscs_row).m_use_use == 2 || |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
615 | recipe->miscs.at(recipe->miscs_row).m_use_use == 3 || |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
616 | recipe->miscs.at(recipe->miscs_row).m_use_use == 4)) { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
617 | if (recipe->miscs.at(recipe->miscs_row).m_time) { |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
618 | recipe->miscs[recipe->miscs_row].m_time = 0; |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
619 | is_changed(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
620 | } |
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 | } |
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 | 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
|
625 | 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
|
626 | 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
|
627 | 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
|
628 | 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
|
629 | 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
|
630 | |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
631 | emit refreshAll(); |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
632 | } |
9ede9c75cb54
Added miscs popup editor. No edit functions yet. Delete misc row added.
Michiel Broek <mbroek@mbse.eu>
parents:
131
diff
changeset
|
633 | |
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
|
634 | |
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
|
635 | 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
|
636 | { |
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
|
637 | 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
|
638 | |
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
|
639 | 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
|
640 | 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
|
641 | |
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
|
642 | 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
|
643 | 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
|
644 | 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
|
645 | 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
|
646 | 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
|
647 | 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
|
648 | 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
|
649 | 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
|
650 | |
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
|
651 | for (int i = 0; i < recipe->miscs.size(); i++) { |
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
|
652 | amount = recipe->miscs.at(i).m_amount * 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
|
653 | recipe->miscs[i].m_amount = 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
|
654 | |
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
|
655 | /* |
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
|
656 | * 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
|
657 | */ |
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
|
658 | if (recipe->miscs.at(i).m_type == 4) { |
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 | if (recipe->miscs.at(i).m_name == "CaCl2") { |
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 | ui->bs_cacl2Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
661 | } else if (recipe->miscs.at(i).m_name == "CaSO4") { |
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 | ui->bs_caso4Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
663 | } else if (recipe->miscs.at(i).m_name == "MgSO4") { |
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 | ui->bs_mgso4Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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 | } else if (recipe->miscs.at(i).m_name == "NaCl") { |
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 | ui->bs_naclEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
667 | } else if (recipe->miscs.at(i).m_name == "MgCl2") { |
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
|
668 | ui->bs_mgcl2Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
669 | } else if (recipe->miscs.at(i).m_name == "NaHCO3") { |
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
|
670 | ui->bs_nahco3Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
671 | } else if (recipe->miscs.at(i).m_name == "CaCO3") { |
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
|
672 | ui->bs_caco3Edit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
673 | } else if (recipe->miscs.at(i).m_name == "Melkzuur" || recipe->miscs.at(i).m_name == "Lactic") { |
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
|
674 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
675 | } else if (recipe->miscs.at(i).m_name == "Zoutzuur" || recipe->miscs.at(i).m_name == "Hydrochloric") { |
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 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
677 | } else if (recipe->miscs.at(i).m_name == "Fosforzuur" || recipe->miscs.at(i).m_name == "Phosphoric") { |
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
|
678 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
679 | } else if (recipe->miscs.at(i).m_name == "Zwavelzuur" || recipe->miscs.at(i).m_name == "Sulfuric") { |
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 | ui->mw_acidvolEdit->setValue(recipe->miscs.at(i).m_amount * 1000.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
|
681 | } |
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 | } |
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
|
683 | } |
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
|
684 | } |
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
|
685 | |
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
|
686 |