]> git.sesse.net Git - kdenlive/blobdiff - src/effectstack/effectstackview2.cpp
Merge branch 'master' into feature/pkey
[kdenlive] / src / effectstack / effectstackview2.cpp
index 08e3f25b27ead56b729ff86be85e990c35108ead..69c28d758bbdc7d01eae7b3f82dfa1c1ea434048 100644 (file)
@@ -103,12 +103,12 @@ void EffectStackView2::slotClipItemSelected(ClipItem* c)
         if (c) {
             QString cname = m_clipref->clipName();
             if (cname.length() > 30) {
-                m_ui.checkAll->setToolTip(i18n("Effects for %1").arg(cname));
+                m_ui.checkAll->setToolTip(i18n("Effects for %1"cname));
                 cname.truncate(27);
-                m_ui.checkAll->setText(i18n("Effects for %1").arg(cname) + "...");
+                m_ui.checkAll->setText(i18n("Effects for %1"cname) + "...");
             } else {
                 m_ui.checkAll->setToolTip(QString());
-                m_ui.checkAll->setText(i18n("Effects for %1").arg(cname));
+                m_ui.checkAll->setText(i18n("Effects for %1"cname));
             }
             m_ui.checkAll->setEnabled(true);
             QString size = c->baseClip()->getProperty("frame_size");
@@ -140,7 +140,8 @@ void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo info)
     m_trackInfo = info;
     setEnabled(true);
     m_ui.checkAll->setToolTip(QString());
-    m_ui.checkAll->setText(i18n("Effects for track %1").arg(info.trackName.isEmpty() ? QString::number(ix) : info.trackName));
+    m_ui.checkAll->setText(i18n("Effects for track %1", info.trackName.isEmpty() ? QString::number(ix) : info.trackName));
+    m_ui.checkAll->setEnabled(true);
     m_trackindex = ix;
     setupListView();
 }
@@ -149,7 +150,6 @@ void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo info)
 void EffectStackView2::setupListView()
 {
     blockSignals(true);
-    bool previousMonitorScene = m_monitorSceneWanted;
     m_monitorSceneWanted = false;
     m_draggedEffect = NULL;
     m_draggedGroup = NULL;
@@ -171,9 +171,11 @@ void EffectStackView2::setupListView()
     int effectsCount = m_currentEffectList.count();
 
     // Make sure we always have one effect selected
-    int selectedEffect = m_clipref->selectedEffectIndex();
-    if (selectedEffect < 1 && effectsCount > 0) m_clipref->setSelectedEffect(1);
-    else if (selectedEffect > effectsCount) m_clipref->setSelectedEffect(effectsCount);
+    if (!m_effectMetaInfo.trackMode) {
+        int selectedEffect = m_clipref->selectedEffectIndex();
+        if (selectedEffect < 1 && effectsCount > 0) m_clipref->setSelectedEffect(1);
+        else if (selectedEffect > effectsCount) m_clipref->setSelectedEffect(effectsCount);
+    }
 
     for (int i = 0; i < effectsCount; i++) {
         QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
@@ -255,8 +257,8 @@ void EffectStackView2::setupListView()
 
     vbox1->addStretch(10);
     slotUpdateCheckAllButton();
-    if (previousMonitorScene && !m_monitorSceneWanted) {
-        // monitor scene was displayed, not wanted anymore
+    if (!m_monitorSceneWanted) {
+        // monitor scene not wanted
         m_effectMetaInfo.monitor->slotShowEffectScene(false);
     }
 
@@ -269,7 +271,7 @@ void EffectStackView2::connectEffect(CollapsibleEffect *currentEffect)
     // Check drag & drop
     currentEffect->installEventFilter( this );
     connect(currentEffect, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement, int)));
-    connect(currentEffect, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)), this , SLOT(slotStartFilterJob(QString,QString,QString,QString,QString,QString)));
+    connect(currentEffect, SIGNAL(startFilterJob(QString,QString,QString,QString,const QMap <QString, QString>)), this , SLOT(slotStartFilterJob(QString,QString,QString,QString,const QMap <QString, QString>)));
     connect(currentEffect, SIGNAL(deleteEffect(const QDomElement)), this , SLOT(slotDeleteEffect(const QDomElement)));
     connect(currentEffect, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
     connect(currentEffect, SIGNAL(resetEffect(int)), this , SLOT(slotResetEffect(int)));
@@ -282,6 +284,7 @@ void EffectStackView2::connectEffect(CollapsibleEffect *currentEffect)
     connect(currentEffect, SIGNAL(addEffect(QDomElement)), this , SLOT(slotAddEffect(QDomElement)));
     connect(currentEffect, SIGNAL(createRegion(int,KUrl)), this, SLOT(slotCreateRegion(int,KUrl)));
     connect(currentEffect, SIGNAL(deleteGroup(QDomDocument)), this , SLOT(slotDeleteGroup(QDomDocument)));
+    connect(currentEffect, SIGNAL(importClipKeyframes()), this, SIGNAL(importClipKeyframes()));
 }
 
 void EffectStackView2::slotCheckWheelEventFilter()
