- if (ix < 0) ix = 0;
- if (ix < effects.count()) m_baseElement.removeChild(effects.at(ix));
- if (ix == effects.count()) m_baseElement.appendChild(importNode(effect, true));
- else m_baseElement.insertBefore(importNode(effect, true), effects.at(ix));
+ QDomElement effect;
+ for (int i = 0; i < indexes.count(); ++i) {
+ effect = effectFromIndex(effects, indexes.at(i));
+ effect.setAttribute("disable", (int) disable);
+ }
+}
+
+QDomElement EffectsList::effectFromIndex(const QDomNodeList &effects, int ix)
+{
+ if (ix <= 0 || ix > effects.count()) return QDomElement();
+ return effects.at(ix - 1).toElement();
+}
+
+void EffectsList::updateEffect(const QDomElement &effect)
+{
+ QDomNodeList effects = m_baseElement.childNodes();
+ int ix = effect.attribute("kdenlive_ix").toInt();
+ QDomElement current = effectFromIndex(effects, ix);
+ if (!current.isNull()) {
+ m_baseElement.insertBefore(importNode(effect, true), current);
+ m_baseElement.removeChild(current);
+ }
+ else m_baseElement.appendChild(importNode(effect, true));