]> git.sesse.net Git - kdenlive/commitdiff
Merge branch 'master' of git://anongit.kde.org/kdenlive
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 13 Apr 2012 17:30:52 +0000 (19:30 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 13 Apr 2012 17:30:52 +0000 (19:30 +0200)
src/effectstack/collapsibleeffect.cpp
src/effectstack/collapsibleeffect.h
src/effectstack/effectstackview2.cpp
src/effectstack/effectstackview2.h
src/effectstackedit.cpp
src/effectstackedit.h

index 0bf2bb2e0bf6b4f961713714e7b4d349901e1523..e8d1d82770f588fdae643888d65b0bfe5cd15307 100644 (file)
@@ -1334,6 +1334,11 @@ QString ParameterContainer::getWipeString(wipeInfo info)
     return QString(start + ";-1=" + end);
 }
 
+void ParameterContainer::updateParameter(const QString &key, const QString &value)
+{
+    m_effect.setAttribute(key, value);
+}
+
 void ParameterContainer::slotStartFilterJobAction()
 {
     QDomNodeList namenode = m_effect.elementsByTagName("parameter");
index 07132f1a131ada748aa1f2f9bf7d878062169cbb..35bafcc53b60da952df23a9062674c70c6b26724 100644 (file)
@@ -73,6 +73,7 @@ public:
     ~ParameterContainer();
     void updateTimecodeFormat();
     void updateProjectFormat(MltVideoProfile profile, Timecode t);
+    void updateParameter(const QString &key, const QString &value);
 
 private slots:
     void slotCollectAllParameters();
index 27f77f42722e6bd7bd9551b30cc9ad9871640ed6..22b9f91c1e10f8f4fb5ae361d1ed7ed2bbac84d9 100644 (file)
@@ -54,6 +54,7 @@ EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
     m_effectMetaInfo.trackMode = false;
     m_effectMetaInfo.monitor = monitor;
     m_effects = QList <CollapsibleEffect*>();
+    setAcceptDrops(true);
 
     m_ui.setupUi(this);
     setFont(KGlobalSettings::smallestReadableFont());
@@ -788,4 +789,56 @@ void EffectStackView2::slotRenameGroup(CollapsibleGroup *group)
     }
 }
 
+void EffectStackView2::dragEnterEvent(QDragEnterEvent *event)
+{
+    if (event->mimeData()->hasFormat("kdenlive/effectslist")) {
+       event->acceptProposedAction();
+    }
+}
+
+void EffectStackView2::dropEvent(QDropEvent *event)
+{
+    const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
+    //event->acceptProposedAction();
+    QDomDocument doc;
+    doc.setContent(effects, true);
+    QDomElement e = doc.documentElement();
+    int ix = e.attribute("kdenlive_ix").toInt();
+    if (e.tagName() == "effectgroup") {
+       // We are dropping a group, all effects in group should be moved
+       QDomNodeList effects = e.elementsByTagName("effect");
+       if (effects.count() == 0) {
+           event->ignore();
+           return;
+       }
+       EffectInfo info;
+       info.fromString(effects.at(0).toElement().attribute("kdenlive_info"));
+       if (info.groupIndex < 0) {
+           // Adding a new group effect to the stack
+           event->setDropAction(Qt::CopyAction);
+           event->accept();
+           slotAddEffect(e);
+           return;
+       }
+       for (int i = 0; i < effects.count(); i++) {
+           //TODO: not working because wee need to move all effects in one go
+           slotMoveEffect(effects.at(i).toElement().attribute("kdenlive_ix").toInt(), m_currentEffectList.count() + 1 + i, info.groupIndex, info.groupName);
+       }
+    }
+    else if (ix == 0) {
+       // effect dropped from effects list, add it
+       e.setAttribute("kdenlive_ix", m_currentEffectList.count() + 1);
+       event->setDropAction(Qt::CopyAction);
+       event->accept();
+       slotAddEffect(e);
+       return;
+    }
+    else {
+       // User is moving an effect
+       slotMoveEffect(ix, m_currentEffectList.count() + 1, -1);
+    }
+    event->setDropAction(Qt::MoveAction);
+    event->accept();
+}
+
 #include "effectstackview2.moc"
index 2a1da03202313c1d52e09b9c1cb96df650cdd437..251777276445ba12d11478f139e4b28eea6fa120 100644 (file)
@@ -74,6 +74,8 @@ protected:
     virtual void mouseMoveEvent(QMouseEvent * event);
     virtual void mouseReleaseEvent(QMouseEvent * event);
     virtual void resizeEvent ( QResizeEvent * event );
+    virtual void dragEnterEvent(QDragEnterEvent *event);
+    virtual void dropEvent(QDropEvent *event);
   
 private:
     Ui::EffectStack2_UI m_ui;
index 8ec639f43889f63e0c1c59df571032e8fbcd6af3..85a526f12e5d5431a2f137ed36ef5662191f0569 100644 (file)
@@ -174,7 +174,7 @@ void EffectStackEdit::meetDependency(const QString& name, QString type, QString
 
 void EffectStackEdit::updateParameter(const QString &name, const QString &value)
 {
-    m_params.setAttribute(name, value);
+    m_paramWidget->updateParameter(name, value);
 
     if (name == "disable") {
         // if effect is disabled, disable parameters widget
@@ -855,18 +855,5 @@ void EffectStackEdit::slotSyncEffectsPos(int pos)
     emit syncEffectsPos(pos);
 }
 
-void EffectStackEdit::slotStartFilterJobAction()
-{
-    QDomNodeList namenode = m_params.elementsByTagName("parameter");
-    for (int i = 0; i < namenode.count() ; i++) {
-        QDomElement pa = namenode.item(i).toElement();
-        QString type = pa.attribute("type");
-        if (type == "filterjob") {
-            emit startFilterJob(pa.attribute("filtertag"), pa.attribute("filterparams"), pa.attribute("finalfilter"), pa.attribute("consumer"), pa.attribute("consumerparams"), pa.attribute("wantedproperties"));
-            kDebug()<<" - - -PROPS:\n"<<pa.attribute("filtertag")<<"-"<< pa.attribute("filterparams")<<"-"<< pa.attribute("consumer")<<"-"<< pa.attribute("consumerparams")<<"-"<< pa.attribute("wantedproperties");
-            break;
-        }
-    }
-}
 
 
index 257dfb157564b819af41f385c948aa630f45aea5..3697e2140fa20a1ebcddf73758029e7f31673259 100644 (file)
@@ -66,7 +66,6 @@ private:
 
     QVBoxLayout *m_vbox;
     QList<QWidget*> m_uiItems;
-    QDomElement m_params;
     QMap<QString, QWidget*> m_valueItems;
     int m_in;
     int m_out;
@@ -88,9 +87,6 @@ public slots:
 
     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
     void slotSyncEffectsPos(int pos);
-    
-private slots:
-    void slotStartFilterJobAction();
 
 signals:
     void parameterChanged(const QDomElement, const QDomElement, int);