Skip to content

Commit 48be27b

Browse files
committed
Fix parsing of XML
1 parent 2e7d5a8 commit 48be27b

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

src/customlayout.h

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -59,53 +59,52 @@ struct CustomLayout {
5959
borderWidth = _dom->attribute("borderWidth").toShort();
6060
borderColor = _dom->attribute("borderColor").toUInt();
6161
}
62-
63-
// inner nodes (since 2.2.1)
64-
QDomNode node = _dom->firstChild();
65-
66-
if (!node.isNull())
62+
else
6763
{
64+
// inner nodes (since 2.2.1)
65+
QDomNode node = _dom->firstChild();
66+
6867
borderEnabled = false;
6968
mainEnabled = false;
7069
shadowEnabled = false;
7170
variationEnabled = false;
72-
}
7371

74-
while (!node.isNull())
75-
{
76-
if (node.isElement())
72+
while (!node.isNull())
7773
{
78-
QDomElement element = node.toElement();
79-
80-
if (element.tagName() == "main")
81-
{
82-
mainEnabled = true;
83-
mainRows = element.attribute("rows").toShort();
84-
mainCols = element.attribute("cols").toShort();
85-
mainPos = static_cast<UM::ALIGN>(element.attribute("pos").toInt());
86-
}
87-
else if (element.tagName() == "border")
88-
{
89-
borderEnabled = true;
90-
borderWidth = element.attribute("width").toShort();
91-
borderColor = QColor(element.attribute("color")).rgb();
92-
}
93-
else if (element.tagName() == "shadow")
94-
{
95-
shadowEnabled = true;
96-
shadowWidth = element.attribute("width").toShort();
97-
shadowColor = QColor(element.attribute("color")).rgb();
98-
}
99-
else if (element.tagName() == "variation")
100-
{
101-
variationEnabled = true;
102-
angleVariation = element.attribute("angle").toDouble();
103-
sizeVariation = element.attribute("size").toDouble();
104-
posVariation = element.attribute("pos").toDouble();
105-
}
74+
if (node.isElement())
75+
{
76+
QDomElement element = node.toElement();
77+
78+
if (element.tagName() == "main")
79+
{
80+
mainEnabled = true;
81+
mainRows = element.attribute("rows").toShort();
82+
mainCols = element.attribute("cols").toShort();
83+
mainPos = static_cast<UM::ALIGN>(element.attribute("pos").toInt());
84+
}
85+
else if (element.tagName() == "border")
86+
{
87+
borderEnabled = true;
88+
borderWidth = element.attribute("width").toShort();
89+
borderColor = QColor(element.attribute("color")).rgb();
90+
}
91+
else if (element.tagName() == "shadow")
92+
{
93+
shadowEnabled = true;
94+
shadowWidth = element.attribute("width").toShort();
95+
shadowColor = QColor(element.attribute("color")).rgb();
96+
}
97+
else if (element.tagName() == "variation")
98+
{
99+
variationEnabled = true;
100+
angleVariation = element.attribute("angle").toDouble();
101+
sizeVariation = element.attribute("size").toDouble();
102+
posVariation = element.attribute("pos").toDouble();
103+
}
104+
}
105+
106+
node = node.nextSibling();
106107
}
107-
108-
node = node.nextSibling();
109108
}
110109
}
111110

0 commit comments

Comments
 (0)