示例#1
0
文件: efx.cpp 项目: Unknownly/qlcplus
QStringList EFX::algorithmList()
{
    QStringList list;
    list << algorithmToString(EFX::Circle);
    list << algorithmToString(EFX::Eight);
    list << algorithmToString(EFX::Line);
    list << algorithmToString(EFX::Diamond);
    list << algorithmToString(EFX::Lissajous);
    return list;
}
示例#2
0
文件: efx.cpp 项目: Unknownly/qlcplus
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(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);

    /* 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);

    /********************************************
     * 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;
}
示例#3
0
文件: efx.cpp 项目: fourbytes/qlcplus
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;
}