Beispiel #1
0
 void Parser::xmlElement(XmlContext* ctx)
 {
     xmlTagName(ctx);
     if (T0 != T_XmlRightAngle && T0 != T_XmlSlashRightAngle) {
         ctx->addText(" ");
         xmlAttributes(ctx);
     }
     if (T0 == T_XmlRightAngle) {
         xmlAssert(ctx, T0);
         xmlElementContent(ctx);
         xmlAssert(ctx, T_XmlLeftAngleSlash);
         xmlAtomSkipSpace();
         xmlTagName(ctx);
         xmlAssert(ctx, T_XmlRightAngle);
     }
     else
         xmlAssert(ctx, T_XmlSlashRightAngle);
 }
Beispiel #2
0
bool VCFrame::saveXML(QDomDocument* doc, QDomElement* vc_root)
{
    QDomElement root;
    QDomElement tag;
    QDomText text;
    QString str;

    Q_ASSERT(doc != NULL);
    Q_ASSERT(vc_root != NULL);

    /* VC Frame entry */
    root = doc->createElement(xmlTagName());
    vc_root->appendChild(root);

    /* Caption */
    root.setAttribute(KXMLQLCVCCaption, caption());

    /* Save appearance */
    saveXMLAppearance(doc, &root);

    /* Save widget proportions only for child frames */
    if (isBottomFrame() == false)
        saveXMLWindowState(doc, &root);

    /* Save children */
    QListIterator <VCWidget*> it(findChildren<VCWidget*>());
    while (it.hasNext() == true)
    {
        VCWidget* widget = it.next();

        /* findChildren() is recursive, so the list contains all
           possible child widgets below this frame. Each frame must
           save only its direct children to preserve hierarchy, so
           save only such widgets that have this widget as their
           direct parent. */
        if (widget->parentWidget() == this)
            widget->saveXML(doc, &root);
    }

    return true;
}
Beispiel #3
0
bool VCFrame::loadXML(const QDomElement* root)
{
    bool visible = false;
    int x = 0;
    int y = 0;
    int w = 0;
    int h = 0;

    QDomNode node;
    QDomElement tag;
    QString str;

    Q_ASSERT(root != NULL);

    if (root->tagName() != xmlTagName())
    {
        qWarning() << Q_FUNC_INFO << "Frame node not found";
        return false;
    }

    /* Caption */
    setCaption(root->attribute(KXMLQLCVCCaption));

    /* Children */
    node = root->firstChild();
    while (node.isNull() == false)
    {
        tag = node.toElement();
        if (tag.tagName() == KXMLQLCWindowState)
        {
            loadXMLWindowState(&tag, &x, &y, &w, &h, &visible);
            setGeometry(x, y, w, h);
        }
        else if (tag.tagName() == KXMLQLCVCAppearance)
        {
            loadXMLAppearance(&tag);
        }
        else if (tag.tagName() == KXMLQLCVCFrame)
        {
            /* Create a new frame into its parent */
            VCFrame* frame = new VCFrame(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (frame->loadXML(&tag) == false)
                delete frame;
            else
                frame->show();
        }
        else if (tag.tagName() == KXMLQLCVCLabel)
        {
            /* Create a new label into its parent */
            VCLabel* label = new VCLabel(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (label->loadXML(&tag) == false)
                delete label;
            else
                label->show();
        }
        else if (tag.tagName() == KXMLQLCVCButton)
        {
            /* Create a new button into its parent */
            VCButton* button = new VCButton(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (button->loadXML(&tag) == false)
                delete button;
            else
                button->show();
        }
        else if (tag.tagName() == KXMLQLCVCXYPad)
        {
            /* Create a new xy pad into its parent */
            VCXYPad* xypad = new VCXYPad(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (xypad->loadXML(&tag) == false)
                delete xypad;
            else
                xypad->show();
        }
        else if (tag.tagName() == KXMLQLCVCSlider)
        {
            /* Create a new slider into its parent */
            VCSlider* slider = new VCSlider(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (slider->loadXML(&tag) == false)
                delete slider;
            else
                slider->show();
        }
        else if (tag.tagName() == KXMLQLCVCSoloFrame)
        {
            /* Create a new frame into its parent */
            VCSoloFrame* soloframe = new VCSoloFrame(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (soloframe->loadXML(&tag) == false)
                delete soloframe;
            else
                soloframe->show();
        }
        else if (tag.tagName() == KXMLQLCVCCueList)
        {
            /* Create a new cuelist into its parent */
            VCCueList* cuelist = new VCCueList(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (cuelist->loadXML(&tag) == false)
                delete cuelist;
            else
                cuelist->show();
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown frame tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    return true;
}