src/EditProductExport.cpp

Tue, 07 Jun 2022 11:05:23 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 07 Jun 2022 11:05:23 +0200
changeset 265
df17db1484f6
parent 263
14d79ec33db4
child 266
5f0782149028
permissions
-rw-r--r--

Added export product to recipe.

175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditProduct.cpp is part of bmsapp.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Export product.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
21 void EditProduct::exportBeerXML()
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 qDebug() << "export";
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 const QStringList styletype({ "Lager", "Ale", "Mead", "Wheat", "Mixed", "Cider" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 const QStringList producttypes({ "Extract", "Partial Mash", "All Grain" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 const QStringList ibu_method({ "Tinseth", "Rager", "Daniels", "Garetz", "Mosher", "Noonan" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 const QStringList hop_types({ "Bittering", "Aroma", "Both" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 const QStringList hop_forms({ "Pellet", "Plug", "Leaf", "Leaf", "Pellet" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 /* "Leaf Wet", "Cryo" */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 /* We use more hop forms then beerxml knows about, so we send known names */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 /* instead of what we internally use. */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 const QStringList hop_use({ "Mash", "First wort", "Boil", "Aroma", "Whirlpool", "Dry hop" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 const QStringList fermentable_type({ "Grain", "Sugar", "Extract", "Dry extract", "Adjunct" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 const QStringList fermentable_graintype({ "Base", "Roast", "Crystal", "Kilned", "Sour malt", "Special", "No malt" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 const QStringList yeast_type({ "Lager", "Ale", "Wheat", "Wine", "Champagne", "Other", "Other", "Other", "Other", "Other" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 const QStringList yeast_form({ "Liquid", "Dry", "Slant", "Culture", "Frozen", "Bottle", "Dry" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 const QStringList yeast_use({ "Primary", "Secondary", "Tertiary", "Bottle" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 const QStringList misc_type({ "Spice", "Herb", "Flavor", "Fining", "Water agent", "Yeast nutrient", "Other" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 const QStringList misc_use({ "Starter", "Mash", "Boil", "Primary", "Secondary", "Bottling" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 const QStringList step_type({ "Infusion", "Temperature", "Decoction" });
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
246
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
44 QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
45 QDir::homePath() + "/" + product->code + " " + product->name + ".xml", tr("Files (*.xml)"));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 if (fileName == 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 QMessageBox::warning(this, tr("Save File"), tr("No XML file selected."));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 return;
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 QFile file(fileName);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 file.open(QIODevice::WriteOnly);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 xmlWriter->writeStartDocument();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 xmlWriter->setAutoFormatting(true);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 xmlWriter->setAutoFormattingIndent(1);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 xmlWriter->writeStartElement("RECIPES");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 xmlWriter->writeStartElement("RECIPE");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 /*
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 * Product basics
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 */
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 xmlWriter->writeTextElement("NAME", product->name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 if (product->notes != "")
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 xmlWriter->writeTextElement("NOTES", product->notes);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 xmlWriter->writeTextElement("TYPE", producttypes[product->type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 xmlWriter->writeTextElement("BREWER", "Anonymous");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 xmlWriter->writeTextElement("BATCH_SIZE", QString::number(product->batch_size, 'f', 4));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 xmlWriter->writeTextElement("BOIL_SIZE", QString::number(product->boil_size, 'f', 4));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 xmlWriter->writeTextElement("BOIL_TIME", QString::number(product->boil_time, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 xmlWriter->writeTextElement("EFFICIENCY", QString::number(product->efficiency, 'f', 4));
246
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
74 if (product->og > 0.9)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
75 xmlWriter->writeTextElement("OG", QString::number(product->og, 'f', 3));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
76 if (product->fg > 0.9)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
77 xmlWriter->writeTextElement("FG", QString::number(product->fg, 'f', 3));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 xmlWriter->writeTextElement("EST_OG", QString::number(product->est_og, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 xmlWriter->writeTextElement("EST_FG", QString::number(product->est_fg, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 if (product->est_abv > 0)
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 xmlWriter->writeTextElement("EST_ABV", QString::number(product->est_abv, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 if (product->est_color > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 xmlWriter->writeTextElement("EST_COLOR", QString::number(Utils::ebc_to_srm(product->est_color), 'f', 6));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 xmlWriter->writeTextElement("COLOR_METHOD", color_method[product->color_method]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 if (product->est_ibu > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 xmlWriter->writeTextElement("EST_IBU", QString::number(product->est_ibu, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 xmlWriter->writeTextElement("IBU_METHOD", ibu_method[product->ibu_method]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 }
246
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
90 xmlWriter->writeTextElement("BMS_COOLING_TO", QString::number(product->brew_cooling_to, 'f', 1));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 xmlWriter->writeStartElement("STYLE");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 xmlWriter->writeTextElement("NAME", product->st_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 xmlWriter->writeTextElement("CATEGORY", product->st_category);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 xmlWriter->writeTextElement("CATEGORY_NUMBER", QString::number(product->st_category_number, 'f', 0));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 xmlWriter->writeTextElement("STYLE_LETTER", product->st_letter);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 xmlWriter->writeTextElement("STYLE_GUIDE", product->st_guide);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 xmlWriter->writeTextElement("TYPE", styletype[product->st_type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 xmlWriter->writeTextElement("OG_MIN", QString::number(product->st_og_min, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 xmlWriter->writeTextElement("OG_MAX", QString::number(product->st_og_max, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 xmlWriter->writeTextElement("FG_MIN", QString::number(product->st_fg_min, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 xmlWriter->writeTextElement("FG_MAX", QString::number(product->st_fg_max, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 xmlWriter->writeTextElement("IBU_MIN", QString::number(product->st_ibu_min, 'f', 0));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 xmlWriter->writeTextElement("IBU_MAX", QString::number(product->st_ibu_max, 'f', 0));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 xmlWriter->writeTextElement("COLOR_MIN", QString::number(Utils::ebc_to_srm(product->st_color_min), 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 xmlWriter->writeTextElement("COLOR_MAX", QString::number(Utils::ebc_to_srm(product->st_color_max), 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 xmlWriter->writeTextElement("CARB_MIN", QString::number(product->st_carb_min, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 xmlWriter->writeTextElement("CARB_MAX", QString::number(product->st_carb_max, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 xmlWriter->writeTextElement("ABV_MIN", QString::number(product->st_abv_min, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 xmlWriter->writeTextElement("ABV_MAX", QString::number(product->st_abv_max, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 xmlWriter->writeEndElement(); // STYLE
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 xmlWriter->writeStartElement("EQUIPMENT");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 xmlWriter->writeTextElement("VERSION", "1");
246
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
116 xmlWriter->writeTextElement("NAME", product->eq_name);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
117 xmlWriter->writeTextElement("NOTES", product->eq_notes);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
118 xmlWriter->writeTextElement("BATCH_SIZE", QString::number(product->eq_batch_size, 'f', 2));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
119 xmlWriter->writeTextElement("BOIL_SIZE", QString::number(product->eq_boil_size, 'f', 2));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
120 xmlWriter->writeTextElement("BOIL_TIME", QString::number(product->eq_boil_time, 'f', 0));
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 xmlWriter->writeEndElement(); // EQUIPMENT
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 xmlWriter->writeStartElement("HOPS");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 for (int i = 0; i < product->hops.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 xmlWriter->writeStartElement("HOP");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 xmlWriter->writeTextElement("NAME", product->hops.at(i).h_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 xmlWriter->writeTextElement("ALPHA", QString::number(product->hops.at(i).h_alpha, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 xmlWriter->writeTextElement("AMOUNT", QString::number(product->hops.at(i).h_amount, 'f', 4));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 xmlWriter->writeTextElement("USE", hop_use[product->hops.at(i).h_useat]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 xmlWriter->writeTextElement("TIME", QString::number(product->hops.at(i).h_time, 'f', 0));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 xmlWriter->writeTextElement("TYPE", hop_types[product->hops.at(i).h_type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 xmlWriter->writeTextElement("FORM", hop_forms[product->hops.at(i).h_form]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 xmlWriter->writeTextElement("BETA", QString::number(product->hops.at(i).h_beta, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 xmlWriter->writeTextElement("HSI", QString::number(product->hops.at(i).h_hsi, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 xmlWriter->writeTextElement("ORIGIN", product->hops.at(i).h_origin);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 xmlWriter->writeEndElement();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 xmlWriter->writeEndElement(); // HOPS
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 xmlWriter->writeStartElement("FERMENTABLES");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 for (int i = 0; i < product->fermentables.size(); i++) {
246
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
143 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) {
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
144 xmlWriter->writeStartElement("FERMENTABLE");
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
145 xmlWriter->writeTextElement("VERSION", "1");
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
146 xmlWriter->writeTextElement("NAME", product->fermentables.at(i).f_name);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
147 xmlWriter->writeTextElement("TYPE", fermentable_type[product->fermentables.at(i).f_type]);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
148 xmlWriter->writeTextElement("AMOUNT", QString::number(product->fermentables.at(i).f_amount, 'f', 4));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
149 xmlWriter->writeTextElement("YIELD", QString::number(product->fermentables.at(i).f_yield, 'f', 1));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
150 xmlWriter->writeTextElement("COLOR", QString::number(Utils::ebc_to_srm(product->fermentables.at(i).f_color), 'f', 1));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
151 xmlWriter->writeTextElement("ADD_AFTER_BOIL", product->fermentables.at(i).f_add_after_boil ? "TRUE":"FALSE");
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
152 xmlWriter->writeTextElement("ORIGIN", product->fermentables.at(i).f_origin);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
153 xmlWriter->writeTextElement("SUPPLIER", product->fermentables.at(i).f_supplier);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
154 if (product->fermentables.at(i).f_coarse_fine_diff)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
155 xmlWriter->writeTextElement("COARSE_FINE_DIFF", QString::number(product->fermentables.at(i).f_coarse_fine_diff, 'f', 4));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
156 if (product->fermentables.at(i).f_moisture)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
157 xmlWriter->writeTextElement("MOISTURE", QString::number(product->fermentables.at(i).f_moisture, 'f', 4));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
158 if (product->fermentables.at(i).f_diastatic_power)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
159 xmlWriter->writeTextElement("DIASTATIC_POWER", QString::number(product->fermentables.at(i).f_diastatic_power, 'f', 4));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
160 if (product->fermentables.at(i).f_protein)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
161 xmlWriter->writeTextElement("PROTEIN", QString::number(product->fermentables.at(i).f_protein, 'f', 4));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
162 if (product->fermentables.at(i).f_max_in_batch)
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
163 xmlWriter->writeTextElement("MAX_IN_BATCH", QString::number(product->fermentables.at(i).f_max_in_batch, 'f', 1));
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
164 xmlWriter->writeTextElement("RECOMMEND_MASH", product->fermentables.at(i).f_recommend_mash ? "TRUE":"FALSE");
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
165 xmlWriter->writeTextElement("GRAINTYPE", fermentable_graintype[product->fermentables.at(i).f_graintype]);
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
166 xmlWriter->writeEndElement();
9e420bea7c38 Product beerXML updates: Add product code to beerxml filename. Add OG and FG values if valid. Fixed equipment values to use the real equipment profile. Don't export fermentables that are used for packaging.
Michiel Broek <mbroek@mbse.eu>
parents: 243
diff changeset
167 }
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 xmlWriter->writeEndElement(); // FERMENTABLES
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 xmlWriter->writeStartElement("MISCS");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 for (int i = 0; i < product->miscs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 xmlWriter->writeStartElement("MISC");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 xmlWriter->writeTextElement("NAME", product->miscs.at(i).m_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 xmlWriter->writeTextElement("TYPE", misc_type[product->miscs.at(i).m_type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 xmlWriter->writeTextElement("AMOUNT", QString::number(product->miscs.at(i).m_amount, 'f', 5));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", product->miscs.at(i).m_amount_is_weight ? "TRUE":"FALSE");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 xmlWriter->writeTextElement("USE", misc_use[product->miscs.at(i).m_use_use]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 xmlWriter->writeTextElement("TIME", QString::number(product->miscs.at(i).m_time, 'f', 0));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 xmlWriter->writeEndElement();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 xmlWriter->writeEndElement(); // MISCS
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 xmlWriter->writeStartElement("YEASTS");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 for (int i = 0; i < product->yeasts.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 xmlWriter->writeStartElement("YEAST");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 xmlWriter->writeTextElement("NAME", product->yeasts.at(i).y_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 xmlWriter->writeTextElement("TYPE", yeast_type[product->yeasts.at(i).y_type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 xmlWriter->writeTextElement("FORM", yeast_form[product->yeasts.at(i).y_form]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 xmlWriter->writeTextElement("AMOUNT", QString::number(product->yeasts.at(i).y_amount, 'f', 5));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (product->yeasts.at(i).y_form == 1) ? "TRUE":"FALSE");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 xmlWriter->writeTextElement("LABORATORY", product->yeasts.at(i).y_laboratory);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 xmlWriter->writeTextElement("PRODUCT_ID", product->yeasts.at(i).y_product_id);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(product->yeasts.at(i).y_min_temperature, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(product->yeasts.at(i).y_max_temperature, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 xmlWriter->writeTextElement("ATTENUATION", QString::number(product->yeasts.at(i).y_attenuation, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 xmlWriter->writeTextElement("ADD_TO_SECONDARY", (product->yeasts.at(i).y_use == 0) ? "FALSE":"TRUE");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 xmlWriter->writeEndElement();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 xmlWriter->writeEndElement(); // YEASTS
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 xmlWriter->writeStartElement("WATERS");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 if (product->w1_amount > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 xmlWriter->writeStartElement("WATER");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 xmlWriter->writeTextElement("NAME", product->w1_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 xmlWriter->writeTextElement("AMOUNT", QString::number(product->w1_amount, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 xmlWriter->writeTextElement("CALCIUM", QString::number(product->w1_calcium, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 xmlWriter->writeTextElement("MAGNESIUM", QString::number(product->w1_magnesium, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 xmlWriter->writeTextElement("BICARBONATE", QString::number(product->w1_total_alkalinity * 1.22, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 xmlWriter->writeTextElement("SULFATE", QString::number(product->w1_sulfate, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 xmlWriter->writeTextElement("CHLORIDE", QString::number(product->w1_chloride, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 xmlWriter->writeTextElement("SODIUM", QString::number(product->w1_sodium, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 xmlWriter->writeTextElement("PH", QString::number(product->w1_ph, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 xmlWriter->writeTextElement("TOTAL_ALKALINITY", QString::number(product->w1_total_alkalinity, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 xmlWriter->writeEndElement();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 if (product->w2_amount > 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 xmlWriter->writeStartElement("WATER");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 xmlWriter->writeTextElement("NAME", product->w2_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 xmlWriter->writeTextElement("AMOUNT", QString::number(product->w2_amount, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 xmlWriter->writeTextElement("CALCIUM", QString::number(product->w2_calcium, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 xmlWriter->writeTextElement("MAGNESIUM", QString::number(product->w2_magnesium, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 xmlWriter->writeTextElement("BICARBONATE", QString::number(product->w2_total_alkalinity * 1.22, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 xmlWriter->writeTextElement("SULFATE", QString::number(product->w2_sulfate, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 xmlWriter->writeTextElement("CHLORIDE", QString::number(product->w2_chloride, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 xmlWriter->writeTextElement("SODIUM", QString::number(product->w2_sodium, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 xmlWriter->writeTextElement("PH", QString::number(product->w2_ph, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 xmlWriter->writeTextElement("TOTAL_ALKALINITY", QString::number(product->w2_total_alkalinity, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 xmlWriter->writeEndElement();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 xmlWriter->writeEndElement(); // WATERS
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 xmlWriter->writeStartElement("MASH");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 xmlWriter->writeTextElement("NAME", product->mash_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 xmlWriter->writeTextElement("GRAIN_TEMP", "10.0");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 xmlWriter->writeTextElement("PH", QString::number(product->sparge_ph, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 xmlWriter->writeTextElement("SPARGE_TEMP", QString::number(product->sparge_temp, 'f', 2));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 xmlWriter->writeStartElement("MASH_STEPS");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 for (int i = 0; i < product->mashs.size(); i++) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 xmlWriter->writeStartElement("MASH_STEP");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 xmlWriter->writeTextElement("VERSION", "1");
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 xmlWriter->writeTextElement("NAME", product->mashs.at(i).step_name);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 xmlWriter->writeTextElement("TYPE", step_type[product->mashs.at(i).step_type]);
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 if (product->mashs.at(i).step_type == 0) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 xmlWriter->writeTextElement("INFUSE_AMOUNT", QString::number(product->mashs.at(i).step_infuse_amount, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 xmlWriter->writeTextElement("INFUSE_TEMP", QString::number(product->mashs.at(i).step_infuse_temp, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 if (product->mashs.at(i).step_type == 2) {
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 xmlWriter->writeTextElement("DECOCTION_AMT", QString::number(product->mashs.at(i).step_infuse_amount, 'f', 3));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 xmlWriter->writeTextElement("STEP_TEMP", QString::number(product->mashs.at(i).step_temp, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 xmlWriter->writeTextElement("STEP_TIME", QString::number(product->mashs.at(i).step_time, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 xmlWriter->writeTextElement("RAMP_TIME", QString::number(product->mashs.at(i).ramp_time, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 xmlWriter->writeTextElement("END_TEMP", QString::number(product->mashs.at(i).end_temp, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 xmlWriter->writeTextElement("PH", QString::number(product->mash_ph, 'f', 1));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 xmlWriter->writeEndElement();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 xmlWriter->writeEndElement(); // MASH_STEPS
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 xmlWriter->writeEndElement(); // MASH
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 xmlWriter->writeEndElement(); // RECIPE
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 xmlWriter->writeEndElement(); // RECIPES
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 xmlWriter->writeEndDocument();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 QMessageBox::information(this, tr("Save File"), tr("XML export ready"));
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 file.close();
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 }
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273
263
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
274 void EditProduct::copyProduct()
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
275 {
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
276 Product *dup = new Product;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
277
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
278 dup = product;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
279 dup->record = -1;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
280 dup->uuid = "";
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
281 dup->name.append(" [duplicate]");
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
282 dup->code.append("-[dup]");
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
283 /*
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
284 * Clear data of a previous brew if present and roll back stages.
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
285 * But leave all ingredients and volumes, that's what we want.
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
286 */
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
287 if (dup->stage > PROD_STAGE_WAIT) {
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
288 dup->stage = dup->inventory_reduced = PROD_STAGE_WAIT;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
289 }
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
290 dup->birth = QDate::currentDate();
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
291 dup->brew_date_start = dup->brew_date_end = QDateTime();
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
292 dup->brew_mash_ph = dup->brew_mash_sg = dup->brew_mash_efficiency = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
293 dup->brew_sparge_ph = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
294 dup->brew_preboil_volume = dup->brew_preboil_sg = dup->brew_preboil_ph = dup->brew_preboil_efficiency = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
295 dup->brew_aboil_volume = dup->brew_aboil_sg = dup->brew_aboil_ph = dup->brew_aboil_efficiency = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
296 dup->brew_cooling_time = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
297 dup->brew_fermenter_volume = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
298 dup->brew_fermenter_sg = dup->brew_fermenter_ibu = dup->brew_fermenter_color = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
299 dup->og = dup->fg = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
300 dup->primary_start_temp = dup->primary_max_temp = dup->primary_end_temp = dup->primary_end_sg = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
301 dup->primary_end_date = dup->secondary_end_date = QDate();
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
302 dup->secondary_temp = dup->secondary_end_sg = dup->tertiary_temp = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
303 dup->package_date = QDate();
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
304 dup->package_volume = dup->package_abv = dup->package_ph = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
305 dup->bottle_amount = dup->bottle_carbonation = dup->bottle_priming_amount = dup->bottle_carbonation_temp = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
306 dup->keg_amount = dup->keg_carbonation = dup->keg_priming_amount = dup->keg_carbonation_temp = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
307 dup->bottle_priming_water = dup->keg_priming_water = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
308 dup->taste_rate = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
309 dup->taste_date = QDate();
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
310 dup->taste_notes = dup->taste_color = dup->taste_transparency = dup->taste_head = "";
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
311 dup->taste_aroma = dup->taste_taste = dup->taste_mouthfeel = dup->taste_aftertaste = "";
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
312 dup->starter_viability = 100;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
313 dup->yeast_prod_date = QDate();
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
314 dup->divide_type = dup->divide_parts = dup->divide_part = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
315 dup->divide_size = 0;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
316 dup->divide_factor = 1;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
317
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
318 qDebug() << dup->record << dup->name;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
319 if (DB_product::save(dup, this)) {
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
320 QMessageBox::information(this, tr("Copy Product"), tr("Copy Product export ready."));
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
321 } else {
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
322 QMessageBox::warning(this, tr("Copy Product "), tr("Copy Product error."));
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
323 }
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
324 delete dup;
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
325 }
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
326
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
327
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
328 void EditProduct::copyRecipe()
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
329 {
265
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
330 Recipe *r = new Recipe;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
331
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
332 r->record = -1;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
333 r->name = product->name + QString(" [duplicate]");
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
334 r->notes = product->notes;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
335 r->locked = false;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
336 r->st_name = product->st_name;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
337 r->st_letter = product->st_letter;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
338 r->st_guide = product->st_guide;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
339 r->st_category = product->st_category;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
340 r->st_category_number = product->st_category_number;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
341 r->st_og_min = product->st_og_min;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
342 r->st_og_max = product->st_og_max;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
343 r->st_fg_min = product->st_fg_min;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
344 r->st_fg_max = product->st_fg_max;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
345 r->st_ibu_min = product->st_ibu_min;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
346 r->st_ibu_max = product->st_ibu_max;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
347 r->st_color_min = product->st_color_min;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
348 r->st_color_max = product->st_color_max;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
349 r->st_carb_min = product->st_carb_min;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
350 r->st_carb_max = product->st_carb_max;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
351 r->st_abv_min = product->st_abv_min;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
352 r->st_abv_max = product->st_abv_max;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
353 r->type = product->type;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
354 r->batch_size = product->batch_size;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
355 r->boil_size = product->boil_size;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
356 r->boil_time = product->boil_time;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
357 r->efficiency = product->efficiency;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
358 r->est_og = product->est_og;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
359 r->est_fg = product->est_fg;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
360 r->est_abv = product->est_abv;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
361 r->est_carb = 0;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
362 r->est_color = product->est_color;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
363 r->color_method = product->color_method;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
364 r->est_ibu = product->est_ibu;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
365 r->ibu_method = product->ibu_method;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
366 r->sparge_temp = product->sparge_temp;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
367 r->sparge_volume = product->sparge_volume;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
368 r->sparge_ph = product->sparge_ph;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
369 r->sparge_acid_type = product->sparge_acid_type;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
370 r->sparge_acid_perc = product->sparge_acid_perc;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
371 r->sparge_acid_amount = 0;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
372 r->mash_ph = product->mash_ph;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
373 r->mash_name = product->mash_name;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
374 r->calc_acid = product->calc_acid;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
375 r->w1_name = product->w1_name;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
376 r->w1_amount = product->w1_amount;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
377 r->w1_calcium = product->w1_calcium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
378 r->w1_sulfate = product->w1_sulfate;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
379 r->w1_chloride = product->w1_chloride;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
380 r->w1_sodium = product->w1_sodium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
381 r->w1_magnesium = product->w1_magnesium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
382 r->w1_total_alkalinity = product->w1_total_alkalinity;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
383 r->w1_ph = product->w1_ph;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
384 r->w2_name = product->w2_name;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
385 r->w2_amount = product->w2_amount;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
386 r->w2_calcium = product->w2_calcium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
387 r->w2_sulfate = product->w2_sulfate;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
388 r->w2_chloride = product->w2_chloride;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
389 r->w2_sodium = product->w2_sodium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
390 r->w2_magnesium = product->w2_magnesium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
391 r->w2_total_alkalinity = product->w2_total_alkalinity;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
392 r->w2_ph = product->w2_ph;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
393 r->wg_amount = product->wg_amount;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
394 r->wg_calcium = product->wg_calcium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
395 r->wg_sulfate = product->wg_sulfate;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
396 r->wg_chloride = product->wg_chloride;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
397 r->wg_sodium = product->wg_sodium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
398 r->wg_magnesium = product->wg_magnesium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
399 r->wg_total_alkalinity = product->wg_total_alkalinity;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
400 r->wg_ph = product->wg_ph;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
401 r->wb_calcium = product->wb_calcium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
402 r->wb_sulfate = product->wb_sulfate;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
403 r->wb_chloride = product->wb_chloride;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
404 r->wb_sodium = product->wb_sodium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
405 r->wb_magnesium = product->wb_magnesium;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
406 r->wb_total_alkalinity = product->wb_total_alkalinity;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
407 r->wb_ph = product->wb_ph;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
408 r->wa_acid_name = product->wa_acid_name;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
409 r->wa_acid_perc = product->wa_acid_perc;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
410 r->wa_base_name = product->wa_base_name;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
411 r->fermentables = product->fermentables;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
412 r->hops = product->hops;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
413 r->miscs = product->miscs;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
414 r->yeasts = product->yeasts;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
415 r->mashs = product->mashs;
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
416
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
417 if (DB_recipe::save(r, this)) {
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
418 QMessageBox::information(this, tr("Copy Product"), tr("Copy Produuct to Recipe ready."));
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
419 } else {
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
420 QMessageBox::warning(this, tr("Copy Product"), tr("Copy Product to Recipe error."));
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
421 }
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
422 delete r;
263
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
423 }
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
424
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
425
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
426 void EditProduct::toforumProduct()
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
427 {
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
428 }
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
429
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
430
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
431 void EditProduct::splitProduct()
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
432 {
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
433 }
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
434
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
435
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
436 void EditProduct::on_exportButton_clicked()
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
437 {
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
438 QDialog* dialog = new QDialog(this);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
439 dialog->setWindowTitle(tr("Export choices"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
440 dialog->setObjectName(QString::fromUtf8("Dialog"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
441 dialog->resize(400, 179);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
442 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
443 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
444 buttonBox->setGeometry(QRect(280, 20, 81, 61));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
445 buttonBox->setOrientation(Qt::Vertical);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
446 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
447
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
448 QRadioButton *beerxmlButton = new QRadioButton(dialog);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
449 beerxmlButton->setObjectName(QString::fromUtf8("beerxmlButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
450 beerxmlButton->setGeometry(QRect(50, 20, 171, 21));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
451 beerxmlButton->setText(tr("Export to beerXML"));
263
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
452 QRadioButton *copy_productButton = new QRadioButton(dialog);
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
453 copy_productButton->setObjectName(QString::fromUtf8("copy_productButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
454 copy_productButton->setGeometry(QRect(50, 50, 171, 21));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
455 copy_productButton->setText(tr("Copy to product"));
263
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
456 /* QRadioButton *splitButton = new QRadioButton(dialog);
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
457 splitButton->setObjectName(QString::fromUtf8("splitButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
458 splitButton->setGeometry(QRect(50, 110, 171, 21));
265
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
459 splitButton->setText(tr("Split this batch")); */
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
460 QRadioButton *copy_recipeButton = new QRadioButton(dialog);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
461 copy_recipeButton->setObjectName(QString::fromUtf8("copy_recipeButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
462 copy_recipeButton->setGeometry(QRect(50, 80, 171, 21));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
463 copy_recipeButton->setText(tr("Copy to recipe"));
265
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
464 /* QRadioButton *toforumButton = new QRadioButton(dialog);
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
465 toforumButton->setObjectName(QString::fromUtf8("toforumButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
466 toforumButton->setGeometry(QRect(50, 140, 171, 21));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
467 toforumButton->setText(tr("Export to forum")); */
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
468
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
469 QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
470 QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
471
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
472 dialog->setModal(true);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
473 dialog->exec();
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
474 if (dialog->result() == QDialog::Accepted) {
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
475 if (beerxmlButton->isChecked())
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
476 exportBeerXML();
263
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
477 if (copy_productButton->isChecked())
14d79ec33db4 Added Product copy to Product.
Michiel Broek <mbroek@mbse.eu>
parents: 246
diff changeset
478 copyProduct();
265
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
479 if (copy_recipeButton->isChecked())
df17db1484f6 Added export product to recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
480 copyRecipe();
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
481 }
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
482
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
483 disconnect(buttonBox, nullptr, nullptr, nullptr);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
484 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
485
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
486
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
487 void EditProduct::on_printButton_clicked()
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
488 {
243
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
489 QDialog* dialog = new QDialog(this);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
490 dialog->setWindowTitle(tr("Printer report"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
491 dialog->setObjectName(QString::fromUtf8("Dialog"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
492 dialog->resize(400, 101);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
493 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
494 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
495 buttonBox->setGeometry(QRect(280, 20, 81, 61));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
496 buttonBox->setOrientation(Qt::Vertical);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
497 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
498
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
499 QRadioButton *recipeButton = new QRadioButton(dialog);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
500 recipeButton->setObjectName(QString::fromUtf8("recipeButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
501 recipeButton->setGeometry(QRect(50, 20, 171, 21));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
502 recipeButton->setText(tr("Print recipe"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
503 QRadioButton *checklistButton = new QRadioButton(dialog);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
504 checklistButton->setObjectName(QString::fromUtf8("checklistButton"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
505 checklistButton->setGeometry(QRect(50, 50, 171, 21));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
506 checklistButton->setText(tr("Print checklist"));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
507
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
508 QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
509 QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
510
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
511 dialog->setModal(true);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
512 dialog->exec();
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
513 if (dialog->result() == QDialog::Accepted) {
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
514 if (checklistButton->isChecked())
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
515 PrinterDialog(PR_CHECKLIST, -1, this);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
516 if (recipeButton->isChecked())
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
517 PrinterDialog(PR_PRODUCT, -1, this);
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
518 }
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
519
84dc3c1c2d02 Added print and export choices popups. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
520 disconnect(buttonBox, nullptr, nullptr, nullptr);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
521 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
522
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
523

mercurial