| 1294 | } |
| 1295 | |
| 1296 | bool InfoElement::load(XmlStreamReader* reader, bool preview) { |
| 1297 | if (!readBasicAttributes(reader)) |
| 1298 | return false; |
| 1299 | |
| 1300 | Q_D(InfoElement); |
| 1301 | |
| 1302 | QXmlStreamAttributes attribs; |
| 1303 | QString str; |
| 1304 | |
| 1305 | while (!reader->atEnd()) { |
| 1306 | reader->readNext(); |
| 1307 | if (reader->isEndElement() && reader->name() == QLatin1String("infoElement")) |
| 1308 | break; |
| 1309 | |
| 1310 | if (!reader->isStartElement()) |
| 1311 | continue; |
| 1312 | |
| 1313 | if (!preview && reader->name() == QLatin1String("comment")) { |
| 1314 | if (!readCommentElement(reader)) |
| 1315 | return false; |
| 1316 | } else if (reader->name() == QLatin1String("general")) { |
| 1317 | attribs = reader->attributes(); |
| 1318 | |
| 1319 | READ_INT_VALUE_DIRECT("plotRangeIndex", m_cSystemIndex, int); |
| 1320 | |
| 1321 | str = attribs.value(QStringLiteral("visible")).toString(); |
| 1322 | if (str.isEmpty()) |
| 1323 | reader->raiseMissingAttributeWarning(QStringLiteral("x")); |
| 1324 | else |
| 1325 | setVisible(str.toInt()); |
| 1326 | |
| 1327 | READ_DOUBLE_VALUE("position", positionLogical); |
| 1328 | READ_INT_VALUE("gluePointIndex", gluePointIndex, int); |
| 1329 | READ_INT_VALUE("markerIndex", m_index, int); |
| 1330 | READ_STRING_VALUE("curve", connectionLineCurveName); |
| 1331 | } else if (reader->name() == QLatin1String("verticalLine")) { |
| 1332 | d->verticalLine->load(reader, preview); |
| 1333 | } else if (reader->name() == QLatin1String("connectionLine")) { |
| 1334 | d->connectionLine->load(reader, preview); |
| 1335 | } else if (reader->name() == QLatin1String("textLabel")) { |
| 1336 | if (!m_title) { |
| 1337 | m_title = new TextLabel(i18n("Label"), d->m_plot); |
| 1338 | m_title->setIsLoading(true); |
| 1339 | this->addChild(m_title); |
| 1340 | } |
| 1341 | if (!m_title->load(reader, preview)) |
| 1342 | return false; |
| 1343 | } else if (reader->name() == QLatin1String("points")) { |
| 1344 | loadPoints(reader, preview); |
| 1345 | } else { // unknown element |
| 1346 | reader->raiseUnknownElementWarning(); |
| 1347 | if (!reader->skipToEndElement()) |
| 1348 | return false; |
| 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | return true; |
| 1353 | } |
no test coverage detected