1 /***************************************************************************
2 effecstackview.cpp2 - description
5 copyright : (C) 2008 by Marco Gittler (g.marco@freenet.de)
6 copyright : (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org)
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
19 #include "effectstackview2.h"
20 #include "effectslist.h"
22 #include "mainwindow.h"
23 #include "docclipbase.h"
24 #include "projectlist.h"
26 #include "monitoreditwidget.h"
27 #include "monitorscene.h"
28 #include "kdenlivesettings.h"
29 #include "collapsibleeffect.h"
30 #include "collapsiblegroup.h"
34 #include <KMessageBox>
35 #include <KStandardDirs>
36 #include <KFileDialog>
37 #include <KColorScheme>
40 #include <QTextStream>
42 #include <QInputDialog>
46 EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
50 m_draggedEffect(NULL),
54 m_effectMetaInfo.trackMode = false;
55 m_effectMetaInfo.monitor = monitor;
56 m_effects = QList <CollapsibleEffect*>();
59 setFont(KGlobalSettings::smallestReadableFont());
60 m_ui.checkAll->setToolTip(i18n("Enable/Disable all effects"));
61 m_ui.buttonShowComments->setIcon(KIcon("help-about"));
62 m_ui.buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
64 connect(m_ui.checkAll, SIGNAL(stateChanged(int)), this, SLOT(slotCheckAll(int)));
65 connect(m_ui.buttonShowComments, SIGNAL(clicked()), this, SLOT(slotShowComments()));
66 m_ui.labelComment->setHidden(true);
71 setStyleSheet(CollapsibleEffect::getStyleSheet());
74 EffectStackView2::~EffectStackView2()
78 void EffectStackView2::updatePalette()
80 setStyleSheet(CollapsibleEffect::getStyleSheet());
83 void EffectStackView2::slotRenderPos(int pos)
85 if (m_effects.isEmpty()) return;
86 if (!m_effectMetaInfo.trackMode && m_clipref) pos = pos - m_clipref->startPos().frames(KdenliveSettings::project_fps());
88 for (int i = 0; i< m_effects.count(); i++)
89 m_effects.at(i)->slotSyncEffectsPos(pos);
92 void EffectStackView2::slotClipItemSelected(ClipItem* c)
94 if (c && !c->isEnabled()) return;
95 if (c && c == m_clipref) {
100 QString cname = m_clipref->clipName();
101 if (cname.length() > 30) {
102 m_ui.checkAll->setToolTip(i18n("Effects for %1").arg(cname));
104 m_ui.checkAll->setText(i18n("Effects for %1").arg(cname) + "...");
106 m_ui.checkAll->setToolTip(QString());
107 m_ui.checkAll->setText(i18n("Effects for %1").arg(cname));
109 m_ui.checkAll->setEnabled(true);
110 QString size = c->baseClip()->getProperty("frame_size");
111 double factor = c->baseClip()->getProperty("aspect_ratio").toDouble();
112 m_effectMetaInfo.frameSize = QPoint((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt());
115 if (m_clipref == NULL) {
116 //TODO: clear list, reset paramdesc and info
118 //m_effectedit->transferParamDesc(QDomElement(), info);
123 m_effectMetaInfo.trackMode = false;
124 m_currentEffectList = m_clipref->effectList();
128 void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo info)
131 m_effectMetaInfo.trackMode = true;
132 m_currentEffectList = info.effectsList;
135 m_ui.checkAll->setToolTip(QString());
136 m_ui.checkAll->setText(i18n("Effects for track %1").arg(info.trackName.isEmpty() ? QString::number(ix) : info.trackName));
142 void EffectStackView2::setupListView()
145 m_draggedEffect = NULL;
146 m_draggedGroup = NULL;
147 disconnect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
150 QWidget *view = m_ui.container->takeWidget();
155 view = new QWidget(m_ui.container);
156 m_ui.container->setWidget(view);
158 QVBoxLayout *vbox1 = new QVBoxLayout(view);
159 vbox1->setContentsMargins(0, 0, 0, 0);
160 vbox1->setSpacing(0);
162 if (m_currentEffectList.isEmpty()) m_ui.labelComment->setHidden(true);
164 for (int i = 0; i < m_currentEffectList.count(); i++) {
165 QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
167 kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
171 CollapsibleGroup *group = NULL;
172 EffectInfo effectInfo;
173 effectInfo.fromString(d.attribute("kdenlive_info"));
174 if (effectInfo.groupIndex >= 0) {
175 // effect is in a group
177 for (int j = 0; j < vbox1->count(); j++) {
178 CollapsibleGroup *eff = static_cast<CollapsibleGroup *>(vbox1->itemAt(j)->widget());
179 if (eff->isGroup() && eff->groupIndex() == effectInfo.groupIndex) {
186 group = new CollapsibleGroup(effectInfo.groupIndex, i == 0, i == m_currentEffectList.count() - 1, effectInfo.groupName, m_ui.container->widget());
187 connect(group, SIGNAL(moveEffect(int,int,int,QString)), this, SLOT(slotMoveEffect(int,int,int,QString)));
188 connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
189 connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this, SLOT(slotRenameGroup(CollapsibleGroup*)));
190 connect(group, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
191 connect(group, SIGNAL(deleteGroup(QDomDocument)), this , SLOT(slotDeleteGroup(QDomDocument)));
192 vbox1->addWidget(group);
193 group->installEventFilter( this );
195 if (effectInfo.groupIndex >= m_groupIndex) m_groupIndex = effectInfo.groupIndex + 1;
199 doc.appendChild(doc.importNode(d, true));
200 kDebug() << "IMPORTED STK: " << doc.toString();*/
203 bool isSelected = false;
204 if (m_effectMetaInfo.trackMode) {
205 info.track = m_trackInfo.type;
206 info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
207 info.cropStart = GenTime(0);
208 info.startPos = GenTime(-1);
212 info = m_clipref->info();
215 CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, view);
216 if (m_effectMetaInfo.trackMode) {
217 isSelected = currentEffect->effectIndex() == 1;
220 isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex();
222 if (isSelected) currentEffect->setActive(true);
223 m_effects.append(currentEffect);
225 group->addGroupEffect(currentEffect);
227 vbox1->addWidget(currentEffect);
231 currentEffect->installEventFilter( this );
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(slotMoveEffectUp(int , bool)));
239 connect(currentEffect, SIGNAL(effectStateChanged(bool,int,bool)), this, SLOT(slotUpdateEffectState(bool,int,bool)));
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,int,int,QString)), this , SLOT(slotMoveEffect(int,int,int,QString)));
245 connect(currentEffect, SIGNAL(addEffect(QDomElement)), this , SLOT(slotAddEffect(QDomElement)));
247 //ui.title->setPixmap(icon.pixmap(QSize(12, 12)));
249 vbox1->addStretch(10);
250 slotUpdateCheckAllButton();
251 connect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
253 // Wait a little bit for the new layout to be ready, then check if we have a scrollbar
254 QTimer::singleShot(200, this, SLOT(slotCheckWheelEventFilter()));
258 void EffectStackView2::slotCheckWheelEventFilter()
260 // If the effect stack widget has no scrollbar, we will not filter the
261 // mouse wheel events, so that user can easily adjust effect params
262 bool filterWheelEvent = false;
263 if (m_ui.container->verticalScrollBar() && m_ui.container->verticalScrollBar()->isVisible()) {
264 // widget has scroll bar,
265 filterWheelEvent = true;
267 for (int i = 0; i < m_effects.count(); i++) {
268 m_effects.at(i)->filterWheelEvent = filterWheelEvent;
272 void EffectStackView2::resizeEvent ( QResizeEvent * event )
274 slotCheckWheelEventFilter();
275 QWidget::resizeEvent(event);
278 bool EffectStackView2::eventFilter( QObject * o, QEvent * e )
280 // Check if user clicked in an effect's top bar to start dragging it
281 if (e->type() == QEvent::MouseButtonPress) {
282 m_draggedEffect = qobject_cast<CollapsibleEffect*>(o);
283 if (m_draggedEffect) {
284 QMouseEvent *me = static_cast<QMouseEvent *>(e);
285 if (me->button() == Qt::LeftButton && (m_draggedEffect->frame->underMouse() || m_draggedEffect->title->underMouse())) {
286 m_clickPoint = me->globalPos();
289 m_clickPoint = QPoint();
290 m_draggedEffect = NULL;
295 m_draggedGroup = qobject_cast<CollapsibleGroup*>(o);
296 if (m_draggedGroup) {
297 QMouseEvent *me = static_cast<QMouseEvent *>(e);
298 if (me->button() == Qt::LeftButton && (m_draggedGroup->framegroup->underMouse() || m_draggedGroup->title()->underMouse()))
299 m_clickPoint = me->globalPos();
301 m_clickPoint = QPoint();
302 m_draggedGroup = NULL;
308 /*if (e->type() == QEvent::MouseMove) {
309 if (qobject_cast<CollapsibleEffect*>(o)) {
310 QMouseEvent *me = static_cast<QMouseEvent *>(e);
311 if (me->buttons() != Qt::LeftButton) {
321 return QWidget::eventFilter(o, e);
324 void EffectStackView2::mouseMoveEvent(QMouseEvent * event)
326 if (m_draggedEffect || m_draggedGroup) {
327 if ((event->buttons() & Qt::LeftButton) && (m_clickPoint != QPoint()) && ((event->globalPos() - m_clickPoint).manhattanLength() >= QApplication::startDragDistance())) {
333 void EffectStackView2::mouseReleaseEvent(QMouseEvent * event)
335 m_draggedEffect = NULL;
336 m_draggedGroup = NULL;
337 QWidget::mouseReleaseEvent(event);
340 void EffectStackView2::startDrag()
342 // The data to be transferred by the drag and drop operation is contained in a QMimeData object
345 if (m_draggedEffect) {
346 QDomElement effect = m_draggedEffect->effect().cloneNode().toElement();
347 doc.appendChild(doc.importNode(effect, true));
348 pixmap = QPixmap::grabWidget(m_draggedEffect->title);
350 else if (m_draggedGroup) {
351 doc = m_draggedGroup->effectsData();
352 pixmap = QPixmap::grabWidget(m_draggedGroup->title());
355 QDrag *drag = new QDrag(this);
356 drag->setPixmap(pixmap);
357 QMimeData *mime = new QMimeData;
359 data.append(doc.toString().toUtf8());
360 mime->setData("kdenlive/effectslist", data);
362 // Assign ownership of the QMimeData object to the QDrag object.
363 drag->setMimeData(mime);
364 // Start the drag and drop operation
365 drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
369 void EffectStackView2::slotUpdateEffectState(bool disable, int index, bool updateMainStatus)
371 if (m_effectMetaInfo.trackMode)
372 emit changeEffectState(NULL, m_trackindex, index, disable);
374 emit changeEffectState(m_clipref, -1, index, disable);
375 if (updateMainStatus) slotUpdateCheckAllButton();
379 void EffectStackView2::raiseWindow(QWidget* dock)
381 if ((m_clipref || m_effectMetaInfo.trackMode) && dock)
386 void EffectStackView2::slotSeekTimeline(int pos)
388 if (m_effectMetaInfo.trackMode) {
389 emit seekTimeline(pos);
390 } else if (m_clipref) {
391 emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
396 /*void EffectStackView2::slotRegionChanged()
398 if (!m_trackMode) emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
401 void EffectStackView2::slotCheckMonitorPosition(int renderPos)
403 if (m_effectMetaInfo.trackMode || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
404 if (!m_effectMetaInfo.monitor->getEffectEdit()->getScene()->views().at(0)->isVisible())
405 m_effectMetaInfo.monitor->slotEffectScene(true);
407 m_effectMetaInfo.monitor->slotEffectScene(false);
411 int EffectStackView2::isTrackMode(bool *ok) const
413 *ok = m_effectMetaInfo.trackMode;
417 void EffectStackView2::clear()
420 QWidget *view = m_ui.container->takeWidget();
424 m_ui.checkAll->setToolTip(QString());
425 m_ui.checkAll->setText(QString());
426 m_ui.checkAll->setEnabled(false);
427 m_ui.labelComment->setText(QString());
431 void EffectStackView2::slotCheckAll(int state)
433 if (state == Qt::PartiallyChecked) {
435 m_ui.checkAll->blockSignals(true);
436 m_ui.checkAll->setCheckState(Qt::Checked);
437 m_ui.checkAll->blockSignals(false);
440 bool disabled = state == Qt::Unchecked;
441 for (int i = 0; i < m_effects.count(); i++) {
442 if (!m_effects.at(i)->isGroup()) {
443 m_effects.at(i)->slotEnable(disabled, false);
448 void EffectStackView2::slotUpdateCheckAllButton()
450 bool hasEnabled = false;
451 bool hasDisabled = false;
453 for (int i = 0; i < m_effects.count(); i++) {
454 if (!m_effects.at(i)->enabledButton->isChecked()) hasEnabled = true;
455 else hasDisabled = true;
458 m_ui.checkAll->blockSignals(true);
459 if (hasEnabled && hasDisabled)
460 m_ui.checkAll->setCheckState(Qt::PartiallyChecked);
462 m_ui.checkAll->setCheckState(Qt::Checked);
464 m_ui.checkAll->setCheckState(Qt::Unchecked);
465 m_ui.checkAll->blockSignals(false);
468 void EffectStackView2::deleteCurrentEffect()
470 for (int i = 0; i < m_effects.count(); i++) {
471 if (m_effects.at(i)->isActive()) {
472 slotDeleteEffect(m_effects.at(i)->effect());
478 void EffectStackView2::updateProjectFormat(MltVideoProfile profile, Timecode t)
480 m_effectMetaInfo.profile = profile;
481 m_effectMetaInfo.timecode = t;
484 void EffectStackView2::updateTimecodeFormat()
486 for (int i = 0; i< m_effects.count(); i++)
487 m_effects.at(i)->updateTimecodeFormat();
490 CollapsibleEffect *EffectStackView2::getEffectByIndex(int ix)
492 for (int i = 0; i< m_effects.count(); i++) {
493 if (m_effects.at(i)->effectIndex() == ix) {
494 return m_effects.at(i);
500 void EffectStackView2::slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix)
502 if (m_effectMetaInfo.trackMode)
503 emit updateEffect(NULL, m_trackindex, old, e, ix,false);
504 else if (m_clipref) {
505 emit updateEffect(m_clipref, -1, old, e, ix, false);
506 // Make sure the changed effect is currently displayed
507 slotSetCurrentEffect(ix);
509 QTimer::singleShot(200, this, SLOT(slotCheckWheelEventFilter()));
512 void EffectStackView2::slotSetCurrentEffect(int ix)
514 if (m_clipref && ix != m_clipref->selectedEffectIndex()) {
515 m_clipref->setSelectedEffect(ix);
516 for (int i = 0; i < m_effects.count(); i++) {
517 if (m_effects.at(i)->effectIndex() == ix) {
518 m_effects.at(i)->setActive(true);
519 m_ui.labelComment->setText(i18n(m_effects.at(i)->effect().firstChildElement("description").firstChildElement("full").text().toUtf8().data()));
520 m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
522 else m_effects.at(i)->setActive(false);
527 void EffectStackView2::slotDeleteGroup(QDomDocument doc)
529 QDomNodeList effects = doc.elementsByTagName("effect");
530 ClipItem * clip = NULL;
532 if (m_effectMetaInfo.trackMode) {
540 for (int i = 0; i < effects.count(); i++)
541 emit removeEffect(clip, ix, effects.at(i).toElement());
544 void EffectStackView2::slotDeleteEffect(const QDomElement effect)
546 if (m_effectMetaInfo.trackMode)
547 emit removeEffect(NULL, m_trackindex, effect);
549 emit removeEffect(m_clipref, -1, effect);
552 void EffectStackView2::slotAddEffect(QDomElement effect)
554 emit addEffect(m_clipref, effect);
557 void EffectStackView2::slotMoveEffectUp(int index, bool up)
559 if (up && index <= 1) return;
560 if (!up && index >= m_currentEffectList.count()) return;
568 if (m_effectMetaInfo.trackMode) emit changeEffectPosition(NULL, m_trackindex, index, endPos);
569 else emit changeEffectPosition(m_clipref, -1, index, endPos);
572 void EffectStackView2::slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties)
574 if (!m_clipref) return;
575 emit startFilterJob(m_clipref->info(), m_clipref->clipProducer(), filterName, filterParams, finalFilterName, consumer, consumerParams, properties);
578 void EffectStackView2::slotResetEffect(int ix)
580 QDomElement old = m_currentEffectList.itemFromIndex(ix);
582 QString effectId = old.attribute("id");
583 QMap<QString, EffectsList*> effectLists;
584 effectLists["audio"] = &MainWindow::audioEffects;
585 effectLists["video"] = &MainWindow::videoEffects;
586 effectLists["custom"] = &MainWindow::customEffects;
587 foreach(const QString &type, effectLists.keys()) {
588 EffectsList *list = effectLists[type];
589 dom = list->getEffectByTag(QString(), effectId).cloneNode().toElement();
590 if (!dom.isNull()) break;
593 dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
594 if (m_effectMetaInfo.trackMode) {
595 EffectsList::setParameter(dom, "in", QString::number(0));
596 EffectsList::setParameter(dom, "out", QString::number(m_trackInfo.duration));
598 info.track = m_trackInfo.type;
599 info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
600 info.cropStart = GenTime(0);
601 info.startPos = GenTime(-1);
603 m_effects.at(ix)->updateWidget(info, dom, &m_effectMetaInfo);
604 emit updateEffect(NULL, m_trackindex, old, dom, ix,false);
606 m_clipref->initEffect(dom);
607 for (int i = 0; i < m_effects.count(); i++) {
608 if (m_effects.at(i)->effectIndex() == ix) {
609 m_effects.at(i)->updateWidget(m_clipref->info(), dom, &m_effectMetaInfo);
613 //m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
614 emit updateEffect(m_clipref, -1, old, dom, ix,false);
618 emit showComments(m_ui.buttonShowComments->isChecked());
619 m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
622 void EffectStackView2::slotShowComments()
624 m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
625 emit showComments(m_ui.buttonShowComments->isChecked());
628 void EffectStackView2::slotCreateGroup(int ix)
630 QDomElement oldeffect = m_currentEffectList.itemFromIndex(ix);
631 QDomElement neweffect = oldeffect.cloneNode().toElement();
632 EffectInfo effectinfo;
633 effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
634 effectinfo.groupIndex = m_groupIndex;
635 neweffect.setAttribute("kdenlive_info", effectinfo.toString());
638 if (m_effectMetaInfo.trackMode) {
639 info.track = m_trackInfo.type;
640 info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
641 info.cropStart = GenTime(0);
642 info.startPos = GenTime(-1);
644 emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, ix, false);
646 emit updateEffect(m_clipref, -1, oldeffect, neweffect, ix, false);
649 QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
651 CollapsibleEffect *effectToMove = NULL;
652 for (int i = 0; i < m_effects.count(); i++) {
653 if (m_effects.at(i)->effectIndex() == ix) {
654 effectToMove = m_effects.at(i);
655 groupPos = l->indexOf(effectToMove);
656 l->removeWidget(effectToMove);
661 CollapsibleGroup *group = new CollapsibleGroup(m_groupIndex, ix == 1, ix == m_currentEffectList.count() - 2, QString(), m_ui.container->widget());
663 connect(group, SIGNAL(moveEffect(int,int,int,QString)), this , SLOT(slotMoveEffect(int,int,int,QString)));
664 connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
665 connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this , SLOT(slotRenameGroup(CollapsibleGroup*)));
666 connect(group, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
667 connect(group, SIGNAL(deleteGroup(QDomDocument)), this , SLOT(slotDeleteGroup(QDomDocument)));
668 l->insertWidget(groupPos, group);
669 group->installEventFilter( this );
670 group->addGroupEffect(effectToMove);
673 void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, int groupIndex, QString groupName)
675 CollapsibleEffect *effectToMove = getEffectByIndex(currentIndex);
676 if (effectToMove == NULL) return;
678 QDomElement oldeffect = effectToMove->effect();
679 QDomElement neweffect = oldeffect.cloneNode().toElement();
681 EffectInfo effectinfo;
682 effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
683 effectinfo.groupIndex = groupIndex;
684 effectinfo.groupName = groupName;
685 neweffect.setAttribute("kdenlive_info", effectinfo.toString());
688 if (m_effectMetaInfo.trackMode) {
689 info.track = m_trackInfo.type;
690 info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
691 info.cropStart = GenTime(0);
692 info.startPos = GenTime(-1);
694 emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->effectIndex(),false);
696 emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->effectIndex(),false);
698 //if (currentIndex == newIndex) return;
699 // Update effect index with new position
700 if (m_effectMetaInfo.trackMode) {
701 emit changeEffectPosition(NULL, m_trackindex, currentIndex, newIndex);
704 emit changeEffectPosition(m_clipref, -1, currentIndex, newIndex);
708 void EffectStackView2::slotUnGroup(CollapsibleGroup* group)
710 QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
711 int ix = l->indexOf(group);
712 group->removeGroup(ix, l);
713 group->deleteLater();
716 void EffectStackView2::slotRenameGroup(CollapsibleGroup *group)
718 QList <CollapsibleEffect*> effects = group->effects();
719 for (int i = 0; i < effects.count(); i++) {
720 QDomElement origin = effects.at(i)->effect();
721 QDomElement changed = origin.cloneNode().toElement();
722 changed.setAttribute("kdenlive_info", effects.at(i)->infoString());
723 if (m_effectMetaInfo.trackMode) {
724 emit updateEffect(NULL, m_trackindex, origin, changed, effects.at(i)->effectIndex(),false);
726 emit updateEffect(m_clipref, -1, origin, changed, effects.at(i)->effectIndex(),false);
731 #include "effectstackview2.moc"