Mon, 13 Jun 2022 12:26:27 +0200
Fixed init of import record. Added miscs import
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * ImportXML.cpp is part of bmsapp. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include "ImportXML.h" |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | #include "../ui/ui_ImportXML.h" |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
19 | #include "global.h" |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
20 | #include "Utils.h" |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | #include "MainWindow.h" |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | ImportXML::ImportXML(QWidget *parent) : QDialog(parent), ui(new Ui::ImportXML) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | qDebug() << "ImportXML start"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | ui->setupUi(this); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | WindowTitle(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | ui->progressBar->setValue(0); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | connect(ui->quitButton, SIGNAL(clicked()), parent, SLOT(fromImportXML())); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | ImportXML::~ImportXML() |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | qDebug() << "ImportXML done"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | delete ui; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | void ImportXML::WindowTitle() |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | QString txt = QString(tr("BMSapp - Import XML")); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | setWindowTitle(txt); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | void ImportXML::on_openButton_clicked() |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | QSqlQuery query; |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
51 | QString log; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | int total = 0, errors = 0; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QDir::homePath() + "/*.xml", tr("Files (*.xml)")); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | if (fileName == 0) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | QMessageBox::warning(this, tr("Open File"), tr("No XML file selected.")); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | return; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | ui->fileEdit->setText(fileName); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | QFile file(fileName); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | qint64 fsize = file.size(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | log = "Import XML file `" + fileName + "`\n\n"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | qInfo() << "Import XML" << fileName << "length" << fsize << "bytes"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | file.open(QIODevice::ReadOnly); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | QXmlStreamReader *xml = new QXmlStreamReader(&file); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | if (xml->tokenType() == QXmlStreamReader::StartDocument) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
76 | qDebug() << xml->documentVersion() << xml->documentEncoding(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | // Just skip |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "EQUIPMENTS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | * Equipments |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "EQUIPMENTS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | qDebug() << "0 /EQUIPMENTS"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "EQUIPMENT")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | * Equipment |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | total++; |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
94 | Equipment *eq = new Equipment(); |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
95 | eq->notes = ""; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "EQUIPMENT")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
101 | query.prepare("INSERT INTO inventory_equipments SET name=:name, boil_size=:boil_size, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
102 | "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
103 | "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
104 | "top_up_water=:top_up_water, trub_chiller_loss=:chiller_loss, evap_rate=:evap_rate, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
105 | "boil_time=:boil_time, calc_boil_volume=:calcboil, top_up_kettle=:top_up_kettle, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
106 | "hop_utilization=:hopfactor, notes=:notes, lauter_volume=:lauter_volume, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
107 | "lauter_height=:lauter_height, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
108 | "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, " |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
109 | "efficiency=:efficiency, uuid=:uuid"); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
110 | query.bindValue(":name", eq->name); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
111 | query.bindValue(":boil_size", QString("%1").arg(eq->boil_size, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
112 | query.bindValue(":batch_size", QString("%1").arg(eq->batch_size, 3, 'f', 2, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
113 | query.bindValue(":tun_volume", QString("%1").arg(eq->tun_volume, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
114 | query.bindValue(":tun_weight", QString("%1").arg(eq->tun_weight, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
115 | query.bindValue(":tun_specific_heat", QString("%1").arg(eq->tun_specific_heat, 4, 'f', 3, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
116 | query.bindValue(":tun_material", eq->tun_material); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
117 | query.bindValue(":tun_height", QString("%1").arg(eq->tun_height, 4, 'f', 3, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
118 | query.bindValue(":top_up_water", QString("%1").arg(eq->top_up_water, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
119 | query.bindValue(":chiller_loss", QString("%1").arg(eq->trub_chiller_loss, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
120 | /* The evaporation in beerxml is percentage, but we use the real volume per hour */ |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
121 | query.bindValue(":evap_rate", QString("%1").arg((eq->evap_rate / 100) * eq->boil_size, 3, 'f', 2, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
122 | query.bindValue(":boil_time", QString("%1").arg(eq->boil_time, 1, 'f', 0, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
123 | query.bindValue(":calcboil", eq->calc_boil_volume ? 1:0); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
124 | query.bindValue(":top_up_kettle", QString("%1").arg(eq->top_up_kettle, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
125 | query.bindValue(":hopfactor", QString("%1").arg(eq->hop_utilization, 1, 'f', 0, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
126 | query.bindValue(":notes", eq->notes); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
127 | query.bindValue(":lauter_volume", QString("%1").arg(eq->lauter_volume, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
128 | query.bindValue(":lauter_height", QString("%1").arg(eq->lauter_height, 4, 'f', 3, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
129 | query.bindValue(":lauter_deadspace", QString("%1").arg(eq->lauter_deadspace, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
130 | query.bindValue(":kettle_volume", QString("%1").arg(eq->kettle_volume, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
131 | query.bindValue(":kettle_height", QString("%1").arg(eq->kettle_height, 4, 'f', 3, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
132 | query.bindValue(":mash_volume", QString("%1").arg(eq->mash_volume, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
133 | query.bindValue(":mash_max", QString("%1").arg(eq->mash_max, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
134 | query.bindValue(":efficiency", QString("%1").arg(eq->efficiency, 2, 'f', 1, '0')); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
135 | query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
136 | query.exec(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | if (query.lastError().isValid()) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
138 | qWarning() << query.lastError(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
142 | delete eq; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | } |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
145 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
146 | ((xml->name() == "VERSION") || (xml->name() == "DISPLAY_BOIL_SIZE") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
147 | (xml->name() == "DISPLAY_BATCH_SIZE") || (xml->name() == "DISPLAY_TUN_VOLUME") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
148 | (xml->name() == "DISPLAY_TUN_WEIGHT") || (xml->name() == "DISPLAY_TRUB_CHILLER_LOSS") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
149 | (xml->name() == "DISPLAY_LAUTERDEADSPACE") || (xml->name() == "TUN_MATERIAL") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
150 | (xml->name() == "ATTENUATION_FACTOR_YEAST") || (xml->name() == "ATTENUATION_FACTOR_WATER_TO_GRAIN_RATIO") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
151 | (xml->name() == "ATTENUATION_FACTOR_TOTAL_MASH_TIME") || (xml->name() == "ATTENUATION_FACTOR_PERC_SIMPLE_SUGAR") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
152 | (xml->name() == "ATTENUATION_FACTOR_CONSTANT"))) { |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | // Ignore. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
155 | eq->name = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
157 | eq->notes = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "BOIL_SIZE")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
159 | eq->boil_size = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "BATCH_SIZE")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
161 | eq->batch_size = xml->readElementText().toDouble(); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
162 | qDebug() << eq->batch_size; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TUN_VOLUME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
164 | eq->tun_volume = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TUN_WEIGHT")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
166 | eq->tun_weight = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TUN_SPECIFIC_HEAT")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
168 | eq->tun_specific_heat = xml->readElementText().toDouble(); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
169 | if (eq->tun_specific_heat == 0.22) |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
170 | eq->tun_material = 1; |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
171 | else if (eq->tun_specific_heat == 0.46) |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
172 | eq->tun_material = 2; |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
173 | else if (eq->tun_specific_heat == 0.092) |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
174 | eq->tun_material = 3; |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
175 | else |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
176 | eq->tun_material = 0; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TUN_HEIGHT")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
178 | eq->tun_height = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TRUB_CHILLER_LOSS")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
180 | eq->trub_chiller_loss = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "EVAP_RATE")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
182 | eq->evap_rate = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "BOIL_TIME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
184 | eq->boil_time = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "CALC_BOIL_VOLUME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
186 | eq->calc_boil_volume = (xml->readElementText() == "TRUE") ? true:false; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TOP_UP_KETTLE")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
188 | eq->top_up_kettle = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
189 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HOP_UTILIZATION")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
190 | eq->hop_utilization = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "LAUTER_VOLUME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
192 | eq->lauter_volume = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "LAUTER_HEIGHT")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
194 | eq->lauter_height = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
195 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "LAUTER_DEADSPACE")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
196 | eq->lauter_deadspace = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "KETTLE_VOLUME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
198 | eq->kettle_volume = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
199 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "KETTLE_HEIGHT")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
200 | eq->kettle_height = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MASH_VOLUME")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
202 | eq->mash_volume = xml->readElementText().toDouble(); |
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
203 | eq->mash_max = eq->mash_volume / 3; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
204 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "EFFICIENCY")) { |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
205 | eq->efficiency = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
206 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
207 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
213 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "STYLES")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
214 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
215 | * Styles |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
218 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
220 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "STYLES")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
221 | qDebug() << "0 /STYLES"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
223 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
224 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "STYLE")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
226 | * Style |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
227 | */ |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
228 | Style *st = new Style(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
229 | st->notes = st->category = st->style_letter = st->profile = st->ingredients = st->examples = ""; |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
230 | st->style_guide = "BKG 2019"; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
231 | total++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
232 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
233 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
234 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
235 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
236 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "STYLE")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
237 | query.prepare("INSERT INTO profile_styles SET name=:name, category=:category, " |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
238 | "category_number=:catnr, style_letter=:group, style_guide=:guide, type=:type, " |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
239 | "og_min=:og_min, og_max=:og_max, fg_min=:fg_min, fg_max=:fg_max, ibu_min=:ibu_min, " |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
240 | "ibu_max=:ibu_max, color_min=:ebc_min, color_max=:ebc_max, carb_min=:co2_min, " |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
241 | "carb_max=:co2_max, abv_min=:abv_min, abv_max=:abv_max, notes=:notes, " |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
242 | "profile=:profile, ingredients=:ingredients, examples=:examples, uuid=:uuid"); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
243 | query.bindValue(":name", st->name); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
244 | query.bindValue(":category", st->category); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
245 | query.bindValue(":catnr", st->category_number); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
246 | query.bindValue(":group", st->style_letter); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
247 | query.bindValue(":guide", st->style_guide); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
248 | query.bindValue(":type", st->type); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
249 | query.bindValue(":og_min", QString("%1").arg(st->og_min, 4, 'f', 3, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
250 | query.bindValue(":og_max", QString("%1").arg(st->og_max, 4, 'f', 3, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
251 | query.bindValue(":fg_min", QString("%1").arg(st->fg_min, 4, 'f', 3, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
252 | query.bindValue(":fg_max", QString("%1").arg(st->fg_max, 4, 'f', 3, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
253 | query.bindValue(":ibu_min", QString("%1").arg(st->ibu_min, 1, 'f', 0, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
254 | query.bindValue(":ibu_max", QString("%1").arg(st->ibu_max, 1, 'f', 0, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
255 | query.bindValue(":ebc_min", QString("%1").arg(st->color_min, 1, 'f', 0, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
256 | query.bindValue(":ebc_max", QString("%1").arg(st->color_max, 1, 'f', 0, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
257 | query.bindValue(":co2_min", QString("%1").arg(st->carb_min, 2, 'f', 1, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
258 | query.bindValue(":co2_max", QString("%1").arg(st->carb_max, 2, 'f', 1, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
259 | query.bindValue(":abv_min", QString("%1").arg(st->abv_min, 2, 'f', 1, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
260 | query.bindValue(":abv_max", QString("%1").arg(st->abv_max, 2, 'f', 1, '0')); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
261 | query.bindValue(":notes", st->notes); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
262 | query.bindValue(":profile", st->profile); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
263 | query.bindValue(":ingredients", st->ingredients); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
264 | query.bindValue(":examples", st->examples); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
265 | query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
266 | query.exec(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
267 | if (query.lastError().isValid()) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
268 | qWarning() << query.lastError(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
269 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
270 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
271 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
272 | delete st; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
273 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
274 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
275 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && ((xml->name() == "VERSION")) || |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
276 | (xml->name() == "DISPLAY_OG_MIN") || (xml->name() == "DISPLAY_OG_MAX") || (xml->name() == "DISPLAY_FG_MIN") || |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
277 | (xml->name() == "DISPLAY_FG_MAX") || (xml->name() == "DISPLAY_IBU_MIN") || (xml->name() == "DISPLAY_IBU_MAX") || |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | (xml->name() == "DISPLAY_COLOR_MIN") || (xml->name() == "DISPLAY_COLOR_MAX") || (xml->name() == "DISPLAY_CARB_MIN") || |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
279 | (xml->name() == "DISPLAY_CARB_MAX") || (xml->name() == "DISPLAY_ABV_MIN") || (xml->name() == "DISPLAY_ABV_MAX") || |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
280 | (xml->name() == "OG_RANGE") || (xml->name() == "FG_RANGE") || (xml->name() == "IBU_RANGE") || |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
281 | (xml->name() == "CARB_RANGE") || (xml->name() == "COLOR_RANGE") || (xml->name() == "ABV_RANGE")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
282 | // Ignore. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
283 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
284 | st->name = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
285 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "CATEGORY")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
286 | st->category = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
287 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "CATEGORY_NUMBER")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
288 | st->category_number = xml->readElementText().toInt(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
289 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "STYLE_LETTER")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
290 | st->style_letter = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
291 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "STYLE_GUIDE")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
292 | st->style_guide = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
293 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TYPE")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
294 | QString temp = xml->readElementText(); |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
295 | if (temp == "Lager") |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
296 | st->type = 0; |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
297 | else if (temp == "Ale") |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
298 | st->type = 1; |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
299 | else if (temp == "Mead") |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
300 | st->type = 2; |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
301 | else if (temp == "Wheat") |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
302 | st->type = 3; |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
303 | else if (temp == "Mixed") |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
304 | st->type = 4; |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
305 | else if (temp == "Cider") |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
306 | st->type = 5; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
307 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
308 | st->notes = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
309 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "OG_MIN")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
310 | st->og_min = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
311 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "OG_MAX")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
312 | st->og_max = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
313 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "FG_MIN")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
314 | st->fg_min = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
315 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "FG_MAX")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
316 | st->fg_max = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
317 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "IBU_MIN")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
318 | st->ibu_min = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
319 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "IBU_MAX")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
320 | st->ibu_max = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
321 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COLOR_MIN")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
322 | st->color_min = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
323 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COLOR_MAX")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
324 | st->color_max = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
325 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "CARB_MIN")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
326 | st->carb_min = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
327 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "CARB_MAX")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
328 | st->carb_max = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
329 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ABV_MIN")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
330 | st->abv_min = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
331 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ABV_MAX")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
332 | st->abv_max = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
333 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "PROFILE")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
334 | st->profile = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
335 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "INGREDIENTS")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
336 | st->ingredients = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
337 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "EXAMPLES")) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
338 | st->examples = xml->readElementText(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
339 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
340 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
341 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
342 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
343 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
344 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
345 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
346 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "FERMENTABLES")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
347 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
348 | * Fermentables |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
349 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
350 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
351 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
352 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
353 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "FERMENTABLES")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
354 | qDebug() << "0 /FERMENTABLES"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
355 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
356 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
357 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "FERMENTABLE")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
358 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
359 | * Fermentable |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
360 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
361 | total++; |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
362 | Fermentables *f = new Fermentables(); |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
363 | f->f_supplier = f->f_origin = f->f_notes = ""; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
364 | f->f_yield = 80; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
365 | f->f_max_in_batch = 100; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
366 | f->f_recommend_mash = true; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
367 | f->f_di_ph = 5.7; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
368 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
369 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
370 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
371 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
372 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "FERMENTABLE")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
373 | query.prepare("INSERT INTO inventory_fermentables SET name=:name, type=:type, yield=:yield, color=:color, " |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
374 | "add_after_boil=:addafter, origin=:origin, supplier=:supplier, notes=:notes, coarse_fine_diff=:coarse, " |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
375 | "moisture=:moisture, diastatic_power=:diastatic, protein=:protein, dissolved_protein=:dissolved, " |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
376 | "max_in_batch=:maxinbatch, recommend_mash=:mash, added=:added, di_ph=:diph, " |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
377 | "acid_to_ph_57=:acidph, graintype=:graintype, uuid = :uuid"); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
378 | query.bindValue(":name", f->f_name); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
379 | query.bindValue(":type", f->f_type); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
380 | query.bindValue(":yield", QString("%1").arg(f->f_yield, 2, 'f', 1, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
381 | query.bindValue(":color", QString("%1").arg(Utils::srm_to_ebc(f->f_color), 1, 'f', 0, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
382 | query.bindValue(":addafter", f->f_add_after_boil ? 1:0); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
383 | query.bindValue(":origin", f->f_origin); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
384 | query.bindValue(":supplier", f->f_supplier); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
385 | query.bindValue(":notes", f->f_notes); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
386 | query.bindValue(":coarse", QString("%1").arg(f->f_coarse_fine_diff, 4, 'f', 3, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
387 | query.bindValue(":moisture", QString("%1").arg(f->f_moisture, 4, 'f', 3, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
388 | query.bindValue(":diastatic", Utils::kolbach_to_lintner(f->f_diastatic_power)); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
389 | query.bindValue(":protein", QString("%1").arg(f->f_protein, 4, 'f', 3, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
390 | query.bindValue(":dissolved", QString("%1").arg(f->f_dissolved_protein, 4, 'f', 3, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
391 | query.bindValue(":maxinbatch", QString("%1").arg(f->f_max_in_batch, 2, 'f', 1, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
392 | query.bindValue(":mash", f->f_recommend_mash ? 1:0); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
393 | query.bindValue(":added", f->f_added); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
394 | query.bindValue(":diph", QString("%1").arg(f->f_di_ph, 6, 'f', 5, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
395 | query.bindValue(":acidph", QString("%1").arg(f->f_acid_to_ph_57, 6, 'f', 5, '0')); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
396 | query.bindValue(":graintype", f->f_graintype); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
397 | query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
398 | query.exec(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
399 | if (query.lastError().isValid()) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
400 | qWarning() << query.lastError(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
401 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
402 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
403 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
404 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
405 | } |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
406 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
407 | ((xml->name() == "VERSION") || (xml->name() == "DISPLAY_COST") || |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
408 | (xml->name() == "DISPLAY_COLOR") || (xml->name() == "INVENTORY") || |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
409 | (xml->name() == "COST") || (xml->name() == "ALWAYS_ON_STOCK") || |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
410 | (xml->name() == "PERCENTAGE") || (xml->name() == "ADJUST_TO_TOTAL_100") )) { |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
411 | // Ignore. |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
412 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
413 | f->f_name = xml->readElementText(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
414 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TYPE")) { |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
415 | QString temp = xml->readElementText(); |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
416 | if (temp == "Sugar") |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
417 | f->f_type = 1; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
418 | else if (temp == "Extract") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
419 | f->f_type = 2; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
420 | else if (temp == "Dry extract") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
421 | f->f_type = 3; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
422 | else if (temp == "Adjunct") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
423 | f->f_type = 4; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
424 | else |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
425 | f->f_type = 0; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
426 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ORIGIN")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
427 | f->f_origin = xml->readElementText(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
428 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "SUPPLIER")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
429 | f->f_supplier = xml->readElementText(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
430 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
431 | f->f_notes = xml->readElementText(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
432 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "YIELD")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
433 | f->f_yield = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
434 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COARSE_FINE_DIFF")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
435 | f->f_coarse_fine_diff = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
436 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MOISTURE")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
437 | f->f_moisture = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
438 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "DIASTATIC_POWER")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
439 | f->f_diastatic_power = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
440 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MAX_IN_BATCH")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
441 | f->f_max_in_batch = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
442 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "RECOMMEND_MASH")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
443 | f->f_recommend_mash = (xml->readElementText() == "TRUE") ? true:false; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
444 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "GRAINTYPE")) { |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
445 | QString temp = xml->readElementText(); |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
446 | if (temp == "Roast") |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
447 | f->f_graintype = 1; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
448 | else if (temp == "Crystal") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
449 | f->f_graintype = 2; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
450 | else if (temp == "Kilned") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
451 | f->f_graintype = 3; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
452 | else if (temp == "Sour Malt") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
453 | f->f_graintype = 4; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
454 | else if (temp == "Special") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
455 | f->f_graintype = 5; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
456 | else if (temp == "No malt") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
457 | f->f_graintype = 6; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
458 | else |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
459 | f->f_graintype = 0; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
460 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ADDED")) { |
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
461 | QString temp = xml->readElementText(); |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
462 | if (temp == "Boil") |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
463 | f->f_added = 1; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
464 | else if (temp == "Fermentation") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
465 | f->f_added = 2; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
466 | else if (temp == "Lagering") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
467 | f->f_added = 3; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
468 | else if (temp == "Bottle") |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
469 | f->f_added = 4; |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
470 | else |
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
471 | f->f_added = 0; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
472 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ADD_AFTER_BOIL")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
473 | f->f_add_after_boil = (xml->readElementText() == "TRUE") ? true:false; |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
474 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COLOR")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
475 | f->f_color = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
476 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "PROTEIN")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
477 | f->f_protein = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
478 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "DISSOLVED_PROTEIN")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
479 | f->f_dissolved_protein = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
480 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "DI_pH")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
481 | f->f_di_ph = xml->readElementText().toDouble(); |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
482 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ACID_TO_pH_5.7")) { |
278
ed562a2a4ca4
Finished import fermentables
Michiel Broek <mbroek@mbse.eu>
parents:
277
diff
changeset
|
483 | f->f_acid_to_ph_57 = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
484 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
485 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
486 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
487 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
488 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
489 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
490 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
491 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HOPS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
492 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
493 | * Hops |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
494 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
495 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
496 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
497 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
498 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "HOPS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
499 | qDebug() << "0 /HOPS"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
500 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
501 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
502 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HOP")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
503 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
504 | * Hop |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
505 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
506 | total++; |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
507 | Hops *h = new Hops(); |
279 | 508 | h->h_notes = h->h_origin = h->h_substitutes = ""; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
509 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
510 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
511 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
512 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
513 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "HOP")) { |
279 | 514 | query.prepare("INSERT INTO inventory_hops SET name=:name, alpha=:alpha, beta=:beta, " |
515 | "humulene=:humulene, caryophyllene=:cary, cohumulone=:cohumulone, myrcene=:myrcene, " | |
516 | "hsi=:hsi, type=:type, form=:form, notes=:notes, origin=:origin, substitutes=:substitutes, " | |
517 | "total_oil=:oil, uuid = :uuid"); | |
518 | query.bindValue(":name", h->h_name); | |
519 | query.bindValue(":alpha", QString("%1").arg(h->h_alpha, 2, 'f', 1, '0')); | |
520 | query.bindValue(":beta", QString("%1").arg(h->h_beta, 2, 'f', 1, '0')); | |
521 | query.bindValue(":humulene", QString("%1").arg(h->h_humulene, 2, 'f', 1, '0')); | |
522 | query.bindValue(":cary", QString("%1").arg(h->h_caryophyllene, 2, 'f', 1, '0')); | |
523 | query.bindValue(":cohumulone", QString("%1").arg(h->h_cohumulone, 2, 'f', 1, '0')); | |
524 | query.bindValue(":myrcene", QString("%1").arg(h->h_myrcene, 2, 'f', 1, '0')); | |
525 | query.bindValue(":hsi", QString("%1").arg(h->h_hsi, 2, 'f', 1, '0')); | |
526 | query.bindValue(":type", h->h_type); | |
527 | query.bindValue(":form", h->h_form); | |
528 | query.bindValue(":notes", h->h_notes); | |
529 | query.bindValue(":origin", h->h_origin); | |
530 | query.bindValue(":substitutes", h->h_substitutes); | |
531 | query.bindValue(":oil", QString("%1").arg(h->h_total_oil, 2, 'f', 1, '0')); | |
532 | query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); | |
533 | query.exec(); | |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
534 | if (query.lastError().isValid()) { |
279 | 535 | qWarning() << query.lastError(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
536 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
537 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
538 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
539 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
540 | } |
279 | 541 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && ( |
542 | (xml->name() == "VERSION") || (xml->name() == "ALWAYS_ON_STOCK") || | |
543 | (xml->name() == "HARVEST_DATE") || (xml->name() == "DISPLAY_COST") || | |
544 | (xml->name() == "COST") || (xml->name() == "INVENTORY"))) { | |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
545 | // Ignore. |
279 | 546 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) { |
547 | h->h_name = xml->readElementText(); | |
548 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ORIGIN")) { | |
549 | h->h_origin = xml->readElementText(); | |
550 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) { | |
551 | h->h_notes = xml->readElementText(); | |
552 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "FORM")) { | |
553 | QString temp = xml->readElementText(); | |
554 | if (temp == "Plug") | |
555 | h->h_form = 1; | |
556 | else if (temp == "Leaf") | |
557 | h->h_form = 2; | |
558 | else if (temp == "Leaf wet") | |
559 | h->h_form = 3; | |
560 | else if (temp == "Cryo") | |
561 | h->h_form = 4; | |
562 | else | |
563 | h->h_form = 0; | |
564 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ALPHA")) { | |
565 | h->h_alpha = xml->readElementText().toDouble(); | |
566 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TYPE")) { | |
567 | QString temp = xml->readElementText(); | |
568 | if (temp == "Aroma") | |
569 | h->h_type = 1; | |
570 | else if (temp == "Both") | |
571 | h->h_type = 2; | |
572 | else | |
573 | h->h_type = 0; | |
574 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "USE")) { | |
575 | QString temp = xml->readElementText(); | |
576 | if (temp == "First wort") | |
577 | h->h_useat = 1; | |
578 | else if (temp == "Boil") | |
579 | h->h_useat = 2; | |
580 | else if (temp == "Aroma") | |
581 | h->h_useat = 3; | |
582 | else if (temp == "Whirlpool") | |
583 | h->h_useat = 4; | |
584 | else if (temp == "Dry hop") | |
585 | h->h_useat = 5; | |
586 | else | |
587 | h->h_useat = 0; | |
588 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "BETA")) { | |
589 | h->h_beta = xml->readElementText().toDouble(); | |
590 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HSI")) { | |
591 | h->h_hsi = xml->readElementText().toDouble(); | |
592 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "SUBSTITUTES")) { | |
593 | h->h_substitutes = xml->readElementText(); | |
594 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HUMULENE")) { | |
595 | h->h_humulene = xml->readElementText().toDouble(); | |
596 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && | |
597 | ((xml->name() == "CARYOPHYLLENE") || (xml->name() == "CAROPHYLLENE"))) { | |
598 | h->h_caryophyllene = xml->readElementText().toDouble(); | |
599 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COHUMULONE")) { | |
600 | h->h_cohumulone = xml->readElementText().toDouble(); | |
601 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MYRCENE")) { | |
602 | h->h_myrcene = xml->readElementText().toDouble(); | |
603 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TOTAL_OIL")) { | |
604 | h->h_total_oil = xml->readElementText().toDouble(); | |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
605 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
606 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
607 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
608 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
609 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
610 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
611 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
612 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MISCS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
613 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
614 | * Miscs |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
615 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
616 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
617 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
618 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
619 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "MISCS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
620 | qDebug() << "0 /MISCS"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
621 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
622 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
623 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MISC")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
624 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
625 | * Misc |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
626 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
627 | total++; |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
628 | Miscs *m = new Miscs(); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
629 | m->name = m->use_for = m->notes = ""; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
630 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
631 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
632 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
633 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
634 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "MISC")) { |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
635 | query.prepare("INSERT INTO inventory_miscs SET name=:name, type=:type, use_use=:use, " |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
636 | "time=:time, amount_is_weight=:isweight, use_for=:usefor, notes=:notes, " |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
637 | "uuid = :uuid"); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
638 | query.bindValue(":name", m->name); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
639 | query.bindValue(":type", m->type); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
640 | query.bindValue(":use", m->use_use); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
641 | query.bindValue(":time", QString("%1").arg(m->time, 1, 'f', 0, '0')); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
642 | query.bindValue(":isweight", m->amount_is_weight ? 1:0); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
643 | query.bindValue(":usefor", m->use_for); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
644 | query.bindValue(":notes", m->notes); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
645 | query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
646 | query.exec(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
647 | if (query.lastError().isValid()) { |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
648 | qWarning() << query.lastError(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
649 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
650 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
651 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
652 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
653 | } |
279 | 654 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && ( |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
655 | (xml->name() == "VERSION") || (xml->name() == "DISPLAY_AMOUNT") || |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
656 | (xml->name() == "AMOUNT") || (xml->name() == "ALWAYS_ON_STOCK") || |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
657 | (xml->name() == "COST") || (xml->name() == "DISPLAY_COST") || |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
658 | (xml->name() == "INVENTORY") || (xml->name() == "DISPLAY_TIME") || |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
659 | (xml->name() == "FREE_FIELD") || (xml->name() == "FREE_FIELD_NAME") |
279 | 660 | )) { |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
661 | // Ignore. |
279 | 662 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) { |
281
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
663 | m->name = xml->readElementText(); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
664 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) { |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
665 | m->notes = xml->readElementText(); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
666 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "USE_FOR")) { |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
667 | m->use_for = xml->readElementText(); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
668 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TYPE")) { |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
669 | QString temp = xml->readElementText(); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
670 | if (temp == "Herb") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
671 | m->type = 1; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
672 | else if (temp == "Flavor") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
673 | m->type = 2; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
674 | else if (temp == "Fining") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
675 | m->type = 3; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
676 | else if (temp == "Water agent") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
677 | m->type = 4; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
678 | else if (temp == "Yeast nutrient") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
679 | m->type = 5; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
680 | else if (temp == "Other") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
681 | m->type = 6; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
682 | else |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
683 | m->type = 0; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
684 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "USE")) { |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
685 | QString temp = xml->readElementText(); |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
686 | if (temp == "Mash") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
687 | m->use_use = 1; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
688 | else if (temp == "Boil") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
689 | m->use_use = 2; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
690 | else if (temp == "Primary") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
691 | m->use_use = 3; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
692 | else if (temp == "Secondary") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
693 | m->use_use = 4; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
694 | else if (temp == "Bottling") |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
695 | m->use_use = 5; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
696 | else |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
697 | m->use_use = 0; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
698 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "AMOUNT_IS_WEIGHT")) { |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
699 | m->amount_is_weight = (xml->readElementText() == "TRUE") ? true:false; |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
700 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TIME")) { |
af3dac6ff6c3
Fixed init of import record. Added miscs import
Michiel Broek <mbroek@mbse.eu>
parents:
279
diff
changeset
|
701 | m->time = xml->readElementText().toDouble(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
702 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
703 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
704 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
705 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
706 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
707 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
708 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
709 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "YEASTS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
710 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
711 | * Yeasts |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
712 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
713 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
714 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
715 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
716 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "YEASTS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
717 | qDebug() << "0 /YEASTS"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
718 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
719 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
720 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "YEAST")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
721 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
722 | * Yeast |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
723 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
724 | total++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
725 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
726 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
727 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
728 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
729 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "YEAST")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
730 | // query.exec(sql); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
731 | if (query.lastError().isValid()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
732 | // qWarning() << sql << query.lastError(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
733 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
734 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
735 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
736 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
737 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
738 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "VERSION")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
739 | // Ignore. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
740 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
741 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
742 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
743 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
744 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
745 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
746 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
747 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "WATERS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
748 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
749 | * Waters |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
750 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
751 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
752 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
753 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
754 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "WATERS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
755 | qDebug() << "0 /WATERS"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
756 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
757 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
758 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "WATER")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
759 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
760 | * Water |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
761 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
762 | total++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
763 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
764 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
765 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
766 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
767 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "WATER")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
768 | // query.exec(sql); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
769 | if (query.lastError().isValid()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
770 | // qWarning() << sql << query.lastError(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
771 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
772 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
773 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
774 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
775 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
776 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "VERSION")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
777 | // Ignore. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
778 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
779 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
780 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
781 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
782 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
783 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
784 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
785 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "RECIPES")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
786 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
787 | * Recipes |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
788 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
789 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
790 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
791 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
792 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "RECIPES")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
793 | qDebug() << "0 /RECIPES"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
794 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
795 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
796 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "RECIPE")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
797 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
798 | * Recipe |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
799 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
800 | total++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
801 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
802 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
803 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
804 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
805 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "RECIPE")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
806 | // query.exec(sql); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
807 | if (query.lastError().isValid()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
808 | // qWarning() << sql << query.lastError(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
809 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
810 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
811 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
812 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
813 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
814 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "VERSION")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
815 | // Ignore. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
816 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
817 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
818 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
819 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
820 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
821 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
822 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
823 | } else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MASHS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
824 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
825 | * Mashes |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
826 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
827 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
828 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
829 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
830 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "MASHS")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
831 | qDebug() << "0 /MASHS"; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
832 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
833 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
834 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MASH")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
835 | /* |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
836 | * Mash |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
837 | */ |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
838 | total++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
839 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
840 | while (xml->readNext()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
841 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
842 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
843 | if ((xml->tokenType() == QXmlStreamReader::EndElement) && (xml->name() == "MASH")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
844 | // query.exec(sql); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
845 | if (query.lastError().isValid()) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
846 | // qWarning() << sql << query.lastError(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
847 | errors++; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
848 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
849 | ui->progressBar->setValue(round(100 * xml->characterOffset() / fsize)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
850 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
851 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
852 | if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "VERSION")) { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
853 | // Ignore. |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
854 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
855 | if (xml->tokenType() == QXmlStreamReader::StartElement) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
856 | qDebug() << "2 " << xml->tokenType() << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
857 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
858 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
859 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
860 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
861 | } else { |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
862 | qDebug() << "Unknown level 0" << xml->name(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
863 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
864 | if (xml->atEnd()) |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
865 | break; |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
866 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
867 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
868 | log.append(QString(" total errors\n")); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
869 | log.append(QString(" ----- ------\n")); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
870 | log.append(QString("total %1 %2\n").arg(total, 3).arg(errors, 3)); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
871 | ui->logEdit->setPlainText(log); |
277
2228d833c52a
The equipment import is now final.
Michiel Broek <mbroek@mbse.eu>
parents:
276
diff
changeset
|
872 | qInfo() << "Import" << total << "records, " << total - errors << "ok, " << errors << "errors"; |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
873 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
874 | ui->progressBar->setValue(100); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
875 | if (xml->hasError()) { |
276
7316a419334d
Changed import XML method for beer styles using a temporary struct and native database functions. This is the correct method which gives the correct results.
Michiel Broek <mbroek@mbse.eu>
parents:
275
diff
changeset
|
876 | qWarning() << "XML error" << xml->error() << xml->errorString(); |
275
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
877 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
878 | file.close(); |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
879 | } |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
880 | |
f472f9773782
Added import from xml, equipments and beerstyles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
881 |