bool EFX::saveXML(QXmlStreamWriter *doc) { Q_ASSERT(doc != NULL); /* Function tag */ doc->writeStartElement(KXMLQLCFunction); /* Common attributes */ saveXMLCommon(doc); /* Fixtures */ QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) it.next()->saveXML(doc); /* Propagation mode */ doc->writeTextElement(KXMLQLCEFXPropagationMode, propagationModeToString(m_propagationMode)); /* Speeds */ saveXMLSpeed(doc); /* Direction */ saveXMLDirection(doc); /* Run order */ saveXMLRunOrder(doc); /* Algorithm */ doc->writeTextElement(KXMLQLCEFXAlgorithm, algorithmToString(algorithm())); /* Width */ doc->writeTextElement(KXMLQLCEFXWidth, QString::number(width())); /* Height */ doc->writeTextElement(KXMLQLCEFXHeight, QString::number(height())); /* Rotation */ doc->writeTextElement(KXMLQLCEFXRotation, QString::number(rotation())); /* StartOffset */ doc->writeTextElement(KXMLQLCEFXStartOffset, QString::number(startOffset())); /* IsRelative */ doc->writeTextElement(KXMLQLCEFXIsRelative, QString::number(isRelative() ? 1 : 0)); /******************************************** * X-Axis ********************************************/ doc->writeStartElement(KXMLQLCEFXAxis); doc->writeAttribute(KXMLQLCFunctionName, KXMLQLCEFXX); /* Offset */ doc->writeTextElement(KXMLQLCEFXOffset, QString::number(xOffset())); /* Frequency */ doc->writeTextElement(KXMLQLCEFXFrequency, QString::number(xFrequency())); /* Phase */ doc->writeTextElement(KXMLQLCEFXPhase, QString::number(xPhase())); /* End the (X) <Axis> tag */ doc->writeEndElement(); /******************************************** * Y-Axis ********************************************/ doc->writeStartElement(KXMLQLCEFXAxis); doc->writeAttribute(KXMLQLCFunctionName, KXMLQLCEFXY); /* Offset */ doc->writeTextElement(KXMLQLCEFXOffset, QString::number(yOffset())); /* Frequency */ doc->writeTextElement(KXMLQLCEFXFrequency, QString::number(yFrequency())); /* Phase */ doc->writeTextElement(KXMLQLCEFXPhase, QString::number(yPhase())); /* End the (Y) <Axis> tag */ doc->writeEndElement(); /* End the <Function> tag */ doc->writeEndElement(); return true; }
/** * Save the function's contents to an XML document * * @param doc The QDomDocument to save to */ bool EFX::saveXML(QDomDocument* doc, QDomElement* wksp_root) { QDomElement root; QDomElement tag; QDomElement subtag; QDomText text; QString str; Q_ASSERT(doc != NULL); Q_ASSERT(wksp_root != NULL); /* Function tag */ root = doc->createElement(KXMLQLCFunction); wksp_root->appendChild(root); root.setAttribute(KXMLQLCFunctionID, id()); root.setAttribute(KXMLQLCFunctionType, Function::typeToString(m_type)); root.setAttribute(KXMLQLCFunctionName, name()); /* Fixtures */ QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) it.next()->saveXML(doc, &root); /* Propagation mode */ tag = doc->createElement(KXMLQLCEFXPropagationMode); root.appendChild(tag); text = doc->createTextNode(propagationModeToString(m_propagationMode)); tag.appendChild(text); /* Speed bus */ tag = doc->createElement(KXMLQLCBus); root.appendChild(tag); tag.setAttribute(KXMLQLCBusRole, KXMLQLCBusFade); str.setNum(busID()); text = doc->createTextNode(str); tag.appendChild(text); /* Direction */ tag = doc->createElement(KXMLQLCFunctionDirection); root.appendChild(tag); text = doc->createTextNode(Function::directionToString(m_direction)); tag.appendChild(text); /* Run order */ tag = doc->createElement(KXMLQLCFunctionRunOrder); root.appendChild(tag); text = doc->createTextNode(Function::runOrderToString(m_runOrder)); tag.appendChild(text); /* Algorithm */ tag = doc->createElement(KXMLQLCEFXAlgorithm); root.appendChild(tag); text = doc->createTextNode(algorithm()); tag.appendChild(text); /* Width */ tag = doc->createElement(KXMLQLCEFXWidth); root.appendChild(tag); str.setNum(width()); text = doc->createTextNode(str); tag.appendChild(text); /* Height */ tag = doc->createElement(KXMLQLCEFXHeight); root.appendChild(tag); str.setNum(height()); text = doc->createTextNode(str); tag.appendChild(text); /* Rotation */ tag = doc->createElement(KXMLQLCEFXRotation); root.appendChild(tag); str.setNum(rotation()); text = doc->createTextNode(str); tag.appendChild(text); /* Start function */ tag = doc->createElement(KXMLQLCEFXStartScene); root.appendChild(tag); str.setNum(startScene()); text = doc->createTextNode(str); tag.appendChild(text); if (startSceneEnabled() == true) tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCTrue); else tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCFalse); /* Stop function */ tag = doc->createElement(KXMLQLCEFXStopScene); root.appendChild(tag); str.setNum(stopScene()); text = doc->createTextNode(str); tag.appendChild(text); if (stopSceneEnabled() == true) tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCTrue); else tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCFalse); /******************************************** * X-Axis ********************************************/ tag = doc->createElement(KXMLQLCEFXAxis); root.appendChild(tag); tag.setAttribute(KXMLQLCFunctionName, KXMLQLCEFXX); /* Offset */ subtag = doc->createElement(KXMLQLCEFXOffset); tag.appendChild(subtag); str.setNum(xOffset()); text = doc->createTextNode(str); subtag.appendChild(text); /* Frequency */ subtag = doc->createElement(KXMLQLCEFXFrequency); tag.appendChild(subtag); str.setNum(xFrequency()); text = doc->createTextNode(str); subtag.appendChild(text); /* Phase */ subtag = doc->createElement(KXMLQLCEFXPhase); tag.appendChild(subtag); str.setNum(xPhase()); text = doc->createTextNode(str); subtag.appendChild(text); /******************************************** * Y-Axis ********************************************/ tag = doc->createElement(KXMLQLCEFXAxis); root.appendChild(tag); tag.setAttribute(KXMLQLCFunctionName, KXMLQLCEFXY); /* Offset */ subtag = doc->createElement(KXMLQLCEFXOffset); tag.appendChild(subtag); str.setNum(yOffset()); text = doc->createTextNode(str); subtag.appendChild(text); /* Frequency */ subtag = doc->createElement(KXMLQLCEFXFrequency); tag.appendChild(subtag); str.setNum(yFrequency()); text = doc->createTextNode(str); subtag.appendChild(text); /* Phase */ subtag = doc->createElement(KXMLQLCEFXPhase); tag.appendChild(subtag); str.setNum(yPhase()); text = doc->createTextNode(str); subtag.appendChild(text); return true; }
bool EFX::saveXML(QDomDocument* doc, QDomElement* wksp_root) { QDomElement root; QDomElement tag; QDomElement subtag; QDomText text; QString str; Q_ASSERT(doc != NULL); Q_ASSERT(wksp_root != NULL); /* Function tag */ root = doc->createElement(KXMLQLCFunction); wksp_root->appendChild(root); /* Common attributes */ saveXMLCommon(&root); /* Fixtures */ QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) it.next()->saveXML(doc, &root); /* Propagation mode */ tag = doc->createElement(KXMLQLCEFXPropagationMode); root.appendChild(tag); text = doc->createTextNode(propagationModeToString(m_propagationMode)); tag.appendChild(text); /* Speeds */ saveXMLSpeed(doc, &root); /* Direction */ saveXMLDirection(doc, &root); /* Run order */ saveXMLRunOrder(doc, &root); /* Algorithm */ tag = doc->createElement(KXMLQLCEFXAlgorithm); root.appendChild(tag); text = doc->createTextNode(algorithmToString(algorithm())); tag.appendChild(text); /* Width */ tag = doc->createElement(KXMLQLCEFXWidth); root.appendChild(tag); str.setNum(width()); text = doc->createTextNode(str); tag.appendChild(text); /* Height */ tag = doc->createElement(KXMLQLCEFXHeight); root.appendChild(tag); str.setNum(height()); text = doc->createTextNode(str); tag.appendChild(text); /* Rotation */ tag = doc->createElement(KXMLQLCEFXRotation); root.appendChild(tag); str.setNum(rotation()); text = doc->createTextNode(str); tag.appendChild(text); /* StartOffset */ tag = doc->createElement(KXMLQLCEFXStartOffset); root.appendChild(tag); str.setNum(startOffset()); text = doc->createTextNode(str); tag.appendChild(text); /* IsRelative */ tag = doc->createElement(KXMLQLCEFXIsRelative); root.appendChild(tag); str.setNum(isRelative() ? 1 : 0); text = doc->createTextNode(str); tag.appendChild(text); /******************************************** * X-Axis ********************************************/ tag = doc->createElement(KXMLQLCEFXAxis); root.appendChild(tag); tag.setAttribute(KXMLQLCFunctionName, KXMLQLCEFXX); /* Offset */ subtag = doc->createElement(KXMLQLCEFXOffset); tag.appendChild(subtag); str.setNum(xOffset()); text = doc->createTextNode(str); subtag.appendChild(text); /* Frequency */ subtag = doc->createElement(KXMLQLCEFXFrequency); tag.appendChild(subtag); str.setNum(xFrequency()); text = doc->createTextNode(str); subtag.appendChild(text); /* Phase */ subtag = doc->createElement(KXMLQLCEFXPhase); tag.appendChild(subtag); str.setNum(xPhase()); text = doc->createTextNode(str); subtag.appendChild(text); /******************************************** * Y-Axis ********************************************/ tag = doc->createElement(KXMLQLCEFXAxis); root.appendChild(tag); tag.setAttribute(KXMLQLCFunctionName, KXMLQLCEFXY); /* Offset */ subtag = doc->createElement(KXMLQLCEFXOffset); tag.appendChild(subtag); str.setNum(yOffset()); text = doc->createTextNode(str); subtag.appendChild(text); /* Frequency */ subtag = doc->createElement(KXMLQLCEFXFrequency); tag.appendChild(subtag); str.setNum(yFrequency()); text = doc->createTextNode(str); subtag.appendChild(text); /* Phase */ subtag = doc->createElement(KXMLQLCEFXPhase); tag.appendChild(subtag); str.setNum(yPhase()); text = doc->createTextNode(str); subtag.appendChild(text); return true; }