bool VCMatrix::loadXML(const QDomElement *root) { QDomNode node; QDomElement tag; QString str; Q_ASSERT(root != NULL); if (root->tagName() != KXMLQLCVCMatrix) { qWarning() << Q_FUNC_INFO << "Matrix node not found"; return false; } /* Widget commons */ loadXMLCommon(root); /* Children */ node = root->firstChild(); while (node.isNull() == false) { tag = node.toElement(); if (tag.tagName() == KXMLQLCWindowState) { bool visible = false; int x = 0; int y = 0; int w = 0; int h = 0; loadXMLWindowState(&tag, &x, &y, &w, &h, &visible); setGeometry(x, y, w, h); } else if (tag.tagName() == KXMLQLCVCWidgetAppearance) { loadXMLAppearance(&tag); } else if (tag.tagName() == KXMLQLCVCMatrixFunction) { str = tag.attribute(KXMLQLCVCMatrixFunctionID); setFunction(str.toUInt()); if (tag.hasAttribute(KXMLQLCVCMatrixInstantApply)) setInstantChanges(true); } else if (tag.tagName() == KXMLQLCVCWidgetInput) { loadXMLInput(&tag); } else if(tag.tagName() == KXMLQLCVCMatrixControl) { VCMatrixControl *control = new VCMatrixControl(0xFF); if (control->loadXML(tag) == false) delete control; else addCustomControl(control); } else { qWarning() << Q_FUNC_INFO << "Unknown VCMatrix tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
bool VCProperties::loadProperties(const QDomElement& root) { if (root.tagName() != KXMLQLCVCProperties) { qWarning() << Q_FUNC_INFO << "Virtual console properties node not found"; return false; } QString str; QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCVCPropertiesGrid) { /* Grid X resolution */ str = tag.attribute(KXMLQLCVCPropertiesGridXResolution); setGridX(str.toInt()); /* Grid Y resolution */ str = tag.attribute(KXMLQLCVCPropertiesGridYResolution); setGridY(str.toInt()); /* Grid enabled */ str = tag.attribute(KXMLQLCVCPropertiesGridEnabled); if (str == KXMLQLCTrue) setGridEnabled(true); else setGridEnabled(false); } else if (tag.tagName() == KXMLQLCVCPropertiesKeyboard) { /* Keyboard grab */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardGrab); if (str == KXMLQLCTrue) setGrabKeyboard(true); else setGrabKeyboard(false); /* Key repeat */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardRepeatOff); if (str == KXMLQLCTrue) setKeyRepeatOff(true); else setKeyRepeatOff(false); } else if (tag.tagName() == KXMLQLCVCPropertiesDefaultSlider) { quint32 low = 0; quint32 high = 10; quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); QDomElement subtag; /* Bus low limit */ str = tag.attribute(KXMLQLCVCPropertiesLowLimit); if (str.isEmpty() == false) low = quint32(str.toUInt()); /* Bus high limit */ str = tag.attribute(KXMLQLCVCPropertiesHighLimit); if (str.isEmpty() == false) high = quint32(str.toUInt()); /* Sliders' visibility (on by default) */ str = tag.attribute(KXMLQLCVCPropertiesDefaultSliderVisible); if (str.isEmpty() == false) { if (str == KXMLQLCTrue) setSlidersVisible(true); else setSlidersVisible(false); } /* External input */ bool ok = loadXMLInput(tag.firstChild().toElement(), &universe, &channel); if (tag.attribute(KXMLQLCBusRole) == KXMLQLCBusFade) { setFadeLimits(low, high); if (ok == true) setFadeInputSource(universe, channel); } else { setHoldLimits(low, high); if (ok == true) setHoldInputSource(universe, channel); } } else if (tag.tagName() == KXMLQLCVCPropertiesGrandMaster) { quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterChannelMode); setGrandMasterChannelMode(UniverseArray::stringToGMChannelMode(str)); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterValueMode); setGrandMasterValueMode(UniverseArray::stringToGMValueMode(str)); /* External input */ if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true) setGrandMasterInputSource(universe, channel); } else if (tag.tagName() == KXMLQLCVCPropertiesBlackout) { /* External input */ quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true) setBlackoutInputSource(universe, channel); } else if (tag.tagName() == KXMLQLCWidgetProperties) { VCWidgetProperties::loadXML(tag); } else { qWarning() << Q_FUNC_INFO << "Unknown virtual console property tag:" << tag.tagName(); } /* Next node */ node = node.nextSibling(); } return true; }
bool VirtualConsole::loadPropertiesXML(const QDomElement &root) { if (root.tagName() != KXMLQLCVCProperties) { qWarning() << Q_FUNC_INFO << "Virtual Console properties node not found"; return false; } QString str; QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); /** This is a legacy property, converted into * VCFrame "WindowState" tag */ if (tag.tagName() == KXMLQLCVCPropertiesSize) { QSize sz; /* Width */ str = tag.attribute(KXMLQLCVCPropertiesSizeWidth); if (str.isEmpty() == false) sz.setWidth(str.toInt()); /* Height */ str = tag.attribute(KXMLQLCVCPropertiesSizeHeight); if (str.isEmpty() == false) sz.setHeight(str.toInt()); /* Set size if both are valid */ if (sz.isValid() == true) m_pages.at(0)->setGeometry(QRect(0, 0, sz.width(), sz.height())); } #if 0 else if (tag.tagName() == KXMLQLCVCPropertiesGrandMaster) { quint32 universe = InputOutputMap::invalidUniverse(); quint32 channel = QLCChannel::invalid(); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterChannelMode); setGrandMasterChannelMode(GrandMaster::stringToChannelMode(str)); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterValueMode); setGrandMasterValueMode(GrandMaster::stringToValueMode(str)); if (tag.hasAttribute(KXMLQLCVCPropertiesGrandMasterSliderMode)) { str = tag.attribute(KXMLQLCVCPropertiesGrandMasterSliderMode); setGrandMasterSliderMode(GrandMaster::stringToSliderMode(str)); } /* External input */ if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true) setGrandMasterInputSource(universe, channel); } #endif else { qWarning() << Q_FUNC_INFO << "Unknown Virtual Console property tag:" << tag.tagName(); } /* Next node */ node = node.nextSibling(); } return true; }
bool VCProperties::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCVCProperties) { qWarning() << Q_FUNC_INFO << "Virtual console properties node not found"; return false; } QString str; QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCVCPropertiesSize) { QSize sz; /* Width */ str = tag.attribute(KXMLQLCVCPropertiesSizeWidth); if (str.isEmpty() == false) sz.setWidth(str.toInt()); /* Height */ str = tag.attribute(KXMLQLCVCPropertiesSizeHeight); if (str.isEmpty() == false) sz.setHeight(str.toInt()); /* Set size if both are valid */ if (sz.isValid() == true) setSize(sz); } else if (tag.tagName() == KXMLQLCVCPropertiesKeyboard) { /* Tap modifier */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardTapModifier); if (str.isEmpty() == false) setTapModifier(Qt::KeyboardModifier(str.toInt())); } else if (tag.tagName() == KXMLQLCVCPropertiesGrandMaster) { quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterChannelMode); setGrandMasterChannelMode(UniverseArray::stringToGMChannelMode(str)); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterValueMode); setGrandMasterValueMode(UniverseArray::stringToGMValueMode(str)); if (tag.hasAttribute(KXMLQLCVCPropertiesGrandMasterSliderMode)) { str = tag.attribute(KXMLQLCVCPropertiesGrandMasterSliderMode); setGrandMasterSliderMode(UniverseArray::stringToGMSliderMode(str)); } /* External input */ if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true) setGrandMasterInputSource(universe, channel); } else { qWarning() << Q_FUNC_INFO << "Unknown virtual console property tag:" << tag.tagName(); } /* Next node */ node = node.nextSibling(); } return true; }
bool VCSlider::loadXML(const QDomElement* root) { bool visible = false; int x = 0; int y = 0; int w = 0; int h = 0; SliderMode sliderMode = Playback; QDomElement tag; QDomNode node; QString caption; QString str; Q_ASSERT(root != NULL); if (root->tagName() != KXMLQLCVCSlider) { qWarning() << Q_FUNC_INFO << "Slider node not found"; return false; } /* Caption */ caption = root->attribute(KXMLQLCVCCaption); if (root->attribute(KXMLQLCVCSliderInvertedAppearance) == "false") setInvertedAppearance(false); else setInvertedAppearance(true); /* 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() == KXMLQLCVCWidgetAppearance) { loadXMLAppearance(&tag); } else if (tag.tagName() == KXMLQLCVCSliderMode) { sliderMode = stringToSliderMode(tag.text()); str = tag.attribute(KXMLQLCVCSliderValueDisplayStyle); setValueDisplayStyle(stringToValueDisplayStyle(str)); } else if (tag.tagName() == KXMLQLCVCSliderLevel) { loadXMLLevel(&tag); } else if (tag.tagName() == KXMLQLCVCWidgetInput) { loadXMLInput(&tag); } else if (tag.tagName() == KXMLQLCVCSliderPlayback) { loadXMLPlayback(&tag); } else { qWarning() << Q_FUNC_INFO << "Unknown slider tag:" << tag.tagName(); } node = node.nextSibling(); } /* Set the mode last, after everything else has been set */ setSliderMode(sliderMode); setCaption(caption); return true; }