コード例 #1
0
bool QLCFixtureMode::loadXML(const QDomElement& root)
{
    if (root.tagName() != KXMLQLCFixtureMode)
    {
        qWarning() << Q_FUNC_INFO << "Mode tag not found";
        return false;
    }

    /* Mode name */
    QString str = root.attribute(KXMLQLCFixtureModeName);
    if (str.isEmpty() == true)
    {
        qWarning() << Q_FUNC_INFO << "Mode has no name";
        return false;
    }
    else
    {
        setName(str);
    }

    /* Subtags */
    QDomNode node = root.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();
        if (tag.tagName() == KXMLQLCFixtureModeChannel)
        {
            /* Channel */
            Q_ASSERT(m_fixtureDef != NULL);
            str = tag.attribute(KXMLQLCFixtureModeChannelNumber);
            insertChannel(m_fixtureDef->channel(tag.text()),
                          str.toInt());
        }
        else if (tag.tagName() == KXMLQLCFixtureHead)
        {
            /* Head */
            QLCFixtureHead head;
            if (head.loadXML(tag) == true)
                insertHead(-1, head);
        }
        else if (tag.tagName() == KXMLQLCPhysical)
        {
            /* Physical */
            QLCPhysical physical;
            physical.loadXML(tag);
            setPhysical(physical);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    // Cache all head channels
    cacheHeads();

    return true;
}
コード例 #2
0
ファイル: qlcfixturemode.cpp プロジェクト: PML369/qlcplus
bool QLCFixtureMode::loadXML(QXmlStreamReader &doc)
{
    if (doc.name() != KXMLQLCFixtureMode)
    {
        qWarning() << Q_FUNC_INFO << "Mode tag not found";
        return false;
    }

    /* Mode name */
    QString str = doc.attributes().value(KXMLQLCFixtureModeName).toString();
    if (str.isEmpty() == true)
    {
        qWarning() << Q_FUNC_INFO << "Mode has no name";
        return false;
    }
    else
    {
        setName(str);
    }

    /* Subtags */
    while (doc.readNextStartElement())
    {
        if (doc.name() == KXMLQLCFixtureModeChannel)
        {
            /* Channel */
            Q_ASSERT(m_fixtureDef != NULL);
            str = doc.attributes().value(KXMLQLCFixtureModeChannelNumber).toString();
            insertChannel(m_fixtureDef->channel(doc.readElementText()),
                          str.toInt());
        }
        else if (doc.name() == KXMLQLCFixtureHead)
        {
            /* Head */
            QLCFixtureHead head;
            if (head.loadXML(doc) == true)
                insertHead(-1, head);
        }
        else if (doc.name() == KXMLQLCPhysical)
        {
            /* Physical */
            QLCPhysical physical;
            physical.loadXML(doc);
            setPhysical(physical);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << doc.name();
            doc.skipCurrentElement();
        }
    }

    // Cache all head channels
    cacheHeads();

    return true;
}
コード例 #3
0
bool QLCFixtureMode::loadXML(const QDomElement* root)
{
	QDomNode node;
	QDomElement tag;
	QString str;
	QString ch;

	/* Get channel name */
	str = root->attribute(KXMLQLCFixtureModeName);
	if (str == QString::null)
		return false;
	else
		setName(str);

	/* Subtags */
	node = root->firstChild();
	while (node.isNull() == false)
	{
		tag = node.toElement();

		if (tag.tagName() == KXMLQLCFixtureModeChannel)
		{
			str = tag.attribute(KXMLQLCFixtureModeChannelNumber);
			insertChannel(m_fixtureDef->channel(tag.text()),
				      str.toInt());
		}
		else if (tag.tagName() == KXMLQLCPhysical)
		{
			QLCPhysical physical;
			physical.loadXML(&tag);
			setPhysical(physical);
		}
		else
		{
			qDebug() << "Unknown Mode tag: " << tag.tagName();
		}

		node = node.nextSibling();
	}

	return true;
}