return m_speedIndependantInfo;
}
+int ClipItem::nextFreeEffectGroupIndex() const
+{
+ int freeGroupIndex = 0;
+ for (int i = 0; i < m_effectList.count(); i++) {
+ QDomElement effect = m_effectList.at(i);
+ EffectInfo effectInfo;
+ effectInfo.fromString(effect.attribute("kdenlive_info"));
+ if (effectInfo.groupIndex >= freeGroupIndex) {
+ freeGroupIndex = effectInfo.groupIndex + 1;
+ }
+ }
+ return freeGroupIndex;
+}
+
//virtual
void ClipItem::dropEvent(QGraphicsSceneDragDropEvent * event)
{
if (e.tagName() == "effectgroup") {
// dropped an effect group
QDomNodeList effectlist = e.elementsByTagName("effect");
+ int freeGroupIndex = nextFreeEffectGroupIndex();
+ EffectInfo effectInfo;
for (int i = 0; i < effectlist.count(); i++) {
- effectlist.at(i).toElement().removeAttribute("kdenlive_ix");
+ QDomElement effect = effectlist.at(i).toElement();
+ effectInfo.fromString(effect.attribute("kdenlive_info"));
+ effectInfo.groupIndex = freeGroupIndex;
+ effect.setAttribute("kdenlive_info", effectInfo.toString());
+ effect.removeAttribute("kdenlive_ix");
}
} else {
// single effect dropped
void resetFrameWidth(int width);
/** @brief Clip is about to be deleted, block thumbs. */
void stopThumbs();
+
+ /** @brief Get a free index value for effect group. */
+ int nextFreeEffectGroupIndex() const;
protected:
//virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
if (effect.tagName() == "effectgroup") {
QDomNodeList effectlist = effect.elementsByTagName("effect");
for (int j = 0; j < effectlist.count(); j++) {
- processEffect(item, effectlist.at(j).toElement(), effectCommand);
+ QDomElement subeffect = effectlist.at(j).toElement();
+ if (subeffect.hasAttribute("kdenlive_info")) {
+ // effect is in a group
+ EffectInfo effectInfo;
+ effectInfo.fromString(subeffect.attribute("kdenlive_info"));
+ if (effectInfo.groupIndex < 0) {
+ // group needs to be appended
+ effectInfo.groupIndex = item->nextFreeEffectGroupIndex();
+ subeffect.setAttribute("kdenlive_info", effectInfo.toString());
+ }
+ }
+ processEffect(item, subeffect, effectCommand);
}
}
else {
if (effect.tagName() == "effectgroup") {
QDomNodeList effectlist = effect.elementsByTagName("effect");
for (int j = 0; j < effectlist.count(); j++) {
- processEffect(item, effectlist.at(j).toElement(), effectCommand);
+ QDomElement subeffect = effectlist.at(j).toElement();
+ if (subeffect.hasAttribute("kdenlive_info")) {
+ // effect is in a group
+ EffectInfo effectInfo;
+ effectInfo.fromString(subeffect.attribute("kdenlive_info"));
+ if (effectInfo.groupIndex < 0) {
+ // group needs to be appended
+ effectInfo.groupIndex = item->nextFreeEffectGroupIndex();
+ subeffect.setAttribute("kdenlive_info", effectInfo.toString());
+ }
+ }
+ processEffect(item, subeffect, effectCommand);
}
}
else processEffect(item, effect, effectCommand);
for (int i = 0; i < effects.count(); i++) {
QDomElement eff = effects.at(i).toElement();
eff.removeAttribute("kdenlive_ix");
- QString kdenliveInfo = eff.attribute("kdenlive_info");
+ EffectInfo info;
+ info.fromString(eff.attribute("kdenlive_info"));
// Make sure all effects have the correct new group name
- if (kdenliveInfo.count('/') >= 2) {
- eff.setAttribute("kdenlive_info", kdenliveInfo.section('/', 0, 1) + "/" + name);
- }
+ info.groupName = name;
+ // Saved effect group should have a group index of -1
+ info.groupIndex = -1;
+ eff.setAttribute("kdenlive_info", info.toString());
+
}
base.setAttribute("name", name);