bool Cue::loadXML(QXmlStreamReader &root) { qDebug() << Q_FUNC_INFO; if (root.name() != KXMLQLCCue) { qWarning() << Q_FUNC_INFO << "Cue node not found"; return false; } setName(root.attributes().value(KXMLQLCCueName).toString()); while (root.readNextStartElement()) { if (root.name() == KXMLQLCCueValue) { QString ch = root.attributes().value(KXMLQLCCueValueChannel).toString(); QString val = root.readElementText(); if (ch.isEmpty() == false && val.isEmpty() == false) setValue(ch.toUInt(), uchar(val.toUInt())); } else if (root.name() == KXMLQLCCueSpeed) { loadXMLSpeed(root); } else { qWarning() << Q_FUNC_INFO << "Unrecognized Cue tag:" << root.name(); root.skipCurrentElement(); } } return true; }
bool RGBMatrix::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFunction) { qWarning() << Q_FUNC_INFO << "Function node not found"; return false; } if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::RGBMatrix)) { qWarning() << Q_FUNC_INFO << "Function is not an RGB matrix"; return false; } /* Load matrix contents */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCFunctionSpeed) { loadXMLSpeed(tag); } else if (tag.tagName() == KXMLQLCRGBAlgorithm) { setAlgorithm(RGBAlgorithm::loader(doc(), tag)); } else if (tag.tagName() == KXMLQLCRGBMatrixFixtureGroup) { setFixtureGroup(tag.text().toUInt()); } else if (tag.tagName() == KXMLQLCFunctionDirection) { loadXMLDirection(tag); } else if (tag.tagName() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(tag); } else if (tag.tagName() == KXMLQLCRGBMatrixStartColor) { setStartColor(QColor::fromRgb(QRgb(tag.text().toUInt()))); } else if (tag.tagName() == KXMLQLCRGBMatrixEndColor) { setEndColor(QColor::fromRgb(QRgb(tag.text().toUInt()))); } else { qWarning() << Q_FUNC_INFO << "Unknown RGB matrix tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
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 Audio::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::Audio)) { qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not Audio"; return false; } QString fname = name(); while (root.readNextStartElement()) { if (root.name() == KXMLQLCAudioSource) { QXmlStreamAttributes attrs = root.attributes(); if (attrs.hasAttribute(KXMLQLCAudioDevice)) setAudioDevice(attrs.value(KXMLQLCAudioDevice).toString()); if (attrs.hasAttribute(KXMLQLCAudioStartTime)) setStartTime(attrs.value(KXMLQLCAudioStartTime).toString().toUInt()); if (attrs.hasAttribute(KXMLQLCAudioColor)) setColor(QColor(attrs.value(KXMLQLCAudioColor).toString())); if (attrs.hasAttribute(KXMLQLCAudioLocked)) setLocked(true); setSourceFileName(m_doc->denormalizeComponentPath(root.readElementText())); } else if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else { qWarning() << Q_FUNC_INFO << "Unknown Audio tag:" << root.name(); root.skipCurrentElement(); } } setName(fname); return true; }
bool Script::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFunction) { qWarning() << Q_FUNC_INFO << "Function node not found"; return false; } if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::Script)) { qWarning() << Q_FUNC_INFO << root.attribute(KXMLQLCFunctionType) << "is not a script"; return false; } /* Load script contents */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCFunctionSpeed) { loadXMLSpeed(tag); } else if (tag.tagName() == KXMLQLCFunctionDirection) { loadXMLDirection(tag); } else if (tag.tagName() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(tag); } else if (tag.tagName() == KXMLQLCScriptContents) { setData(QUrl::fromPercentEncoding(tag.text().toUtf8())); } else { qWarning() << Q_FUNC_INFO << "Unknown script tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
bool EFX::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFunction) { qWarning() << "Function node not found!"; return false; } if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::EFX)) { qWarning("Function is not an EFX!"); return false; } /* Load EFX contents */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCBus) { /* Bus */ QString str = tag.attribute(KXMLQLCBusRole); if (str == KXMLQLCBusFade) m_legacyFadeBus = tag.text().toUInt(); else if (str == KXMLQLCBusHold) m_legacyHoldBus = tag.text().toUInt(); } else if (tag.tagName() == KXMLQLCFunctionSpeed) { loadXMLSpeed(tag); } else if (tag.tagName() == KXMLQLCEFXFixture) { EFXFixture* ef = new EFXFixture(this); ef->loadXML(tag); if (ef->fixture() != Fixture::invalidId()) { if (addFixture(ef) == false) delete ef; } } else if (tag.tagName() == KXMLQLCEFXPropagationMode) { /* Propagation mode */ setPropagationMode(stringToPropagationMode(tag.text())); } else if (tag.tagName() == KXMLQLCEFXAlgorithm) { /* Algorithm */ setAlgorithm(stringToAlgorithm(tag.text())); } else if (tag.tagName() == KXMLQLCFunctionDirection) { loadXMLDirection(tag); } else if (tag.tagName() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(tag); } else if (tag.tagName() == KXMLQLCEFXWidth) { /* Width */ setWidth(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXHeight) { /* Height */ setHeight(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXRotation) { /* Rotation */ setRotation(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXStartOffset) { /* StartOffset */ setStartOffset(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXAxis) { /* Axes */ loadXMLAxis(tag); } else { qWarning() << "Unknown EFX tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
bool EFX::loadXML(QXmlStreamReader &root) { if (root.name() != KXMLQLCFunction) { qWarning() << "Function node not found!"; return false; } if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::EFX)) { qWarning("Function is not an EFX!"); return false; } /* Load EFX contents */ while (root.readNextStartElement()) { if (root.name() == KXMLQLCBus) { /* Bus */ QString str = root.attributes().value(KXMLQLCBusRole).toString(); if (str == KXMLQLCBusFade) m_legacyFadeBus = root.readElementText().toUInt(); else if (str == KXMLQLCBusHold) m_legacyHoldBus = root.readElementText().toUInt(); } else if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else if (root.name() == KXMLQLCEFXFixture) { EFXFixture* ef = new EFXFixture(this); ef->loadXML(root); if (ef->head().isValid()) { if (addFixture(ef) == false) delete ef; } } else if (root.name() == KXMLQLCEFXPropagationMode) { /* Propagation mode */ setPropagationMode(stringToPropagationMode(root.readElementText())); } else if (root.name() == KXMLQLCEFXAlgorithm) { /* Algorithm */ setAlgorithm(stringToAlgorithm(root.readElementText())); } else if (root.name() == KXMLQLCFunctionDirection) { loadXMLDirection(root); } else if (root.name() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(root); } else if (root.name() == KXMLQLCEFXWidth) { /* Width */ setWidth(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXHeight) { /* Height */ setHeight(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXRotation) { /* Rotation */ setRotation(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXStartOffset) { /* StartOffset */ setStartOffset(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXIsRelative) { /* IsRelative */ setIsRelative(root.readElementText().toInt() != 0); } else if (root.name() == KXMLQLCEFXAxis) { /* Axes */ loadXMLAxis(root); } else { qWarning() << "Unknown EFX tag:" << root.name(); root.skipCurrentElement(); } } return true; }
bool Chaser::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFunction) { qWarning() << Q_FUNC_INFO << "Function node not found"; return false; } if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::Chaser)) { qWarning() << Q_FUNC_INFO << root.attribute(KXMLQLCFunctionType) << "is not a chaser"; return false; } /* Load chaser contents */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCBus) { m_legacyHoldBus = tag.text().toUInt(); } else if (tag.tagName() == KXMLQLCFunctionSpeed) { loadXMLSpeed(tag); } else if (tag.tagName() == KXMLQLCFunctionDirection) { loadXMLDirection(tag); } else if (tag.tagName() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(tag); } else if (tag.tagName() == KXMLQLCChaserSpeedModes) { QString str; str = tag.attribute(KXMLQLCFunctionSpeedFadeIn); setFadeInMode(stringToSpeedMode(str)); str = tag.attribute(KXMLQLCFunctionSpeedFadeOut); setFadeOutMode(stringToSpeedMode(str)); str = tag.attribute(KXMLQLCFunctionSpeedDuration); setDurationMode(stringToSpeedMode(str)); } else if (tag.tagName() == KXMLQLCChaserSequenceTag) { QString str = tag.attribute(KXMLQLCChaserSequenceBoundScene); enableSequenceMode(str.toUInt()); if (tag.hasAttribute(KXMLQLCChaserSequenceStartTime)) setStartTime(tag.attribute(KXMLQLCChaserSequenceStartTime).toUInt()); if (tag.hasAttribute(KXMLQLCChaserSequenceColor)) setColor(QColor(tag.attribute(KXMLQLCChaserSequenceColor))); if (tag.hasAttribute(KXMLQLCChaserSequenceLocked)) setLocked(true); } else if (tag.tagName() == KXMLQLCFunctionStep) { //! @todo stepNumber is useless if the steps are in the wrong order ChaserStep step; int stepNumber = -1; if (step.loadXML(tag, stepNumber) == true) { if (isSequence() == true) step.fid = getBoundSceneID(); if (stepNumber >= m_steps.size()) m_steps.append(step); else m_steps.insert(stepNumber, step); } } else { qWarning() << Q_FUNC_INFO << "Unknown chaser tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
bool RGBMatrix::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::RGBMatrixType)) { qWarning() << Q_FUNC_INFO << "Function is not an RGB matrix"; return false; } /* Load matrix contents */ while (root.readNextStartElement()) { if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else if (root.name() == KXMLQLCRGBAlgorithm) { setAlgorithm(RGBAlgorithm::loader(doc(), root)); } else if (root.name() == KXMLQLCRGBMatrixFixtureGroup) { setFixtureGroup(root.readElementText().toUInt()); } else if (root.name() == KXMLQLCFunctionDirection) { loadXMLDirection(root); } else if (root.name() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(root); } else if (root.name() == KXMLQLCRGBMatrixStartColor) { setStartColor(QColor::fromRgb(QRgb(root.readElementText().toUInt()))); } else if (root.name() == KXMLQLCRGBMatrixEndColor) { setEndColor(QColor::fromRgb(QRgb(root.readElementText().toUInt()))); } else if (root.name() == KXMLQLCRGBMatrixProperty) { QString name = root.attributes().value(KXMLQLCRGBMatrixPropertyName).toString(); QString value = root.attributes().value(KXMLQLCRGBMatrixPropertyValue).toString(); setProperty(name, value); root.skipCurrentElement(); } else if (root.name() == KXMLQLCRGBMatrixDimmerControl) { setDimmerControl(root.readElementText().toInt()); } else { qWarning() << Q_FUNC_INFO << "Unknown RGB matrix tag:" << root.name(); root.skipCurrentElement(); } } return true; }
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; }
bool Chaser::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::ChaserType)) { qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a Chaser"; return false; } /* Load chaser contents */ while (root.readNextStartElement()) { if (root.name() == KXMLQLCBus) { m_legacyHoldBus = root.readElementText().toUInt(); } else if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else if (root.name() == KXMLQLCFunctionDirection) { loadXMLDirection(root); } else if (root.name() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(root); } else if (root.name() == KXMLQLCChaserSpeedModes) { loadXMLSpeedModes(root); } else if (root.name() == KXMLQLCFunctionStep) { //! @todo stepNumber is useless if the steps are in the wrong order ChaserStep step; int stepNumber = -1; if (step.loadXML(root, stepNumber, doc()) == true) { if (stepNumber >= m_steps.size()) m_steps.append(step); else m_steps.insert(stepNumber, step); } } else if (root.name() == "Sequence") { doc()->appendToErrorLog(QString("<b>Unsupported sequences found</b>. Please convert your project " "at <a href=http://www.qlcplus.org/sequence_migration.php>http://www.qlcplus.org/sequence_migration.php</a>")); root.skipCurrentElement(); } else { qWarning() << Q_FUNC_INFO << "Unknown chaser tag:" << root.name(); root.skipCurrentElement(); } } return true; }
bool Chaser::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::Chaser)) { qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a chaser"; return false; } /* Load chaser contents */ while (root.readNextStartElement()) { if (root.name() == KXMLQLCBus) { m_legacyHoldBus = root.readElementText().toUInt(); } else if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else if (root.name() == KXMLQLCFunctionDirection) { loadXMLDirection(root); } else if (root.name() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(root); } else if (root.name() == KXMLQLCChaserSpeedModes) { QXmlStreamAttributes attrs = root.attributes(); QString str; str = attrs.value(KXMLQLCFunctionSpeedFadeIn).toString(); setFadeInMode(stringToSpeedMode(str)); str = attrs.value(KXMLQLCFunctionSpeedFadeOut).toString(); setFadeOutMode(stringToSpeedMode(str)); str = attrs.value(KXMLQLCFunctionSpeedDuration).toString(); setDurationMode(stringToSpeedMode(str)); root.skipCurrentElement(); } else if (root.name() == KXMLQLCChaserSequenceTag) { QXmlStreamAttributes attrs = root.attributes(); QString str = attrs.value(KXMLQLCChaserSequenceBoundScene).toString(); enableSequenceMode(str.toUInt()); if (attrs.hasAttribute(KXMLQLCChaserSequenceStartTime)) setStartTime(attrs.value(KXMLQLCChaserSequenceStartTime).toString().toUInt()); if (attrs.hasAttribute(KXMLQLCChaserSequenceColor)) setColor(QColor(attrs.value(KXMLQLCChaserSequenceColor).toString())); if (attrs.hasAttribute(KXMLQLCChaserSequenceLocked)) setLocked(true); root.skipCurrentElement(); } else if (root.name() == KXMLQLCFunctionStep) { //! @todo stepNumber is useless if the steps are in the wrong order ChaserStep step; int stepNumber = -1; if (step.loadXML(root, stepNumber) == true) { if (isSequence() == true) step.fid = getBoundSceneID(); if (stepNumber >= m_steps.size()) m_steps.append(step); else m_steps.insert(stepNumber, step); } } else { qWarning() << Q_FUNC_INFO << "Unknown chaser tag:" << root.name(); root.skipCurrentElement(); } } return true; }