Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfPage.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 100 | { | |||
---|---|---|---|---|---|
103 | while(xmlReader->readNextStartElement()) | 103 | while(xmlReader->readNextStartElement()) | ||
104 | { | 104 | { | ||
105 | if(xmlReader->name() == QStringLiteral("title")) | 105 | if(xmlReader->name() == QStringLiteral("title")) | ||
106 | { | 106 | { | ||
107 | d->title[xmlReader->attributes().value(QStringLiteral("lang")).toString()] = xmlReader->readElementText(); | 107 | d->title[xmlReader->attributes().value(QStringLiteral("lang")).toString()] = xmlReader->readElementText(); | ||
108 | } | 108 | } | ||
109 | else if(xmlReader->name() == QStringLiteral("image")) | 109 | else if(xmlReader->name() == QStringLiteral("image")) | ||
110 | { | 110 | { | ||
111 | setImageHref(xmlReader->attributes().value(QStringLiteral("href")).toString()); | 111 | /** | ||
112 | * There are some acbf files out there that have backslashes in their | ||||
113 | * image href. This is probably a mistake from windows users, but not proper XML. | ||||
114 | * We should thus replace those with forward slashes so the image can be loaded. | ||||
115 | */ | ||||
116 | QString href = xmlReader->attributes().value(QStringLiteral("href")).toString(); | ||||
117 | setImageHref(href.replace(QStringLiteral("\\"), QStringLiteral("/"))); | ||||
112 | xmlReader->skipCurrentElement(); | 118 | xmlReader->skipCurrentElement(); | ||
113 | } | 119 | } | ||
114 | else if(xmlReader->name() == QStringLiteral("text-layer")) | 120 | else if(xmlReader->name() == QStringLiteral("text-layer")) | ||
115 | { | 121 | { | ||
116 | Textlayer* newLayer = new Textlayer(this); | 122 | Textlayer* newLayer = new Textlayer(this); | ||
117 | if(!newLayer->fromXml(xmlReader)) { | 123 | if(!newLayer->fromXml(xmlReader)) { | ||
118 | return false; | 124 | return false; | ||
119 | } | 125 | } | ||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |