bool QLCInputChannel::loadXML(QXmlStreamReader &root) { if (root.isStartElement() == false || root.name() != KXMLQLCInputChannel) { qWarning() << Q_FUNC_INFO << "Channel node not found"; return false; } while (root.readNextStartElement()) { if (root.name() == KXMLQLCInputChannelName) { setName(root.readElementText()); } else if (root.name() == KXMLQLCInputChannelType) { setType(stringToType(root.readElementText())); } else if (root.name() == KXMLQLCInputChannelMovement) { if (root.attributes().hasAttribute(KXMLQLCInputChannelSensitivity)) #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) setMovementSensitivity(root.attributes().value(KXMLQLCInputChannelSensitivity).toString().toInt()); #else setMovementSensitivity(root.attributes().value(KXMLQLCInputChannelSensitivity).toInt()); #endif if (root.readElementText() == KXMLQLCInputChannelRelative) setMovementType(Relative); } else { qWarning() << Q_FUNC_INFO << "Unknown input channel tag" << root.name(); } } return true; }
bool QLCInputChannel::loadXML(QXmlStreamReader &root) { if (root.isStartElement() == false || root.name() != KXMLQLCInputChannel) { qWarning() << Q_FUNC_INFO << "Channel node not found"; return false; } while (root.readNextStartElement()) { if (root.name() == KXMLQLCInputChannelName) { setName(root.readElementText()); } else if (root.name() == KXMLQLCInputChannelType) { setType(stringToType(root.readElementText())); } else if (root.name() == KXMLQLCInputChannelExtraPress) { root.readElementText(); setSendExtraPress(true); } else if (root.name() == KXMLQLCInputChannelMovement) { if (root.attributes().hasAttribute(KXMLQLCInputChannelSensitivity)) setMovementSensitivity(root.attributes().value(KXMLQLCInputChannelSensitivity).toString().toInt()); if (root.readElementText() == KXMLQLCInputChannelRelative) setMovementType(Relative); } else { qWarning() << Q_FUNC_INFO << "Unknown input channel tag" << root.name(); root.skipCurrentElement(); } } return true; }