bool EFXFixture::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCEFXFixture) { qWarning("EFX Fixture node not found!"); return false; } GroupHead head; head.head = 0; /* New file format contains sub tags */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCEFXFixtureID) { /* Fixture ID */ head.fxi = tag.text().toInt(); } else if (tag.tagName() == KXMLQLCEFXFixtureHead) { /* Fixture Head */ head.head = tag.text().toInt(); } else if (tag.tagName() == KXMLQLCEFXFixtureMode) { /* Fixture Mode */ setMode ((Mode) tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXFixtureDirection) { /* Direction */ Function::Direction dir = Function::stringToDirection(tag.text()); setDirection(dir); } else if (tag.tagName() == KXMLQLCEFXFixtureStartOffset) { /* Start offset */ setStartOffset(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXFixtureIntensity) { /* Intensity */ setFadeIntensity(uchar(tag.text().toUInt())); } else { qWarning() << "Unknown EFX Fixture tag:" << tag.tagName(); } node = node.nextSibling(); } if (head.fxi != Fixture::invalidId()) setHead(head); return true; }
void K3b::AudioDataSource::fixupOffsets() { // no length available yet if( originalLength() == 0 ) return; if( startOffset() >= originalLength() ) { setStartOffset( 0 ); } if( endOffset() > originalLength() ) { setEndOffset( 0 ); // whole source } if( endOffset() > 0 && endOffset() <= startOffset() ) { setEndOffset( startOffset() ); } }
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; }