src/EditRecipeExport.cpp

Mon, 04 Mar 2024 19:51:57 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 04 Mar 2024 19:51:57 +0100
changeset 520
9166c0b82ada
parent 458
ac216a75ca9b
permissions
-rw-r--r--

Code cleanup

157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditRecipe.cpp is part of bmsapp.
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Export recipe.
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
21 void EditRecipe::exportBeerXML()
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" });
384
d68826df8b63 Product and recipe beerxml export support for hop extracts. Recipes with missing hop from the database use a default utilisation value.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
24 const QStringList hop_forms({ "Pellet", "Plug", "Leaf", "Leaf", "Pellet", "Pellet", "Pellet" });
d68826df8b63 Product and recipe beerxml export support for hop extracts. Recipes with missing hop from the database use a default utilisation value.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
25 /* "Leaf Wet", "Cryo", "CO2 extract", "Iso extract" */
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 /* We use more hop forms then beerxml knows about, so we send known names */
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 /* instead of what we internally use. */
304
aa8d421bfc24 Added remarks about beerxml design flaws.
Michiel Broek <mbroek@mbse.eu>
parents: 302
diff changeset
28
aa8d421bfc24 Added remarks about beerxml design flaws.
Michiel Broek <mbroek@mbse.eu>
parents: 302
diff changeset
29 /* Note: Whirlpool hop is Aroma + time. Hop at flame-off is Aroma with time = 0. BeerXML is really stupid designed. */
aa8d421bfc24 Added remarks about beerxml design flaws.
Michiel Broek <mbroek@mbse.eu>
parents: 302
diff changeset
30 /* flame-off vv vv whirlpool hop */
aa8d421bfc24 Added remarks about beerxml design flaws.
Michiel Broek <mbroek@mbse.eu>
parents: 302
diff changeset
31 const QStringList hop_use({ "Mash", "First wort", "Boil", "Aroma", "Aroma", "Dry hop", "Dry hop" });
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 const QStringList yeast_type({ "Lager", "Ale", "Wheat", "Wine", "Champagne", "Other", "Other", "Other", "Other", "Other" });
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 const QStringList yeast_form({ "Liquid", "Dry", "Slant", "Culture", "Frozen", "Bottle", "Dry" });
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::homePath() + "/" + recipe->name + ".xml", tr("Files (*.xml)"));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 if (fileName == 0) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 QMessageBox::warning(this, tr("Save File"), tr("No XML file selected."));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 return;
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
41 qInfo() << "Recipe to beerXML" << fileName;
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 QFile file(fileName);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 file.open(QIODevice::WriteOnly);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 xmlWriter->writeStartDocument();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 xmlWriter->setAutoFormatting(true);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 xmlWriter->setAutoFormattingIndent(1);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 xmlWriter->writeStartElement("RECIPES");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 xmlWriter->writeStartElement("RECIPE");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 /*
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 * Recipe basics
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 */
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 xmlWriter->writeTextElement("NAME", recipe->name);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 if (recipe->notes != "")
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 xmlWriter->writeTextElement("NOTES", recipe->notes);
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
59 xmlWriter->writeTextElement("TYPE", g_recipe_types[recipe->type]);
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 xmlWriter->writeTextElement("BREWER", "Anonymous");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 xmlWriter->writeTextElement("BATCH_SIZE", QString::number(recipe->batch_size, 'f', 4));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 xmlWriter->writeTextElement("BOIL_SIZE", QString::number(recipe->boil_size, 'f', 4));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 xmlWriter->writeTextElement("BOIL_TIME", QString::number(recipe->boil_time, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 xmlWriter->writeTextElement("EFFICIENCY", QString::number(recipe->efficiency, 'f', 4));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 xmlWriter->writeTextElement("EST_OG", QString::number(recipe->est_og, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 xmlWriter->writeTextElement("EST_FG", QString::number(recipe->est_fg, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 if (recipe->est_abv > 0)
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 xmlWriter->writeTextElement("EST_ABV", QString::number(recipe->est_abv, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 if (recipe->est_color > 0) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 xmlWriter->writeTextElement("EST_COLOR", QString::number(Utils::ebc_to_srm(recipe->est_color), 'f', 6));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 xmlWriter->writeTextElement("COLOR_METHOD", color_method[recipe->color_method]);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 if (recipe->est_ibu > 0) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 xmlWriter->writeTextElement("EST_IBU", QString::number(recipe->est_ibu, 'f', 1));
339
2f3cfb983fcc Removed Garetz and Rager IBU calculations, we will only use Tinseth
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
75 xmlWriter->writeTextElement("IBU_METHOD", g_ibu_method[0]); // Only Tinseth
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 xmlWriter->writeStartElement("STYLE");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 xmlWriter->writeTextElement("NAME", recipe->st_name);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 xmlWriter->writeTextElement("CATEGORY", recipe->st_category);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 xmlWriter->writeTextElement("CATEGORY_NUMBER", QString::number(recipe->st_category_number, 'f', 0));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 xmlWriter->writeTextElement("STYLE_LETTER", recipe->st_letter);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 xmlWriter->writeTextElement("STYLE_GUIDE", recipe->st_guide);
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
85 xmlWriter->writeTextElement("TYPE", g_style_types[recipe->st_type]);
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 xmlWriter->writeTextElement("OG_MIN", QString::number(recipe->st_og_min, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 xmlWriter->writeTextElement("OG_MAX", QString::number(recipe->st_og_max, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 xmlWriter->writeTextElement("FG_MIN", QString::number(recipe->st_fg_min, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 xmlWriter->writeTextElement("FG_MAX", QString::number(recipe->st_fg_max, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 xmlWriter->writeTextElement("IBU_MIN", QString::number(recipe->st_ibu_min, 'f', 0));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 xmlWriter->writeTextElement("IBU_MAX", QString::number(recipe->st_ibu_max, 'f', 0));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 xmlWriter->writeTextElement("COLOR_MIN", QString::number(Utils::ebc_to_srm(recipe->st_color_min), 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 xmlWriter->writeTextElement("COLOR_MAX", QString::number(Utils::ebc_to_srm(recipe->st_color_max), 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 xmlWriter->writeTextElement("CARB_MIN", QString::number(recipe->st_carb_min, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 xmlWriter->writeTextElement("CARB_MAX", QString::number(recipe->st_carb_max, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 xmlWriter->writeTextElement("ABV_MIN", QString::number(recipe->st_abv_min, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 xmlWriter->writeTextElement("ABV_MAX", QString::number(recipe->st_abv_max, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 xmlWriter->writeEndElement(); // STYLE
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 xmlWriter->writeStartElement("EQUIPMENT");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 xmlWriter->writeTextElement("NAME", "Dummy Brewery");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 xmlWriter->writeTextElement("BATCH_SIZE", QString::number(recipe->batch_size, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 xmlWriter->writeTextElement("BOIL_SIZE", QString::number(recipe->boil_size, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 xmlWriter->writeTextElement("BOIL_TIME", QString::number(recipe->boil_time, 'f', 0));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 xmlWriter->writeEndElement(); // EQUIPMENT
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 xmlWriter->writeStartElement("HOPS");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 for (int i = 0; i < recipe->hops.size(); i++) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 xmlWriter->writeStartElement("HOP");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 xmlWriter->writeTextElement("VERSION", "1");
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
112 xmlWriter->writeTextElement("NAME", recipe->hops.at(i).name);
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
113 xmlWriter->writeTextElement("ALPHA", QString::number(recipe->hops.at(i).alpha, 'f', 1));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
114 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->hops.at(i).amount, 'f', 4));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
115 xmlWriter->writeTextElement("USE", hop_use[recipe->hops.at(i).useat]);
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
116 xmlWriter->writeTextElement("TIME", QString::number(recipe->hops.at(i).time, 'f', 0));
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
117 xmlWriter->writeTextElement("TYPE", g_hop_types[recipe->hops.at(i).type]);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
118 xmlWriter->writeTextElement("FORM", hop_forms[recipe->hops.at(i).form]);
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
119 xmlWriter->writeTextElement("BETA", QString::number(recipe->hops.at(i).beta, 'f', 1));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
120 xmlWriter->writeTextElement("HSI", QString::number(recipe->hops.at(i).hsi, 'f', 1));
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
121 xmlWriter->writeTextElement("ORIGIN", recipe->hops.at(i).origin);
384
d68826df8b63 Product and recipe beerxml export support for hop extracts. Recipes with missing hop from the database use a default utilisation value.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
122 xmlWriter->writeTextElement("BMS_FORM", g_hop_forms[recipe->hops.at(i).form]);
d68826df8b63 Product and recipe beerxml export support for hop extracts. Recipes with missing hop from the database use a default utilisation value.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
123 xmlWriter->writeTextElement("BMS_UTILISATION", QString::number(recipe->hops.at(i).utilisation, 'f', 4));
d68826df8b63 Product and recipe beerxml export support for hop extracts. Recipes with missing hop from the database use a default utilisation value.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
124 xmlWriter->writeTextElement("BMS_BU_FACTOR", QString::number(recipe->hops.at(i).bu_factor, 'f', 1));
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 xmlWriter->writeEndElement(); // HOPS
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 xmlWriter->writeStartElement("FERMENTABLES");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 for (int i = 0; i < recipe->fermentables.size(); i++) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 xmlWriter->writeStartElement("FERMENTABLE");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 xmlWriter->writeTextElement("VERSION", "1");
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
133 xmlWriter->writeTextElement("NAME", recipe->fermentables.at(i).name);
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
134 xmlWriter->writeTextElement("TYPE", g_fermentable_types[recipe->fermentables.at(i).type]);
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
135 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->fermentables.at(i).amount, 'f', 4));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
136 xmlWriter->writeTextElement("YIELD", QString::number(recipe->fermentables.at(i).yield, 'f', 1));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
137 xmlWriter->writeTextElement("COLOR", QString::number(Utils::ebc_to_srm(recipe->fermentables.at(i).color), 'f', 1));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
138 xmlWriter->writeTextElement("ADD_AFTER_BOIL", recipe->fermentables.at(i).add_after_boil ? "TRUE":"FALSE");
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
139 xmlWriter->writeTextElement("ORIGIN", recipe->fermentables.at(i).origin);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
140 xmlWriter->writeTextElement("SUPPLIER", recipe->fermentables.at(i).supplier);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
141 if (recipe->fermentables.at(i).coarse_fine_diff)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
142 xmlWriter->writeTextElement("COARSE_FINE_DIFF", QString::number(recipe->fermentables.at(i).coarse_fine_diff, 'f', 4));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
143 if (recipe->fermentables.at(i).moisture)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
144 xmlWriter->writeTextElement("MOISTURE", QString::number(recipe->fermentables.at(i).moisture, 'f', 4));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
145 if (recipe->fermentables.at(i).diastatic_power)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
146 xmlWriter->writeTextElement("DIASTATIC_POWER", QString::number(recipe->fermentables.at(i).diastatic_power, 'f', 4));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
147 if (recipe->fermentables.at(i).protein)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
148 xmlWriter->writeTextElement("PROTEIN", QString::number(recipe->fermentables.at(i).protein, 'f', 4));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
149 if (recipe->fermentables.at(i).max_in_batch)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
150 xmlWriter->writeTextElement("MAX_IN_BATCH", QString::number(recipe->fermentables.at(i).max_in_batch, 'f', 1));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
151 xmlWriter->writeTextElement("RECOMMEND_MASH", recipe->fermentables.at(i).recommend_mash ? "TRUE":"FALSE");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
152 xmlWriter->writeTextElement("GRAINTYPE", g_fermentable_graintypes[recipe->fermentables.at(i).graintype]);
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 xmlWriter->writeEndElement(); // FERMENTABLES
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 xmlWriter->writeStartElement("MISCS");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 for (int i = 0; i < recipe->miscs.size(); i++) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 xmlWriter->writeStartElement("MISC");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 xmlWriter->writeTextElement("VERSION", "1");
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
161 xmlWriter->writeTextElement("NAME", recipe->miscs.at(i).name);
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
162 xmlWriter->writeTextElement("TYPE", g_misc_types[recipe->miscs.at(i).type]);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
163 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->miscs.at(i).amount, 'f', 5));
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
164 xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", recipe->miscs.at(i).amount_is_weight ? "TRUE":"FALSE");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
165 xmlWriter->writeTextElement("USE", g_misc_uses[recipe->miscs.at(i).use_use]);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
166 xmlWriter->writeTextElement("TIME", QString::number(recipe->miscs.at(i).time, 'f', 0));
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 xmlWriter->writeEndElement(); // MISCS
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 xmlWriter->writeStartElement("YEASTS");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 for (int i = 0; i < recipe->yeasts.size(); i++) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 xmlWriter->writeStartElement("YEAST");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 xmlWriter->writeTextElement("VERSION", "1");
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
175 xmlWriter->writeTextElement("NAME", recipe->yeasts.at(i).name);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
176 xmlWriter->writeTextElement("TYPE", yeast_type[recipe->yeasts.at(i).type]);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
177 xmlWriter->writeTextElement("FORM", yeast_form[recipe->yeasts.at(i).form]);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
178 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->yeasts.at(i).amount, 'f', 5));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
179 xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (recipe->yeasts.at(i).form == 1) ? "TRUE":"FALSE");
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
180 xmlWriter->writeTextElement("LABORATORY", recipe->yeasts.at(i).laboratory);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
181 xmlWriter->writeTextElement("PRODUCT_ID", recipe->yeasts.at(i).product_id);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
182 xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(recipe->yeasts.at(i).min_temperature, 'f', 1));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
183 xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(recipe->yeasts.at(i).max_temperature, 'f', 1));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
184 xmlWriter->writeTextElement("ATTENUATION", QString::number(recipe->yeasts.at(i).attenuation, 'f', 1));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
185 xmlWriter->writeTextElement("ADD_TO_SECONDARY", (recipe->yeasts.at(i).use == 0) ? "FALSE":"TRUE");
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 xmlWriter->writeEndElement(); // YEASTS
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 xmlWriter->writeStartElement("WATERS");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 if (recipe->w1_amount > 0) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 xmlWriter->writeStartElement("WATER");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 xmlWriter->writeTextElement("NAME", recipe->w1_name);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->w1_amount, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 xmlWriter->writeTextElement("CALCIUM", QString::number(recipe->w1_calcium, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 xmlWriter->writeTextElement("MAGNESIUM", QString::number(recipe->w1_magnesium, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 xmlWriter->writeTextElement("BICARBONATE", QString::number(recipe->w1_total_alkalinity * 1.22, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 xmlWriter->writeTextElement("SULFATE", QString::number(recipe->w1_sulfate, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 xmlWriter->writeTextElement("CHLORIDE", QString::number(recipe->w1_chloride, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 xmlWriter->writeTextElement("SODIUM", QString::number(recipe->w1_sodium, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 xmlWriter->writeTextElement("PH", QString::number(recipe->w1_ph, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 xmlWriter->writeTextElement("TOTAL_ALKALINITY", QString::number(recipe->w1_total_alkalinity, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 if (recipe->w2_amount > 0) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 xmlWriter->writeStartElement("WATER");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 xmlWriter->writeTextElement("NAME", recipe->w2_name);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->w2_amount, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 xmlWriter->writeTextElement("CALCIUM", QString::number(recipe->w2_calcium, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 xmlWriter->writeTextElement("MAGNESIUM", QString::number(recipe->w2_magnesium, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 xmlWriter->writeTextElement("BICARBONATE", QString::number(recipe->w2_total_alkalinity * 1.22, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 xmlWriter->writeTextElement("SULFATE", QString::number(recipe->w2_sulfate, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 xmlWriter->writeTextElement("CHLORIDE", QString::number(recipe->w2_chloride, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 xmlWriter->writeTextElement("SODIUM", QString::number(recipe->w2_sodium, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 xmlWriter->writeTextElement("PH", QString::number(recipe->w2_ph, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 xmlWriter->writeTextElement("TOTAL_ALKALINITY", QString::number(recipe->w2_total_alkalinity, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 xmlWriter->writeEndElement(); // WATERS
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 xmlWriter->writeStartElement("MASH");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 xmlWriter->writeTextElement("NAME", recipe->mash_name);
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 xmlWriter->writeTextElement("GRAIN_TEMP", "10.0");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 xmlWriter->writeTextElement("PH", QString::number(recipe->sparge_ph, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 xmlWriter->writeTextElement("SPARGE_TEMP", QString::number(recipe->sparge_temp, 'f', 2));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 xmlWriter->writeStartElement("MASH_STEPS");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 for (int i = 0; i < recipe->mashs.size(); i++) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 xmlWriter->writeStartElement("MASH_STEP");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 xmlWriter->writeTextElement("VERSION", "1");
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 xmlWriter->writeTextElement("NAME", recipe->mashs.at(i).step_name);
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
234 xmlWriter->writeTextElement("TYPE", g_step_types[recipe->mashs.at(i).step_type]);
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 if (recipe->mashs.at(i).step_type == 0) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 xmlWriter->writeTextElement("INFUSE_AMOUNT", QString::number(recipe->mashs.at(i).step_infuse_amount, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 xmlWriter->writeTextElement("INFUSE_TEMP", QString::number(recipe->mashs.at(i).step_infuse_temp, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 if (recipe->mashs.at(i).step_type == 2) {
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 xmlWriter->writeTextElement("DECOCTION_AMT", QString::number(recipe->mashs.at(i).step_infuse_amount, 'f', 3));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 xmlWriter->writeTextElement("STEP_TEMP", QString::number(recipe->mashs.at(i).step_temp, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 xmlWriter->writeTextElement("STEP_TIME", QString::number(recipe->mashs.at(i).step_time, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 xmlWriter->writeTextElement("RAMP_TIME", QString::number(recipe->mashs.at(i).ramp_time, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 xmlWriter->writeTextElement("END_TEMP", QString::number(recipe->mashs.at(i).end_temp, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 xmlWriter->writeTextElement("PH", QString::number(recipe->mash_ph, 'f', 1));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 xmlWriter->writeEndElement();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 xmlWriter->writeEndElement(); // MASH_STEPS
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 xmlWriter->writeEndElement(); // MASH
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 xmlWriter->writeEndElement(); // RECIPE
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 xmlWriter->writeEndElement(); // RECIPES
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 xmlWriter->writeEndDocument();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 QMessageBox::information(this, tr("Save File"), tr("XML export ready"));
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 file.close();
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
260 void EditRecipe::copyRecipe()
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
261 {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
262 Recipe *dup = new Recipe;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
263
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
264 dup = recipe;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
265 dup->record = -1;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
266 dup->uuid = "";
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
267 dup->name.append(" [duplicate]");
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
268 qDebug() << dup->record << dup->name;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
269 if (DB_recipe::save(dup, this)) {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
270 QMessageBox::information(this, tr("Copy Recipe"), tr("Copy Recipe export ready."));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
271 } else {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
272 QMessageBox::warning(this, tr("Copy Recipe"), tr("Copy Recipe error."));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
273 }
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
274 delete dup;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
275 }
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
276
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
277
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
278 void EditRecipe::copyProduct()
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
279 {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
280 Product *p = new Product();
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
281
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
282 p->record = -1;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
283 p->name = recipe->name + QString(" [duplicate]");
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
284 p->code = "";
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
285 p->birth = QDate::currentDate();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
286 p->stage = p->inventory_reduced = PROD_STAGE_PLAN;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
287 p->notes = recipe->notes;
445
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
288 p->log_brew = p->log_fermentation = p->log_ispindel = p->log_co2pressure = p->locked = false;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
289
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
290 p->st_name = recipe->st_name;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
291 p->st_letter = recipe->st_letter;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
292 p->st_guide = recipe->st_guide;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
293 p->st_category = recipe->st_category;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
294 p->st_category_number = recipe->st_category_number;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
295 p->st_type = recipe->st_type;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
296 p->st_og_min = recipe->st_og_min;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
297 p->st_og_max = recipe->st_og_max;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
298 p->st_fg_min = recipe->st_fg_min;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
299 p->st_fg_max = recipe->st_fg_max;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
300 p->st_ibu_min = recipe->st_ibu_min;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
301 p->st_ibu_max = recipe->st_ibu_max;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
302 p->st_color_min = recipe->st_color_min;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
303 p->st_color_max = recipe->st_color_max;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
304 p->st_carb_min = recipe->st_carb_min;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
305 p->st_carb_max = recipe->st_carb_max;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
306 p->st_abv_min = recipe->st_abv_min;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
307 p->st_abv_max = recipe->st_abv_max;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
308
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
309 p->eq_name = QString("Not yet set");
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
310 p->eq_notes = QString("");
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
311 p->eq_tun_specific_heat = 0.11;
445
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
312 p->eq_tun_material = 0;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
313 p->eq_tun_volume = p->eq_tun_height = 20;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
314 p->eq_tun_weight = 2;
445
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
315 p->eq_top_up_water = 0;
458
ac216a75ca9b Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents: 445
diff changeset
316 p->eq_trub_loss = 0.5;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
317 p->eq_evap_rate = 1.8;
445
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
318 p->eq_top_up_kettle = 0;
423
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
319 p->eq_kettle_volume = p->eq_kettle_height = p->eq_mash_volume = 20;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
320 p->eq_lauter_deadspace = 0.5;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
321 p->eq_mash_max = 6;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
322 p->eq_efficiency = p->efficiency = recipe->efficiency;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
323 p->eq_batch_size = p->batch_size = recipe->batch_size;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
324 p->eq_boil_time = p->boil_time = recipe->boil_time;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
325 p->eq_boil_size = p->boil_size = p->batch_size + (round(p->batch_size * p->boil_time / 60.0) / 10.0);
423
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
326 p->eq_chiller_type = CHILLER_TYPE_IMMERSION;
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
327 p->eq_chiller_volume = 0.5;
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
328 p->eq_chiller_to79 = 5;
8cb46020796a Adjusted chiller_loss default value to 0.4. Disabled product fields eq_calc_boil_volume, eq_hop_utilization, eq_lauter_volume and eq_lauter_height. Added eq_chiller_type, eq_chiller_to79, eq_chiller_volume, eq_chiller_lpm, eq_chiller_loss with default values for immersion chilling. Load these values from new selected equipment. Changed edit product tab 2 to show new the new fields and removed the obsolete fields.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
329 p->eq_chiller_lpm = p->eq_chiller_loss = 0;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
330 p->type = 2;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
331 p->color_method = recipe->color_method;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
332 p->ibu_method = recipe->ibu_method;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
333 p->est_og = recipe->est_og;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
334 p->est_fg = recipe->est_fg;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
335 p->est_color = recipe->est_color;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
336 p->est_ibu = recipe->est_ibu;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
337 p->est_abv = recipe->est_abv;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
338
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
339 p->brew_date_start = p->brew_date_end = QDateTime();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
340 p->brew_cooling_to = 20;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
341
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
342 p->primary_end_date = p->secondary_end_date = QDate();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
343 p->package_date = QDate();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
344 p->package_infuse_notes = "";
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
345 p->taste_date = QDate();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
346 p->taste_notes = p->taste_color = p->taste_transparency = p->taste_head = "";
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
347 p->taste_aroma = p->taste_taste = p->taste_mouthfeel = p->taste_aftertaste = "";
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
348
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
349 p->sparge_temp = recipe->sparge_temp;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
350 p->sparge_ph = recipe->sparge_ph;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
351 p->sparge_volume = recipe->sparge_volume;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
352 p->sparge_source = recipe->sparge_source;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
353 p->sparge_acid_type = recipe->sparge_acid_type;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
354 p->sparge_acid_perc = recipe->sparge_acid_perc;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
355 p->sparge_acid_amount = recipe->sparge_acid_amount;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
356 p->mash_ph = recipe->mash_ph;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
357 p->mash_name = recipe->mash_name;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
358
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
359 p->calc_acid = recipe->calc_acid;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
360 p->w1_name = recipe->w1_name;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
361 p->w1_amount = recipe->w1_amount;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
362 p->w1_calcium = recipe->w1_calcium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
363 p->w1_sulfate = recipe->w1_sulfate;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
364 p->w1_chloride = recipe->w1_chloride;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
365 p->w1_sodium = recipe->w1_sodium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
366 p->w1_magnesium = recipe->w1_magnesium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
367 p->w1_total_alkalinity = recipe->w1_total_alkalinity;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
368 p->w1_ph = recipe->w1_ph;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
369 p->w2_name = recipe->w2_name;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
370 p->w2_amount = recipe->w2_amount;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
371 p->w2_calcium = recipe->w2_calcium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
372 p->w2_sulfate = recipe->w2_sulfate;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
373 p->w2_chloride = recipe->w2_chloride;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
374 p->w2_sodium = recipe->w2_sodium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
375 p->w2_magnesium = recipe->w2_magnesium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
376 p->w2_total_alkalinity = recipe->w2_total_alkalinity;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
377 p->w2_ph = recipe->w2_ph;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
378 p->wg_amount = recipe->wg_amount;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
379 p->wg_calcium = recipe->wg_calcium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
380 p->wg_sulfate = recipe->wg_sulfate;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
381 p->wg_chloride = recipe->wg_chloride;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
382 p->wg_sodium = recipe->wg_sodium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
383 p->wg_magnesium = recipe->wg_magnesium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
384 p->wg_total_alkalinity = recipe->wg_total_alkalinity;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
385 p->wg_ph = recipe->wg_ph;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
386 p->wb_calcium = recipe->wb_calcium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
387 p->wb_sulfate = recipe->wb_sulfate;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
388 p->wb_chloride = recipe->wb_chloride;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
389 p->wb_sodium = recipe->wb_sodium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
390 p->wb_magnesium = recipe->wb_magnesium;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
391 p->wb_total_alkalinity = recipe->wb_total_alkalinity;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
392 p->wb_ph = recipe->wb_ph;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
393 p->wa_acid_name = recipe->wa_acid_name;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
394 p->wa_acid_perc = recipe->wa_acid_perc;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
395 p->wa_base_name = recipe->wa_base_name;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
396
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
397 p->starter_enable = false;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
398 p->starter_viability = 100;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
399 p->starter_sg = 1.037;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
400 p->yeast_prod_date = QDate();
260
42b88d85fefc Fix default divide_size field in products. Update miscs table column 6 and 7 tooltips and display of the buttons after sort. After a new misc product is selected, update the current row index because the row may be moved. Fix some display misc values in the checklist, they were not multiplied by 1000. Fix display of some bars if the value was 24.
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
401 p->divide_factor = 1;
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
402
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
403 p->fermentables = recipe->fermentables;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
404 p->hops = recipe->hops;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
405 p->miscs = recipe->miscs;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
406 p->yeasts = recipe->yeasts;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
407 p->mashs = recipe->mashs;
445
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
408 /*
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
409 * Reset measurement fields.
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
410 */
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
411 for (int i = 0; i < p->mashs.size(); i++) {
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
412 p->mashs[i].step_ph = 0;
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
413 p->mashs[i].step_sg = 0;
3dbebcd56406 Reset mash measurement fields when a recipe is copied to a product.
Michiel Broek <mbroek@mbse.eu>
parents: 423
diff changeset
414 }
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
415
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
416 if (DB_product::save(p, this)) {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
417 QMessageBox::information(this, tr("Copy Recipe"), tr("Copy Recipe to Product ready."));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
418 } else {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
419 QMessageBox::warning(this, tr("Copy Recipe"), tr("Copy Recipe to Product error."));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
420 }
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
421 delete p;
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
422 }
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
423
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
424
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
425 void EditRecipe::toforumRecipe()
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
426 {
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
427 const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" });
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
428
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
429 QString memo = QString("[u][b]BMSapp v");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
430 memo.append(VERSIONSTRING); // For some stupid reason this must be on it's own.
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
431 memo.append(" - Datum export: " + QDate::currentDate().toString("dd-MMM-yyyy") + "[/b][/u]\n\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
432 memo.append("[u][b]Basis[/b][/u]\n[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
433 memo.append("[head]Omschrijving[/head][head]Waarde[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
434 memo.append("[row][data]Bier naam[/data][data]" + recipe->name + "[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
435 memo.append("[row][data]Bier stijl[/data][data]" + recipe->st_name + "[/data][/row]\n");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
436 memo.append("[row][data]Recept type[/data][data]" + QCoreApplication::translate("RecipeType", g_recipe_types[recipe->type]) + "[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
437 memo.append("[row][data]Batch grootte[/data][data]" + QString::number(recipe->batch_size, 'f', 1) + " L[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
438 memo.append("[row][data]Kooktijd[/data][data]" + QString::number(recipe->boil_time, 'f', 0) + " minuten[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
439 memo.append("[row][data]Brouwzaal rendement[/data][data]" + QString::number(recipe->efficiency, 'f', 1) + "%[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
440 memo.append("[row][data]Geschatte begin densiteit[/data][data]" + QString::number(recipe->est_og, 'f', 3) + " SG[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
441 memo.append("[row][data]Geschatte eind densiteit[/data][data]" + QString::number(recipe->est_fg, 'f', 3) + " SG[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
442 memo.append("[row][data]Geschat alcohol[/data][data]" + QString::number(recipe->est_abv, 'f', 1) + "%[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
443 memo.append("[row][data]Kleur (" + color_method[recipe->color_method] + ")[/data][data]" + QString::number(recipe->est_color, 'f', 0) + " EBC[/data][/row]\n");
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
444 memo.append("[row][data]Bitterheid (" + QString(g_ibu_method[recipe->ibu_method]) + ")[/data][data]" + QString::number(recipe->est_ibu, 'f', 1) + " IBU[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
445 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
446
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
447 memo.append("[u][b]Vergistbare ingrediënten[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
448 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
449 memo.append("[head]Mout, granen en suikers[/head][head]EBC[/head][head]Gewicht kg[/head][head]%[/head][head]Gebruik tijdens[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
450 for (int i = 0; i < recipe->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
451 memo.append("[row][data]" + recipe->fermentables.at(i).name + " (" + recipe->fermentables.at(i).supplier + ")[/data]");
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
452 memo.append("[data]" + QString::number(recipe->fermentables.at(i).color) + "[/data]");
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
453 memo.append("[data]" + QString::number(recipe->fermentables.at(i).amount, 'f', 3) + "[/data]");
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
454 memo.append("[data]" + QString::number(recipe->fermentables.at(i).percentage, 'f', 1) + "[/data]");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
455 memo.append("[data]" + QCoreApplication::translate("FermentableAdded", g_fermentable_added[recipe->fermentables.at(i).added]) + "[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
456 }
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
457 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
458
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
459 memo.append("[u][b]Hop[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
460 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
461 memo.append("[head]Hop[/head][head]Vorm[/head][head]Alpha[/head][head]IBU[/head][head]Gram[/head][head]Toevoegen moment[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
462 for (int i = 0; i < recipe->hops.size(); i++) {
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
463 double ibu = Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->est_og, recipe->batch_size,
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
464 recipe->hops.at(i).amount, recipe->hops.at(i).time, recipe->hops.at(i).alpha, recipe->ibu_method,
373
b02aca4e926c First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
465 0, recipe->hops.at(i).time, 0, recipe->boil_time, 0, 0, 0, recipe->hops.at(i).utilisation, recipe->hops.at(i).bu_factor);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
466 memo.append("[row][data]" + recipe->hops.at(i).name + " (" + recipe->hops.at(i).origin + ")[/data]");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
467 memo.append("[data]" + QCoreApplication::translate("HopForm", g_hop_forms[recipe->hops.at(i).form]) + "[/data]");
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
468 memo.append("[data]" + QString::number(recipe->hops.at(i).alpha, 'f', 1) + "[/data]");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
469 memo.append("[data]" + QString::number(ibu, 'f', 1) + "[/data]");
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
470 memo.append("[data]" + QString::number(recipe->hops.at(i).amount * 1000, 'f', 2) + "[/data]");
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
471 if (recipe->hops.at(i).useat == HOP_USEAT_BOIL || recipe->hops.at(i).useat == HOP_USEAT_WHIRLPOOL)
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
472 memo.append("[data]" + QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + " " + QString::number(recipe->hops.at(i).time) + " minuten[/data][/row]\n");
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
473 else if (recipe->hops.at(i).useat == HOP_USEAT_DRY_HOP)
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
474 memo.append("[data]" + QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + " " + QString::number(recipe->hops.at(i).time / 1440) + " dagen[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
475 else
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
476 memo.append("[data]" + QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + "[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
477 }
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
478 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
479
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
480 memo.append("[u][b]Diversen[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
481 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
482 memo.append("[head]Specerij, kruid, brouwzout[/head][head]Type grondstof[/head][head]Gebruik tijdens[/head][head]Hoeveel[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
483 for (int i = 0; i < recipe->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
484 memo.append("[row][data]" + recipe->miscs.at(i).name + "[/data]");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
485 memo.append("[data]" + QCoreApplication::translate("MiscType", g_misc_types[recipe->miscs.at(i).type]) + "[/data]");
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
486 if (recipe->miscs.at(i).use_use == MISC_USES_BOIL)
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
487 memo.append("[data]" + QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]) + " " + QString::number(recipe->miscs.at(i).time) + " min[/data]");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
488 else
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
489 memo.append("[data]" + QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]) + "[/data]");
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
490 memo.append("[data]"+QString::number(recipe->miscs.at(i).amount * 1000, 'f', 2)+((recipe->miscs.at(i).amount_is_weight)?" gr":" ml")+"[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
491 }
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
492 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
493
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
494 memo.append("[u][b]Gist[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
495 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
496 memo.append("[head]Gistlab en code[/head][head]Omschrijving[/head][head]Gebruik[/head][head]Vorm[/head][head]Hoeveel[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
497 for (int i = 0; i < recipe->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
498 memo.append("[row][data]" + recipe->yeasts.at(i).laboratory + " " + recipe->yeasts.at(i).product_id + "[/data]");
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
499 memo.append("[data]" + recipe->yeasts.at(i).name + "[/data]");
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
500 memo.append("[data]" + QCoreApplication::translate("YeastUse", g_yeast_use[recipe->yeasts.at(i).use]) + "[/data]");
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
501 memo.append("[data]" + QCoreApplication::translate("YeastForm", g_yeast_forms[recipe->yeasts.at(i).form]) + "[/data]");
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
502 if (recipe->yeasts.at(i).form == YEAST_FORMS_LIQUID)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
503 memo.append("[data]" + QString::number(recipe->yeasts.at(i).amount, 'f', 0) + " pak[/data][/row]\n");
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
504 else if (recipe->yeasts.at(i).form == YEAST_FORMS_DRY || recipe->yeasts.at(i).form == YEAST_FORMS_DRIED)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
505 memo.append("[data]" + QString::number(recipe->yeasts.at(i).amount * 1000, 'f', 1) + " gr[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
506 else
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
507 memo.append("[data]" + QString::number(recipe->yeasts.at(i).amount * 1000, 'f', 0) + " ml[/data][/row]\n");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
508 }
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
509 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
510
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
511 memo.append("[u][b]Maischen[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
512 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
513 memo.append("[head]Maisch stap[/head][head]Stap type[/head][head]Temperatuur[/head][head]Rust tijd[/head][head]Opwarm tijd[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
514 for (int i = 0; i < recipe->mashs.size(); i++) {
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
515 memo.append("[row][data]" + recipe->mashs.at(i).step_name + "[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
516 if (recipe->mashs.at(i).step_type != 1)
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
517 memo.append("[data]" + QCoreApplication::translate("StepType", g_step_types[recipe->mashs.at(i).step_type])+" "+QString::number(recipe->mashs.at(i).step_infuse_amount, 'f', 1) + " L[/data]");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
518 else
302
2e8462219332 Export recipe or product to beerxml use the global untranslated arrays. Export recipe or product to forum use the global translated arrays.
Michiel Broek <mbroek@mbse.eu>
parents: 300
diff changeset
519 memo.append("[data]" + QCoreApplication::translate("StepType", g_step_types[recipe->mashs.at(i).step_type]) + "[/data]");
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
520 memo.append("[data]" + QString::number(recipe->mashs.at(i).step_temp, 'f', 1) + " °C[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
521 memo.append("[data]" + QString::number(recipe->mashs.at(i).step_time, 'f', 0) + " min[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
522 memo.append("[data]" + QString::number(recipe->mashs.at(i).ramp_time, 'f', 0) + " min[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
523 }
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
524 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
525
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
526 memo.append("[u][b]Brouwwater[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
527 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
528 memo.append("[head]Omschrijving[/head][head]Waarde[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
529 if (recipe->w2_name != "" && recipe->w2_amount > 0) {
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
530 memo.append("[row][data]Maischwater 1[/data][data]" + recipe->w1_name + " " + QString::number(recipe->w1_amount, 'f', 1) + " Liter[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
531 memo.append("[row][data]Maischwater 2[/data][data]" + recipe->w2_name + " " + QString::number(recipe->w2_amount, 'f', 1) + " Liter[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
532 } else {
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
533 memo.append("[row][data]Maischwater[/data][data]" + recipe->w1_name + " " + QString::number(recipe->w1_amount, 'f', 1) + " Liter[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
534 }
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
535 memo.append("[row][data]Maischwater aanzuren tot[/data][data]" + QString::number(recipe->mash_ph, 'f', 1) + " pH[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
536 memo.append("[row][data]Spoelwater geschat[/data][data]" + QString::number(recipe->sparge_volume, 'f', 1) + " Liter[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
537 memo.append("[row][data]Spoelwater temperatuur[/data][data]" + QString::number(recipe->sparge_temp, 'f', 1) + " °C[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
538 memo.append("[row][data]Spoelwater aanzuren tot[/data][data]" + QString::number(recipe->sparge_ph, 'f', 1) + " pH[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
539 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
540
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
541 memo.append("[u][b]Waterprofiel behandeld water[/b][/u]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
542 memo.append("[tabular]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
543 memo.append("[head]Ca[/head][head]Mg[/head][head]Na[/head][head]HCO3[/head][head]Cl[/head][head]SO4[/head]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
544 memo.append("[row][data]" + QString::number(recipe->wb_calcium, 'f', 1) + "[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
545 memo.append("[data]" + QString::number(recipe->wb_magnesium, 'f', 1) + "[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
546 memo.append("[data]" + QString::number(recipe->wb_sodium, 'f', 1) + "[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
547 memo.append("[data]" + QString::number(recipe->wb_total_alkalinity * 61 / 50, 'f', 1) + "[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
548 memo.append("[data]" + QString::number(recipe->wb_chloride, 'f', 1) + "[/data]");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
549 memo.append("[data]" + QString::number(recipe->wb_sulfate, 'f', 1) + "[/data][/row]\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
550 memo.append("[/tabular]\n\n");
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
551
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
552 qDebug().noquote() << memo;
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
553 QGuiApplication::clipboard()->setText(memo, QClipboard::Clipboard);
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
554 QGuiApplication::clipboard()->setText(memo, QClipboard::Selection);
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
555
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
556 QMessageBox::information(this, tr("Export to forum"), tr("The recipe and all data are copied to the clipboard.\n"
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
557 "You can \"paste\" this data in the forum screen in your web browser."));
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
558 }
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
559
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
560 void EditRecipe::on_exportButton_clicked()
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
561 {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
562 QDialog* dialog = new QDialog(this);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
563 dialog->setWindowTitle(tr("Export choices"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
564 dialog->setObjectName(QString::fromUtf8("Dialog"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
565 dialog->resize(400, 149);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
566 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
567 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
568 buttonBox->setGeometry(QRect(280, 20, 81, 61));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
569 buttonBox->setOrientation(Qt::Vertical);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
570 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
571
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
572 QRadioButton *beerxmlButton = new QRadioButton(dialog);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
573 beerxmlButton->setObjectName(QString::fromUtf8("beerxmlButton"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
574 beerxmlButton->setGeometry(QRect(50, 20, 171, 21));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
575 beerxmlButton->setText(tr("Export to beerXML"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
576
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
577 QRadioButton *copy_recipeButton = new QRadioButton(dialog);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
578 copy_recipeButton->setObjectName(QString::fromUtf8("copy_recipeButton"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
579 copy_recipeButton->setGeometry(QRect(50, 50, 171, 21));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
580 copy_recipeButton->setText(tr("Copy to recipe"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
581
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
582 QRadioButton *copy_productButton = new QRadioButton(dialog);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
583 copy_productButton->setObjectName(QString::fromUtf8("copy_productButton"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
584 copy_productButton->setGeometry(QRect(50, 80, 171, 21));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
585 copy_productButton->setText(tr("Copy to product"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
586
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
587 QRadioButton *toforumButton = new QRadioButton(dialog);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
588 toforumButton->setObjectName(QString::fromUtf8("toforumButton"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
589 toforumButton->setGeometry(QRect(50, 110, 171, 21));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
590 toforumButton->setText(tr("Export to forum"));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
591
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
592 QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
593 QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
594
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
595 dialog->setModal(true);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
596 dialog->exec();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
597 if (dialog->result() == QDialog::Accepted) {
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
598 if (beerxmlButton->isChecked())
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
599 exportBeerXML();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
600 if (copy_recipeButton->isChecked())
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
601 copyRecipe();
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
602 if (copy_productButton->isChecked())
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
603 copyProduct();
257
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
604 if (toforumButton->isChecked())
cfba041bdaee Changed some logging levels. Fixed copy recipe to product sparge water setteings. Added export to forum via clipboard. The recipe export is completed.
Michiel Broek <mbroek@mbse.eu>
parents: 253
diff changeset
605 toforumRecipe();
253
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
606 }
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
607
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
608 disconnect(buttonBox, nullptr, nullptr, nullptr);
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
609 }
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
610
d130385c1b0d Copy recipe to duplicated recipe added. Copy recipe to product added. Added popup with export choices.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
611
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
612 void EditRecipe::on_printButton_clicked()
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 {
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 157
diff changeset
614 PrinterDialog(PR_RECIPE, -1, this);
157
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
615 }
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616
771b0b00092a Added beerxml export
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617

mercurial