src/ImportXML.cpp

changeset 282
d1d208a857b0
parent 281
af3dac6ff6c3
child 283
242a68fa7186
--- a/src/ImportXML.cpp	Mon Jun 13 12:26:27 2022 +0200
+++ b/src/ImportXML.cpp	Mon Jun 13 15:47:16 2022 +0200
@@ -505,7 +505,7 @@
                      */
                     total++;
 		    Hops *h = new Hops();
-		    h->h_notes = h->h_origin = h->h_substitutes = "";
+		    h->notes = h->origin = h->substitutes = "";
 
                     while (xml->readNext()) {
                         if (xml->atEnd())
@@ -515,20 +515,20 @@
 				"humulene=:humulene, caryophyllene=:cary, cohumulone=:cohumulone, myrcene=:myrcene, "
 				"hsi=:hsi, type=:type, form=:form, notes=:notes, origin=:origin, substitutes=:substitutes, "
 				"total_oil=:oil, uuid = :uuid");
-			    query.bindValue(":name", h->h_name);
-			    query.bindValue(":alpha", QString("%1").arg(h->h_alpha, 2, 'f', 1, '0'));
-			    query.bindValue(":beta", QString("%1").arg(h->h_beta, 2, 'f', 1, '0'));
-			    query.bindValue(":humulene", QString("%1").arg(h->h_humulene, 2, 'f', 1, '0'));
-			    query.bindValue(":cary", QString("%1").arg(h->h_caryophyllene, 2, 'f', 1, '0'));
-			    query.bindValue(":cohumulone", QString("%1").arg(h->h_cohumulone, 2, 'f', 1, '0'));
-			    query.bindValue(":myrcene", QString("%1").arg(h->h_myrcene, 2, 'f', 1, '0'));
-			    query.bindValue(":hsi", QString("%1").arg(h->h_hsi, 2, 'f', 1, '0'));
-			    query.bindValue(":type", h->h_type);
-			    query.bindValue(":form", h->h_form);
-			    query.bindValue(":notes", h->h_notes);
-			    query.bindValue(":origin", h->h_origin);
-			    query.bindValue(":substitutes", h->h_substitutes);
-			    query.bindValue(":oil", QString("%1").arg(h->h_total_oil, 2, 'f', 1, '0'));
+			    query.bindValue(":name", h->name);
+			    query.bindValue(":alpha", QString("%1").arg(h->alpha, 2, 'f', 1, '0'));
+			    query.bindValue(":beta", QString("%1").arg(h->beta, 2, 'f', 1, '0'));
+			    query.bindValue(":humulene", QString("%1").arg(h->humulene, 2, 'f', 1, '0'));
+			    query.bindValue(":cary", QString("%1").arg(h->caryophyllene, 2, 'f', 1, '0'));
+			    query.bindValue(":cohumulone", QString("%1").arg(h->cohumulone, 2, 'f', 1, '0'));
+			    query.bindValue(":myrcene", QString("%1").arg(h->myrcene, 2, 'f', 1, '0'));
+			    query.bindValue(":hsi", QString("%1").arg(h->hsi, 2, 'f', 1, '0'));
+			    query.bindValue(":type", h->type);
+			    query.bindValue(":form", h->form);
+			    query.bindValue(":notes", h->notes);
+			    query.bindValue(":origin", h->origin);
+			    query.bindValue(":substitutes", h->substitutes);
+			    query.bindValue(":oil", QString("%1").arg(h->total_oil, 2, 'f', 1, '0'));
 			    query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
 			    query.exec();
                             if (query.lastError().isValid()) {
@@ -544,64 +544,64 @@
 			    (xml->name() == "COST") || (xml->name() == "INVENTORY"))) {
                             // Ignore.
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NAME")) {
-			    h->h_name = xml->readElementText();
+			    h->name = xml->readElementText();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ORIGIN")) {
-                            h->h_origin = xml->readElementText();
+                            h->origin = xml->readElementText();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "NOTES")) {
-                            h->h_notes = xml->readElementText();
+                            h->notes = xml->readElementText();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "FORM")) {
 			    QString temp = xml->readElementText();
 			    if (temp == "Plug")
-				h->h_form = 1;
+				h->form = 1;
                             else if (temp == "Leaf")
-				h->h_form = 2;
+				h->form = 2;
                             else if (temp == "Leaf wet")
-				h->h_form = 3;
+				h->form = 3;
                             else if (temp == "Cryo")
-				h->h_form = 4;
+				h->form = 4;
 			    else
-				h->h_form = 0;
+				h->form = 0;
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "ALPHA")) {
-			    h->h_alpha = xml->readElementText().toDouble();
+			    h->alpha = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TYPE")) {
                             QString temp = xml->readElementText();
 			    if (temp == "Aroma")
-				h->h_type = 1;
+				h->type = 1;
 			    else if (temp == "Both")
-				h->h_type = 2;
+				h->type = 2;
 			    else
-				h->h_type = 0;
+				h->type = 0;
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "USE")) {
 			    QString temp = xml->readElementText();
 			    if (temp == "First wort")
-				h->h_useat = 1;
+				h->useat = 1;
 			    else if (temp == "Boil")
-				h->h_useat = 2;
+				h->useat = 2;
                             else if (temp == "Aroma")
-				h->h_useat = 3;
+				h->useat = 3;
                             else if (temp == "Whirlpool")
-				h->h_useat = 4;
+				h->useat = 4;
                             else if (temp == "Dry hop")
-				h->h_useat = 5;
+				h->useat = 5;
 			    else
-				h->h_useat = 0;
+				h->useat = 0;
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "BETA")) {
-                            h->h_beta = xml->readElementText().toDouble();
+                            h->beta = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HSI")) {
-                            h->h_hsi = xml->readElementText().toDouble();
+                            h->hsi = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "SUBSTITUTES")) {
-                            h->h_substitutes = xml->readElementText();
+                            h->substitutes = xml->readElementText();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "HUMULENE")) {
-                            h->h_humulene = xml->readElementText().toDouble();
+                            h->humulene = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && 
 			    ((xml->name() == "CARYOPHYLLENE") || (xml->name() == "CAROPHYLLENE"))) {
-                            h->h_caryophyllene = xml->readElementText().toDouble();
+                            h->caryophyllene = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "COHUMULONE")) {
-                            h->h_cohumulone = xml->readElementText().toDouble();
+                            h->cohumulone = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "MYRCENE")) {
-                            h->h_myrcene = xml->readElementText().toDouble();
+                            h->myrcene = xml->readElementText().toDouble();
 			} else if ((xml->tokenType() == QXmlStreamReader::StartElement) && (xml->name() == "TOTAL_OIL")) {
-                            h->h_total_oil = xml->readElementText().toDouble();
+                            h->total_oil = xml->readElementText().toDouble();
                         } else {
                             if (xml->tokenType() == QXmlStreamReader::StartElement)
                                 qDebug() << "2  " << xml->tokenType() << xml->name();

mercurial