bool Video::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFunction) { qWarning() << Q_FUNC_INFO << "Function node not found"; return false; } if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::Video)) { qWarning() << Q_FUNC_INFO << root.attribute(KXMLQLCFunctionType) << "is not Video"; return false; } QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCVideoSource) { if (tag.hasAttribute(KXMLQLCVideoStartTime)) setStartTime(tag.attribute(KXMLQLCVideoStartTime).toUInt()); if (tag.hasAttribute(KXMLQLCVideoColor)) setColor(QColor(tag.attribute(KXMLQLCVideoColor))); if (tag.hasAttribute(KXMLQLCVideoLocked)) setLocked(true); if (tag.hasAttribute(KXMLQLCVideoScreen)) setScreen(tag.attribute(KXMLQLCVideoScreen).toInt()); if (tag.hasAttribute(KXMLQLCVideoFullscreen)) { if (tag.attribute(KXMLQLCVideoFullscreen) == "1") setFullscreen(true); else setFullscreen(false); } if (tag.text().contains("://") == true) setSourceUrl(tag.text()); else setSourceUrl(m_doc->denormalizeComponentPath(tag.text())); } else if (tag.tagName() == KXMLQLCFunctionSpeed) { loadXMLSpeed(tag); } node = node.nextSibling(); } return true; }
bool Video::copyFrom(const Function* function) { const Video* vid = qobject_cast<const Video*> (function); if (vid == NULL) return false; setSourceUrl(vid->m_sourceUrl); m_videoDuration = vid->m_videoDuration; m_color = vid->m_color; return Function::copyFrom(function); }
bool Video::loadXML(QXmlStreamReader &root) { if (root.name() != KXMLQLCFunction) { qWarning() << Q_FUNC_INFO << "Function node not found"; return false; } if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::Video)) { qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not Video"; return false; } QString fname = name(); while (root.readNextStartElement()) { if (root.name() == KXMLQLCVideoSource) { QXmlStreamAttributes attrs = root.attributes(); if (attrs.hasAttribute(KXMLQLCVideoStartTime)) setStartTime(attrs.value(KXMLQLCVideoStartTime).toString().toUInt()); if (attrs.hasAttribute(KXMLQLCVideoColor)) setColor(QColor(attrs.value(KXMLQLCVideoColor).toString())); if (attrs.hasAttribute(KXMLQLCVideoLocked)) setLocked(true); if (attrs.hasAttribute(KXMLQLCVideoScreen)) setScreen(attrs.value(KXMLQLCVideoScreen).toString().toInt()); if (attrs.hasAttribute(KXMLQLCVideoFullscreen)) { if (attrs.value(KXMLQLCVideoFullscreen).toString() == "1") setFullscreen(true); else setFullscreen(false); } QString path = root.readElementText(); if (path.contains("://") == true) setSourceUrl(path); else setSourceUrl(m_doc->denormalizeComponentPath(path)); } else if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else if (root.name() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(root); } else { qWarning() << Q_FUNC_INFO << "Unknown Video tag:" << root.name(); root.skipCurrentElement(); } } setName(fname); return true; }