]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.cpp
effect stack cleanup
[kdenlive] / src / effectstack / effectstackview2.cpp
1 /***************************************************************************
2                           effecstackview.cpp2  -  description
3                              -------------------
4     begin                : Feb 15 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18
19 #include "effectstackview2.h"
20 #include "effectslist.h"
21 #include "clipitem.h"
22 #include "mainwindow.h"
23 #include "docclipbase.h"
24 #include "projectlist.h"
25 #include "kthumb.h"
26 #include "monitoreditwidget.h"
27 #include "monitorscene.h"
28 #include "kdenlivesettings.h"
29
30 #include <KDebug>
31 #include <KLocale>
32 #include <KMessageBox>
33 #include <KStandardDirs>
34 #include <KFileDialog>
35 #include <KColorScheme>
36
37 #include <QMenu>
38 #include <QTextStream>
39 #include <QFile>
40 #include <QInputDialog>
41
42
43 EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
44         QWidget(parent),
45         m_clipref(NULL),
46         m_trackindex(-1),
47         m_draggedEffect(NULL),
48         m_groupIndex(0)
49 {
50     m_effectMetaInfo.trackMode = false;
51     m_effectMetaInfo.monitor = monitor;
52     m_effects = QList <CollapsibleEffect*>();
53
54     m_ui.setupUi(this);
55     setFont(KGlobalSettings::smallestReadableFont());
56     m_ui.checkAll->setToolTip(i18n("Enable/Disable all effects"));
57     m_ui.buttonShowComments->setIcon(KIcon("help-about"));
58     m_ui.buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
59
60
61     setEnabled(false);
62
63     QPalette p = palette();
64     KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
65     QColor dark_bg = scheme.shade(KColorScheme::DarkShade);
66     QColor selected_bg = scheme.decoration(KColorScheme::FocusColor).color();
67     QColor hover_bg = scheme.decoration(KColorScheme::HoverColor).color();
68     QColor light_bg = scheme.shade(KColorScheme::LightShade);
69     
70     QString stylesheet(QString("QProgressBar:horizontal {border: 1px solid %1;border-radius:0px;border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right: 0px;background:%4;padding: 0px;text-align:left center}\
71                                 QProgressBar:horizontal#dragOnly {background: %1} QProgressBar:horizontal:hover#dragOnly {background: %3} QProgressBar:horizontal:hover {border: 1px solid %3;border-right: 0px;}\
72                                 QProgressBar::chunk:horizontal {background: %1;} QProgressBar::chunk:horizontal:hover {background: %3;}\
73                                 QProgressBar:horizontal[inTimeline=\"true\"] { border: 1px solid %2;border-right: 0px;background: %4;padding: 0px;text-align:left center } QProgressBar::chunk:horizontal[inTimeline=\"true\"] {background: %2;}\
74                                 QAbstractSpinBox#dragBox {border: 1px solid %1;border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QAbstractSpinBox::down-button#dragBox {width:0px;padding:0px;}\
75                                 QAbstractSpinBox::up-button#dragBox {width:0px;padding:0px;} QAbstractSpinBox[inTimeline=\"true\"]#dragBox { border: 1px solid %2;} QAbstractSpinBox:hover#dragBox {border: 1px solid %3;} ")
76                                 .arg(dark_bg.name()).arg(selected_bg.name()).arg(hover_bg.name()).arg(light_bg.name()));
77     setStyleSheet(stylesheet);
78 }
79
80 EffectStackView2::~EffectStackView2()
81 {
82 }
83
84
85 void EffectStackView2::slotRenderPos(int pos)
86 {
87     if (m_effects.isEmpty()) return;
88     if (!m_effectMetaInfo.trackMode && m_clipref) pos = pos - m_clipref->startPos().frames(KdenliveSettings::project_fps());
89
90     for (int i = 0; i< m_effects.count(); i++)
91         m_effects.at(i)->slotSyncEffectsPos(pos);
92 }
93
94 void EffectStackView2::setMenu(QMenu *menu)
95 {
96     //m_ui.buttonNew->setMenu(menu);
97 }
98
99 void EffectStackView2::slotClipItemSelected(ClipItem* c, int ix)
100 {
101     if (c && !c->isEnabled()) return;
102     if (c && c == m_clipref) {
103         
104     } else {
105         m_clipref = c;
106         if (c) {
107             QString cname = m_clipref->clipName();
108             if (cname.length() > 30) {
109                 m_ui.checkAll->setToolTip(i18n("Effects for %1").arg(cname));
110                 cname.truncate(27);
111                 m_ui.checkAll->setText(i18n("Effects for %1").arg(cname) + "...");
112             } else {
113                 m_ui.checkAll->setToolTip(QString());
114                 m_ui.checkAll->setText(i18n("Effects for %1").arg(cname));
115             }
116             ix = c->selectedEffectIndex();
117             QString size = c->baseClip()->getProperty("frame_size");
118             double factor = c->baseClip()->getProperty("aspect_ratio").toDouble();
119             m_effectMetaInfo.frameSize = QPoint((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt());
120         } else {
121             ix = 0;
122         }
123     }
124     if (m_clipref == NULL) {
125         //TODO: clear list, reset paramdesc and info
126         //ItemInfo info;
127         //m_effectedit->transferParamDesc(QDomElement(), info);
128         m_effects.clear();
129         QWidget *view = m_ui.container->takeWidget();
130         if (view) {
131             delete view;
132         }
133         m_ui.checkAll->setToolTip(QString());
134         m_ui.checkAll->setText(QString());
135         setEnabled(false);
136         return;
137     }
138     setEnabled(true);
139     m_effectMetaInfo.trackMode = false;
140     m_currentEffectList = m_clipref->effectList();
141     setupListView(ix);
142 }
143
144 void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo info)
145 {
146     m_clipref = NULL;
147     m_effectMetaInfo.trackMode = true;
148     m_currentEffectList = info.effectsList;
149     m_trackInfo = info;
150     setEnabled(true);
151     m_ui.checkAll->setToolTip(QString());
152     m_ui.checkAll->setText(i18n("Effects for track %1").arg(info.trackName.isEmpty() ? QString::number(ix) : info.trackName));
153     m_trackindex = ix;
154     setupListView(0);
155 }
156
157
158 void EffectStackView2::setupListView(int ix)
159 {
160     //TODO: clear list
161
162     blockSignals(true);
163     m_draggedEffect = NULL;
164     disconnect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
165     m_effects.clear();
166     m_groupIndex = 0;
167     QWidget *view = m_ui.container->takeWidget();
168     if (view) {
169         delete view;
170     }
171     blockSignals(false);
172     view = new QWidget(m_ui.container);
173     m_ui.container->setWidget(view);
174
175     QVBoxLayout *vbox1 = new QVBoxLayout(view);
176     vbox1->setContentsMargins(0, 0, 0, 0);
177     vbox1->setSpacing(0);
178
179     for (int i = 0; i < m_currentEffectList.count(); i++) {
180         QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
181         if (d.isNull()) {
182             kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
183             continue;
184         }
185         
186         CollapsibleEffect *group = NULL;
187         EffectInfo effectInfo;
188         effectInfo.fromString(d.attribute("kdenlive_info"));
189         if (effectInfo.groupIndex >= 0) {
190             for (int j = 0; j < vbox1->count(); j++) {
191                 CollapsibleEffect *gp = static_cast<CollapsibleEffect *>(vbox1->itemAt(j)->widget());
192                 if (gp->groupIndex() == effectInfo.groupIndex) {
193                     group = gp;
194                     break;
195                 }
196             }
197             
198             if (group == NULL) {
199                 group = new CollapsibleEffect(QDomElement(), QDomElement(), ItemInfo(), effectInfo.groupIndex, &m_effectMetaInfo, false, true, m_ui.container->widget());
200                 if (!effectInfo.groupName.isEmpty()) group->title->setText(effectInfo.groupName);
201                 connect(group, SIGNAL(moveEffect(int,CollapsibleEffect*,int)), this , SLOT(slotMoveEffectToGroup(int,CollapsibleEffect*,int)));
202                 connect(group, SIGNAL(unGroup(CollapsibleEffect*)), this , SLOT(slotUnGroup(CollapsibleEffect*)));
203                 vbox1->addWidget(group);
204             }
205             if (effectInfo.groupIndex >= m_groupIndex) m_groupIndex = effectInfo.groupIndex + 1;
206         }
207
208         /*QDomDocument doc;
209         doc.appendChild(doc.importNode(d, true));
210         kDebug() << "IMPORTED STK: " << doc.toString();*/
211         
212         ItemInfo info;
213         if (m_effectMetaInfo.trackMode) { 
214             info.track = m_trackInfo.type;
215             info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
216             info.cropStart = GenTime(0);
217             info.startPos = GenTime(-1);
218             info.track = 0;
219         }
220         else info = m_clipref->info();
221
222         CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, i, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, false, view);
223         m_effects.append(currentEffect);
224         if (group) {
225             group->addGroupEffect(currentEffect);
226         } else {
227             vbox1->addWidget(currentEffect);
228         }
229
230         // Check drag & drop
231         currentEffect->installEventFilter( this );
232
233         connect(currentEffect, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement, int)));
234         connect(currentEffect, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)), this , SLOT(slotStartFilterJob(QString,QString,QString,QString,QString,QString)));
235         connect(currentEffect, SIGNAL(deleteEffect(const QDomElement)), this , SLOT(slotDeleteEffect(const QDomElement)));
236         connect(currentEffect, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
237         connect(currentEffect, SIGNAL(resetEffect(int)), this , SLOT(slotResetEffect(int)));
238         connect(currentEffect, SIGNAL(changeEffectPosition(int,bool)), this , SLOT(slotMoveEffect(int , bool)));
239         connect(currentEffect, SIGNAL(effectStateChanged(bool, int)), this, SLOT(slotUpdateEffectState(bool, int)));
240         connect(currentEffect, SIGNAL(activateEffect(int)), this, SLOT(slotSetCurrentEffect(int)));
241         connect(currentEffect, SIGNAL(checkMonitorPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
242         connect(currentEffect, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
243         connect(currentEffect, SIGNAL(createGroup(int)), this , SLOT(slotCreateGroup(int)));
244         connect(currentEffect, SIGNAL(moveEffect(int,CollapsibleEffect*,int)), this , SLOT(slotMoveEffectToGroup(int,CollapsibleEffect*,int)));
245         
246         //ui.title->setPixmap(icon.pixmap(QSize(12, 12)));
247     }
248     vbox1->addStretch(10);
249     connect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
250 }
251
252 bool EffectStackView2::eventFilter( QObject * o, QEvent * e ) 
253 {
254     // Check if user clicked in an effect's top bar to start dragging it
255     if (e->type() == QEvent::MouseButtonPress)  {
256         m_draggedEffect = qobject_cast<CollapsibleEffect*>(o);
257         if (m_draggedEffect) {
258             QMouseEvent *me = static_cast<QMouseEvent *>(e);
259             if (me->button() == Qt::LeftButton && (m_draggedEffect->frame->underMouse() || m_draggedEffect->title->underMouse()))
260                 m_clickPoint = me->globalPos();
261             else {
262                 m_clickPoint = QPoint();
263                 m_draggedEffect = NULL;
264             }
265             e->accept();
266             return false;
267         }
268     }  
269     if (e->type() == QEvent::MouseMove)  {
270         if (qobject_cast<CollapsibleEffect*>(o)) {
271             QMouseEvent *me = static_cast<QMouseEvent *>(e);
272             if (me->buttons() != Qt::LeftButton) {
273                 e->accept();
274                 return false;
275             }
276             else {
277                 e->ignore();
278                 return true;
279             }
280         }
281     }
282     return QWidget::eventFilter(o, e);
283 }
284
285 void EffectStackView2::mouseMoveEvent(QMouseEvent * event)
286 {
287     if (m_draggedEffect && (event->buttons() & Qt::LeftButton) && (m_clickPoint != QPoint()) && ((event->globalPos() - m_clickPoint).manhattanLength() >= QApplication::startDragDistance())) {
288         startDrag();
289     }
290 }
291
292 void EffectStackView2::mouseReleaseEvent(QMouseEvent * event)
293 {
294     m_draggedEffect = NULL;
295     QWidget::mouseReleaseEvent(event);
296 }
297
298 void EffectStackView2::startDrag()
299 {
300     QDrag *drag = new QDrag(this);
301     // The data to be transferred by the drag and drop operation is contained in a QMimeData object
302     QDomElement effect = m_draggedEffect->effect().cloneNode().toElement();
303     QPixmap pixmap = QPixmap::grabWidget(m_draggedEffect->title);
304     drag->setPixmap(pixmap);
305     QDomDocument doc;
306     doc.appendChild(doc.importNode(effect, true));
307     QMimeData *mime = new QMimeData;
308     QByteArray data;
309     data.append(doc.toString().toUtf8());
310     mime->setData("kdenlive/effectslist", data);
311
312     // Assign ownership of the QMimeData object to the QDrag object.
313     drag->setMimeData(mime);
314     // Start the drag and drop operation
315     drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
316 }
317
318
319 void EffectStackView2::slotUpdateEffectState(bool disable, int index)
320 {
321     if (m_effectMetaInfo.trackMode)
322         emit changeEffectState(NULL, m_trackindex, index, disable);
323     else
324         emit changeEffectState(m_clipref, -1, index, disable);
325 }
326
327
328 void EffectStackView2::raiseWindow(QWidget* dock)
329 {
330     if ((m_clipref || m_effectMetaInfo.trackMode) && dock)
331         dock->raise();
332 }
333
334
335 void EffectStackView2::slotSeekTimeline(int pos)
336 {
337     if (m_effectMetaInfo.trackMode) {
338         emit seekTimeline(pos);
339     } else if (m_clipref) {
340         emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
341     }
342 }
343
344
345 /*void EffectStackView2::slotRegionChanged()
346 {
347     if (!m_trackMode) emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
348 }*/
349
350 void EffectStackView2::slotCheckMonitorPosition(int renderPos)
351 {
352     if (m_effectMetaInfo.trackMode || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
353         if (!m_effectMetaInfo.monitor->getEffectEdit()->getScene()->views().at(0)->isVisible())
354             m_effectMetaInfo.monitor->slotEffectScene(true);
355     } else {
356         m_effectMetaInfo.monitor->slotEffectScene(false);
357     }
358 }
359
360 int EffectStackView2::isTrackMode(bool *ok) const
361 {
362     *ok = m_effectMetaInfo.trackMode;
363     return m_trackindex;
364 }
365
366 void EffectStackView2::clear()
367 {
368 }
369
370 void EffectStackView2::updateProjectFormat(MltVideoProfile profile, Timecode t)
371 {
372     m_effectMetaInfo.profile = profile;
373     m_effectMetaInfo.timecode = t;
374 }
375
376 void EffectStackView2::slotItemDel()
377 {
378
379 }
380
381 void EffectStackView2::updateTimecodeFormat()
382 {
383     for (int i = 0; i< m_effects.count(); i++)
384         m_effects.at(i)->updateTimecodeFormat();
385 }
386
387 CollapsibleEffect *EffectStackView2::getEffectByIndex(int ix)
388 {
389     for (int i = 0; i< m_effects.count(); i++) {
390         if (m_effects.at(i)->effectIndex() == ix) {
391             return m_effects.at(i);
392         }
393     }
394     return NULL;
395 }
396
397 void EffectStackView2::slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix)
398 {
399     if (m_effectMetaInfo.trackMode)
400         emit updateEffect(NULL, m_trackindex, old, e, ix);
401     else if (m_clipref) {
402         emit updateEffect(m_clipref, -1, old, e, ix);
403         // Make sure the changed effect is currently displayed
404         slotSetCurrentEffect(ix);
405     }
406 }
407
408 void EffectStackView2::slotSetCurrentEffect(int ix)
409 {
410     if (m_clipref && ix != m_clipref->selectedEffectIndex())
411         m_clipref->setSelectedEffect(ix);
412     for (int i = 0; i < m_effects.count(); i++) {
413         m_effects.at(i)->setActive(i == ix);
414     }
415 }
416
417 void EffectStackView2::slotDeleteEffect(const QDomElement effect)
418 {
419     if (m_effectMetaInfo.trackMode)
420         emit removeEffect(NULL, m_trackindex, effect);
421     else
422         emit removeEffect(m_clipref, -1, effect);
423 }
424
425 void EffectStackView2::slotMoveEffect(int index, bool up)
426 {
427     if (up && index <= 1) return;
428     if (!up && index >= m_currentEffectList.count()) return;
429     int endPos;
430     if (up) {
431         endPos = index - 1;
432     }
433     else {
434         endPos =  index + 1;
435     }
436     if (m_effectMetaInfo.trackMode) emit changeEffectPosition(NULL, m_trackindex, index, endPos);
437     else emit changeEffectPosition(m_clipref, -1, index, endPos);
438 }
439
440 void EffectStackView2::slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties)
441 {
442     if (!m_clipref) return;
443     emit startFilterJob(m_clipref->info(), m_clipref->clipProducer(), filterName, filterParams, finalFilterName, consumer, consumerParams, properties);
444 }
445
446 void EffectStackView2::slotResetEffect(int ix)
447 {
448     QDomElement old = m_currentEffectList.itemFromIndex(ix);
449     QDomElement dom;
450     QString effectId = old.attribute("id");
451     QMap<QString, EffectsList*> effectLists;
452     effectLists["audio"] = &MainWindow::audioEffects;
453     effectLists["video"] = &MainWindow::videoEffects;
454     effectLists["custom"] = &MainWindow::customEffects;
455     foreach(const QString &type, effectLists.keys()) {
456         EffectsList *list = effectLists[type];
457         dom = list->getEffectByTag(QString(), effectId).cloneNode().toElement();
458         if (!dom.isNull()) break;
459     }
460     if (!dom.isNull()) {
461         dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
462         if (m_effectMetaInfo.trackMode) {
463             EffectsList::setParameter(dom, "in", QString::number(0));
464             EffectsList::setParameter(dom, "out", QString::number(m_trackInfo.duration));
465             ItemInfo info;
466             info.track = m_trackInfo.type;
467             info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
468             info.cropStart = GenTime(0);
469             info.startPos = GenTime(-1);
470             info.track = 0;
471             m_effects.at(ix)->updateWidget(info, ix, dom, &m_effectMetaInfo);
472             emit updateEffect(NULL, m_trackindex, old, dom, ix);
473         } else {
474             m_clipref->initEffect(dom);
475             m_effects.at(ix)->updateWidget(m_clipref->info(), ix, dom, &m_effectMetaInfo);
476             //m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
477             emit updateEffect(m_clipref, -1, old, dom, ix);
478         }
479     }
480
481     /*emit showComments(m_ui.buttonShowComments->isChecked());
482     m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count());*/
483 }
484
485
486 void EffectStackView2::slotCreateGroup(int ix)
487 {
488     QDomElement oldeffect = m_currentEffectList.itemFromIndex(ix);
489     QDomElement neweffect = oldeffect.cloneNode().toElement();
490     QString groupName = QString::number(m_groupIndex);
491     EffectInfo effectinfo;
492     effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
493     effectinfo.groupIndex = m_groupIndex;
494     neweffect.setAttribute("kdenlive_info", effectinfo.toString());
495
496     ItemInfo info;
497     if (m_effectMetaInfo.trackMode) { 
498         info.track = m_trackInfo.type;
499         info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
500         info.cropStart = GenTime(0);
501         info.startPos = GenTime(-1);
502         info.track = 0;
503         emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, ix);
504     } else {
505         emit updateEffect(m_clipref, -1, oldeffect, neweffect, ix);
506     }
507     
508     QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
509     int groupPos = 0;
510     
511     CollapsibleEffect *effectToMove = NULL;
512     for (int j = 0; j < l->count(); j++) {
513         CollapsibleEffect *gp = static_cast<CollapsibleEffect *>(l->itemAt(j)->widget());
514         if (gp->effectIndex() == ix) {
515             effectToMove = gp;
516             groupPos = l->indexOf(gp);
517             l->removeWidget(gp);
518             break;
519         }
520     }
521     
522     CollapsibleEffect *group = new CollapsibleEffect(QDomElement(), QDomElement(), ItemInfo(), m_groupIndex, &m_effectMetaInfo, false, true, m_ui.container->widget());
523     m_groupIndex++;
524     connect(group, SIGNAL(moveEffect(int,CollapsibleEffect*,int)), this , SLOT(slotMoveEffectToGroup(int,CollapsibleEffect*,int)));
525     connect(group, SIGNAL(unGroup(CollapsibleEffect*)), this , SLOT(slotUnGroup(CollapsibleEffect*)));
526     l->insertWidget(groupPos, group);
527     group->addGroupEffect(effectToMove);
528 }
529
530 void EffectStackView2::slotMoveEffectToGroup(int effectIndex, CollapsibleEffect* group, int lastEffectIndex)
531 {
532     QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
533     CollapsibleEffect *effectToMove = getEffectByIndex(effectIndex);
534     if (effectToMove == NULL) return;
535     l->removeWidget(effectToMove);
536     group->addGroupEffect(effectToMove);
537     
538     QDomElement oldeffect = effectToMove->effect();
539     QDomElement neweffect = oldeffect.cloneNode().toElement();
540     
541     EffectInfo effectinfo;
542     effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
543     effectinfo.groupIndex = group->groupIndex();
544     neweffect.setAttribute("kdenlive_info", effectinfo.toString());
545
546     ItemInfo info;
547     if (m_effectMetaInfo.trackMode) { 
548         info.track = m_trackInfo.type;
549         info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
550         info.cropStart = GenTime(0);
551         info.startPos = GenTime(-1);
552         info.track = 0;
553         emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->index());
554     } else {
555         emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->index());
556     }
557     
558     if (effectToMove->effectIndex() == lastEffectIndex) return;
559     // Update effect index with new position
560     if (m_effectMetaInfo.trackMode) {
561         emit changeEffectPosition(NULL, m_trackindex, effectToMove->effectIndex(), lastEffectIndex + 1);
562     }
563     else {
564         emit changeEffectPosition(m_clipref, -1, effectToMove->effectIndex(), lastEffectIndex + 1);
565     }
566 }
567
568 void EffectStackView2::slotUnGroup(CollapsibleEffect* group)
569 {
570     QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
571     int ix = l->indexOf(group);
572     group->removeGroup(ix, l);
573     group->deleteLater();
574 }
575
576 #include "effectstackview2.moc"