From 1d9ce4dd0538c76fb9513b9b05bf66c3186f44de Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 7 Nov 2012 23:53:03 +0100 Subject: [PATCH] Fix importing clip analysis to effect --- src/customtrackview.cpp | 30 +++++++++++++++++---------- src/effectstack/collapsibleeffect.cpp | 6 ++++++ src/effectstack/collapsibleeffect.h | 2 ++ src/effectstack/effectstackview2.cpp | 10 +++++++++ src/effectstack/effectstackview2.h | 3 +++ src/mainwindow.cpp | 1 + 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 57869bb2..435c2a16 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -7591,19 +7591,27 @@ void CustomTrackView::slotGotFilterJobResults(const QString &/*id*/, int startPo void CustomTrackView::slotImportClipKeyframes(GRAPHICSRECTITEM type) { - if (!m_selectionGroup) { - emit displayMessage(i18n("You need to select one clip and one transition"), ErrorMessage); - return; - } - // Make sure there is no collision - QList children = m_selectionGroup->childItems(); ClipItem *item = NULL; - for (int i = 0; i < children.count(); i++) { - if (children.at(i)->type() == AVWIDGET) { - item = (ClipItem*) children.at(i); - break; - } + if (type == TRANSITIONWIDGET) { + // We want to import keyframes to a transition + if (!m_selectionGroup) { + emit displayMessage(i18n("You need to select one clip and one transition"), ErrorMessage); + return; + } + // Make sure there is no collision + QList children = m_selectionGroup->childItems(); + for (int i = 0; i < children.count(); i++) { + if (children.at(i)->type() == AVWIDGET) { + item = (ClipItem*) children.at(i); + break; + } + } } + else { + // Import keyframes from current clip to its effect + if (m_dragItem) item = static_cast (m_dragItem); + } + if (!item) { emit displayMessage(i18n("No clip found"), ErrorMessage); return; diff --git a/src/effectstack/collapsibleeffect.cpp b/src/effectstack/collapsibleeffect.cpp index 8b5ca260..509392ba 100644 --- a/src/effectstack/collapsibleeffect.cpp +++ b/src/effectstack/collapsibleeffect.cpp @@ -597,3 +597,9 @@ void CollapsibleEffect::setRange(int inPoint , int outPoint) { m_paramWidget->setRange(inPoint, outPoint); } + +void CollapsibleEffect::setKeyframes(const QString data, int maximum) +{ + m_paramWidget->setKeyframes(data, maximum); +} + diff --git a/src/effectstack/collapsibleeffect.h b/src/effectstack/collapsibleeffect.h index 42d4aab4..53e0ec0b 100644 --- a/src/effectstack/collapsibleeffect.h +++ b/src/effectstack/collapsibleeffect.h @@ -75,6 +75,8 @@ public: bool needsMonitorEffectScene() const; /** @brief Set clip in / out points. */ void setRange(int inPoint , int outPoint); + /** @brief Import keyframes from a clip's data. */ + void setKeyframes(const QString data, int maximum); public slots: void slotSyncEffectsPos(int pos); diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp index 2c9ceb7a..d67f2bbc 100644 --- a/src/effectstack/effectstackview2.cpp +++ b/src/effectstack/effectstackview2.cpp @@ -954,6 +954,16 @@ void EffectStackView2::dropEvent(QDropEvent *event) processDroppedEffect(doc.documentElement(), event); } +void EffectStackView2::setKeyframes(const QString data, int maximum) +{ + for (int i = 0; i < m_effects.count(); i++) { + if (m_effects.at(i)->isActive()) { + m_effects.at(i)->setKeyframes(data, maximum); + break; + } + } +} + //static const QString EffectStackView2::getStyleSheet() { diff --git a/src/effectstack/effectstackview2.h b/src/effectstack/effectstackview2.h index 90b4e9cc..85a2163d 100644 --- a/src/effectstack/effectstackview2.h +++ b/src/effectstack/effectstackview2.h @@ -75,6 +75,9 @@ public: /** @brief Return the stylesheet required for effect parameters. */ static const QString getStyleSheet(); + /** @brief Import keyframes from the clip metadata */ + void setKeyframes(const QString data, int maximum); + protected: virtual void mouseMoveEvent(QMouseEvent * event); virtual void mouseReleaseEvent(QMouseEvent * event); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7f8917a3..9e817b2a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4571,6 +4571,7 @@ void MainWindow::slotProcessImportKeyframes(GRAPHICSRECTITEM type, const QString { if (type == AVWIDGET) { // This data should be sent to the effect stack + m_effectStack->setKeyframes(data, maximum); } else if (type == TRANSITIONWIDGET) { // This data should be sent to the transition stack -- 2.39.2