Skip to content

Commit

Permalink
Fix parsing of XML
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Dec 4, 2020
1 parent 2e7d5a8 commit 48be27b
Showing 1 changed file with 38 additions and 39 deletions.
77 changes: 38 additions & 39 deletions src/customlayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,53 +59,52 @@ struct CustomLayout {
borderWidth = _dom->attribute("borderWidth").toShort();
borderColor = _dom->attribute("borderColor").toUInt();
}

// inner nodes (since 2.2.1)
QDomNode node = _dom->firstChild();

if (!node.isNull())
else
{
// inner nodes (since 2.2.1)
QDomNode node = _dom->firstChild();

borderEnabled = false;
mainEnabled = false;
shadowEnabled = false;
variationEnabled = false;
}

while (!node.isNull())
{
if (node.isElement())
while (!node.isNull())
{
QDomElement element = node.toElement();

if (element.tagName() == "main")
{
mainEnabled = true;
mainRows = element.attribute("rows").toShort();
mainCols = element.attribute("cols").toShort();
mainPos = static_cast<UM::ALIGN>(element.attribute("pos").toInt());
}
else if (element.tagName() == "border")
{
borderEnabled = true;
borderWidth = element.attribute("width").toShort();
borderColor = QColor(element.attribute("color")).rgb();
}
else if (element.tagName() == "shadow")
{
shadowEnabled = true;
shadowWidth = element.attribute("width").toShort();
shadowColor = QColor(element.attribute("color")).rgb();
}
else if (element.tagName() == "variation")
{
variationEnabled = true;
angleVariation = element.attribute("angle").toDouble();
sizeVariation = element.attribute("size").toDouble();
posVariation = element.attribute("pos").toDouble();
}
if (node.isElement())
{
QDomElement element = node.toElement();

if (element.tagName() == "main")
{
mainEnabled = true;
mainRows = element.attribute("rows").toShort();
mainCols = element.attribute("cols").toShort();
mainPos = static_cast<UM::ALIGN>(element.attribute("pos").toInt());
}
else if (element.tagName() == "border")
{
borderEnabled = true;
borderWidth = element.attribute("width").toShort();
borderColor = QColor(element.attribute("color")).rgb();
}
else if (element.tagName() == "shadow")
{
shadowEnabled = true;
shadowWidth = element.attribute("width").toShort();
shadowColor = QColor(element.attribute("color")).rgb();
}
else if (element.tagName() == "variation")
{
variationEnabled = true;
angleVariation = element.attribute("angle").toDouble();
sizeVariation = element.attribute("size").toDouble();
posVariation = element.attribute("pos").toDouble();
}
}

node = node.nextSibling();
}

node = node.nextSibling();
}
}

Expand Down

0 comments on commit 48be27b

Please sign in to comment.