@@ -373,11 +376,25 @@ void EffectStackView2::startDrag()
     QPixmap pixmap;
     if (m_draggedEffect) {
         QDomElement effect = m_draggedEffect->effect().cloneNode().toElement();
+       if (m_effectMetaInfo.trackMode) {
+           // Keep clip crop start in case we want to paste effect 
+           effect.setAttribute("clipstart", 0);
+       }
+       else {
+           // Keep clip crop start in case we want to paste effect
+           effect.setAttribute("clipstart", m_clipref->cropStart().frames(KdenliveSettings::project_fps()));
+       }
         doc.appendChild(doc.importNode(effect, true));
         pixmap = QPixmap::grabWidget(m_draggedEffect->title);
     }
     else if (m_draggedGroup) {
         doc = m_draggedGroup->effectsData();
+       if (m_effectMetaInfo.trackMode) {
+           doc.documentElement().setAttribute("clipstart", 0);
+       }
+       else {
+           doc.documentElement().setAttribute("clipstart", m_clipref->cropStart().frames(KdenliveSettings::project_fps()));
+       }
         pixmap = QPixmap::grabWidget(m_draggedGroup->title());
     }
     else return;
@@ -485,7 +502,7 @@ void EffectStackView2::slotCheckAll(int state)
     // Disable all effects
     QList <int> indexes;
     for (int i = 0; i < m_effects.count(); i++) {
-        m_effects.at(i)->slotEnable(disabled, false);
+        m_effects.at(i)->slotDisable(disabled, false);
         indexes << m_effects.at(i)->effectIndex();
     }
     // Take care of groups
@@ -627,10 +644,10 @@ void EffectStackView2::slotMoveEffectUp(QList <int> indexes, bool up)
     else emit changeEffectPosition(m_clipref, -1, indexes, endPos);
 }
 
-void EffectStackView2::slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties)
+void EffectStackView2::slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&consumer, const QString&consumerParams, const QMap <QString, QString> &extraParams)
 {
     if (!m_clipref) return;
-    emit startFilterJob(m_clipref->info(), m_clipref->clipProducer(), filterName, filterParams, finalFilterName, consumer, consumerParams, properties);
+    emit startFilterJob(m_clipref->info(), m_clipref->clipProducer(), filterName, filterParams, consumer, consumerParams, extraParams);
 }
 
 void EffectStackView2::slotResetEffect(int ix)
@@ -658,7 +675,12 @@ void EffectStackView2::slotResetEffect(int ix)
             info.cropStart = GenTime(0);
             info.startPos = GenTime(-1);
             info.track = 0;
-            m_effects.at(ix)->updateWidget(info, dom, &m_effectMetaInfo);
+            for (int i = 0; i < m_effects.count(); i++) {
+                if (m_effects.at(i)->effectIndex() == ix) {
+                    m_effects.at(i)->updateWidget(info, dom, &m_effectMetaInfo);
+                    break;
+                }
+            }
             emit updateEffect(NULL, m_trackindex, old, dom, ix,false);
         } else {
             m_clipref->initEffect(dom);
@@ -708,7 +730,7 @@ void EffectStackView2::slotCreateRegion(int ix, KUrl url)
         info.startPos = GenTime(-1);
         info.track = 0;
     }
-    else {
+    else if (m_clipref) {
         info = m_clipref->info();
     }
     CollapsibleEffect *current = getEffectByIndex(ix);
@@ -723,7 +745,7 @@ void EffectStackView2::slotCreateRegion(int ix, KUrl url)
     if (m_effectMetaInfo.trackMode) {
         isSelected = currentEffect->effectIndex() == 1;
     }
-    else {
+    else if (m_clipref) {
         isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex();
     }
     if (isSelected) currentEffect->setActive(true);
@@ -781,7 +803,8 @@ void EffectStackView2::slotCreateGroup(int ix)
     connectGroup(group);
     l->insertWidget(groupPos, group);
     group->installEventFilter( this );
-    group->addGroupEffect(effectToMove);
+    if (effectToMove)
+        group->addGroupEffect(effectToMove);
 }
 
 void EffectStackView2::connectGroup(CollapsibleGroup *group)