QWidget(parent),
m_clipref(NULL),
m_trackindex(-1),
- m_draggedEffect(NULL)
+ m_draggedEffect(NULL),
+ m_groupIndex(0)
{
m_effectMetaInfo.trackMode = false;
m_effectMetaInfo.monitor = monitor;
m_draggedEffect = NULL;
disconnect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
m_effects.clear();
+ m_groupIndex = 0;
QWidget *view = m_ui.container->takeWidget();
if (view) {
delete view;
kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
continue;
}
+
+ CollapsibleEffect *group = NULL;
+ QString groupName = EffectsList::property(d, "kdenlive_group");
+ if (!groupName.isEmpty()) {
+ kDebug()<<"// CREATING EWFFECT GRP: "<<groupName;
+ group = new CollapsibleEffect(QDomElement(), QDomElement(), ItemInfo(), groupName.toInt(), &m_effectMetaInfo, false, true, m_ui.container->widget());
+ connect(group, SIGNAL(moveEffect(int, CollapsibleEffect*)), this , SLOT(slotMoveEffectToGroup(int, CollapsibleEffect*)));
+ vbox1->addWidget(group);
+ }
/*QDomDocument doc;
doc.appendChild(doc.importNode(d, true));
}
else info = m_clipref->info();
- CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, i, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, view);
+ CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, i, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, false, view);
m_effects.append(currentEffect);
- vbox1->addWidget(currentEffect);
+ if (group) {
+ group->addGroupEffect(currentEffect);
+ } else {
+ vbox1->addWidget(currentEffect);
+ }
// Check drag & drop
currentEffect->installEventFilter( this );
connect(currentEffect, SIGNAL(activateEffect(int)), this, SLOT(slotSetCurrentEffect(int)));
connect(currentEffect, SIGNAL(checkMonitorPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
connect(currentEffect, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
- //ui.title->setPixmap(icon.pixmap(QSize(12, 12)));
+ connect(currentEffect, SIGNAL(createGroup(int)), this , SLOT(slotCreateGroup(int)));
+ connect(currentEffect, SIGNAL(moveEffect(int, CollapsibleEffect*)), this , SLOT(slotMoveEffectToGroup(int, CollapsibleEffect*)));
+
+ //ui.title->setPixmap(icon.pixmap(QSize(12, 12)));
}
vbox1->addStretch(10);
connect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
QDomElement effect = m_draggedEffect->effect().cloneNode().toElement();
QPixmap pixmap = QPixmap::grabWidget(m_draggedEffect->title);
drag->setPixmap(pixmap);
- effect.setAttribute("kdenlive_ix", 0);
QDomDocument doc;
doc.appendChild(doc.importNode(effect, true));
QMimeData *mime = new QMimeData;
// Assign ownership of the QMimeData object to the QDrag object.
drag->setMimeData(mime);
// Start the drag and drop operation
- drag->exec(Qt::CopyAction);// | Qt::MoveAction);
+ drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
}
m_effects.at(i)->updateTimecodeFormat();
}
+CollapsibleEffect *EffectStackView2::getEffectByIndex(int ix)
+{
+ for (int i = 0; i< m_effects.count(); i++) {
+ if (m_effects.at(i)->effectIndex() == ix) {
+ return m_effects.at(i);
+ }
+ }
+ return NULL;
+}
+
void EffectStackView2::slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix)
{
if (m_effectMetaInfo.trackMode)
}
if (!dom.isNull()) {
dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
- //TODO: Track mode
if (m_effectMetaInfo.trackMode) {
EffectsList::setParameter(dom, "in", QString::number(0));
EffectsList::setParameter(dom, "out", QString::number(m_trackInfo.duration));
} else {
m_clipref->initEffect(dom);
m_effects.at(ix)->updateWidget(m_clipref->info(), ix, dom, &m_effectMetaInfo);
- //m_effectedit->transferParamDesc(dom, m_clipref->info());
//m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
emit updateEffect(m_clipref, -1, old, dom, ix);
}
m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count());*/
}
+
+void EffectStackView2::slotCreateGroup(int ix)
+{
+ QDomElement oldeffect = m_currentEffectList.at(ix);
+ QDomElement neweffect = oldeffect.cloneNode().toElement();
+ QString groupName = QString::number(m_groupIndex);
+ m_groupIndex++;
+ EffectsList::setProperty(neweffect, "kdenlive_group", groupName);
+
+ ItemInfo info;
+ if (m_effectMetaInfo.trackMode) {
+ info.track = m_trackInfo.type;
+ info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
+ info.cropStart = GenTime(0);
+ info.startPos = GenTime(-1);
+ info.track = 0;
+ emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, ix);
+ } else {
+ emit updateEffect(m_clipref, -1, oldeffect, neweffect, ix);
+ }
+
+ QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
+ int groupPos = l->indexOf(m_effects.at(ix));
+
+ CollapsibleEffect *group = new CollapsibleEffect(QDomElement(), QDomElement(), ItemInfo(), m_groupIndex, &m_effectMetaInfo, false, true, m_ui.container->widget());
+ connect(group, SIGNAL(moveEffect(int, CollapsibleEffect*)), this , SLOT(slotMoveEffectToGroup(int, CollapsibleEffect*)));
+ CollapsibleEffect *w = static_cast<CollapsibleEffect*>(l->takeAt(groupPos)->widget());
+ l->insertWidget(groupPos, group);
+ group->addGroupEffect(w);
+}
+
+void EffectStackView2::slotMoveEffectToGroup(int ix, CollapsibleEffect* group)
+{
+ QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
+ CollapsibleEffect *effectToMove = getEffectByIndex(ix);
+ if (effectToMove == NULL) return;
+ l->removeWidget(effectToMove);
+ group->addGroupEffect(effectToMove);
+}
+
#include "effectstackview2.moc"