]> git.sesse.net Git - kdenlive/commitdiff
Keep timeline cursor position in sync with local timelines of effects:
authorTill Theato <root@ttill.de>
Thu, 12 Aug 2010 21:50:47 +0000 (21:50 +0000)
committerTill Theato <root@ttill.de>
Thu, 12 Aug 2010 21:50:47 +0000 (21:50 +0000)
http://kdenlive.org/mantis/view.php?id=550

svn path=/trunk/kdenlive/; revision=4709

src/effectstackedit.cpp
src/effectstackedit.h
src/effectstackview.cpp
src/effectstackview.h
src/geometryval.cpp
src/geometryval.h
src/geometrywidget.cpp
src/geometrywidget.h
src/transitionsettings.cpp
src/transitionsettings.h

index b3bda1440b834a7f8b5800ec3a0889045e8e3b8b..2c20c8fd4e558388f91913f1bfea92d5823eb97e 100644 (file)
@@ -275,6 +275,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
                 connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
                 connect(geometry, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
+                connect(this, SIGNAL(syncEffectsPos(int)), geometry, SLOT(slotSyncPosition(int)));
             } else {
                 Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, pos);
                 if (minFrame == maxFrame)
@@ -285,6 +286,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 m_valueItems[paramName+"geometry"] = geo;
                 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
                 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
+                connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
             }
         } else if (type == "keyframe" || type == "simplekeyframe") {
             // keyframe editor widget
@@ -692,3 +694,8 @@ void EffectStackEdit::clearAllItems()
     m_keyframeEditor = NULL;
     blockSignals(false);
 }
+
+void EffectStackEdit::slotSyncEffectsPos(int pos)
+{
+    emit syncEffectsPos(pos);
+}
index 78e7b52a43e6acffc5e36c919b1fb0bac17e44f2..ce9eaa1bb97d3fa540a9bd4646f9058a6d3ba891 100644 (file)
@@ -79,12 +79,14 @@ public slots:
      *
      * Transfers all Dynamic gui parameter settings into m_params(??) */
     void collectAllParameters();
+    void slotSyncEffectsPos(int pos);
 
 signals:
     void parameterChanged(const QDomElement, const QDomElement);
     void seekTimeline(int);
     void displayMessage(const QString&, int);
     void checkMonitorPosition(int);
+    void syncEffectsPos(int pos);
 };
 
 #endif
index 9509421f7e365f15bf195354de36ffa9358ad091..8f11455ba3e583ecae12c88a835b61f7d944c63c 100644 (file)
@@ -85,6 +85,7 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) :
     connect(m_effectedit, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
     connect(m_effectedit, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
     connect(m_effectedit, SIGNAL(checkMonitorPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
+    connect(monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
     m_effectLists["audio"] = &MainWindow::audioEffects;
     m_effectLists["video"] = &MainWindow::videoEffects;
     m_effectLists["custom"] = &MainWindow::customEffects;
@@ -407,4 +408,10 @@ void EffectStackView::slotCheckMonitorPosition(int renderPos)
     }
 }
 
+void EffectStackView::slotRenderPos(int pos)
+{
+    if (m_clipref)
+        m_effectedit->slotSyncEffectsPos(pos - m_clipref->startPos().frames(KdenliveSettings::project_fps()));
+}
+
 #include "effectstackview.moc"
index 4744fbff14b7d67b67265439e3e05e797bac7980..d012701412dfcd650f5270a6da0f63b3e9f25918 100644 (file)
@@ -116,8 +116,12 @@ private slots:
     /** @brief Define the region filter for current effect. */
     void slotRegionChanged();
 
+    /** @brief Checks whether the monitor scene has to be displayed. */
     void slotCheckMonitorPosition(int renderPos);
 
+    /** @brief Pass position changes in project monitor/timline to the effects to keep their local timelines in sync. */
+    void slotRenderPos(int pos);
+
 signals:
     void removeEffect(ClipItem*, QDomElement);
     /**  Parameters for an effect changed, update the filter in playlist */
index 9fb81d6e50beb22ba05e3f6a306cb46b69cb8f31..a4879463a0cd30241e1c2cb413d070a0b8c1e091 100644 (file)
@@ -423,6 +423,16 @@ void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame)
     connect(spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int)));
 }
 
+void Geometryval::slotSyncPosition(int relTimelinePos)
+{
+    if (m_timePos.maximum() > 0 && KdenliveSettings::transitionfollowcursor()) {
+        relTimelinePos = qMax(0, relTimelinePos);
+        relTimelinePos = qMin(relTimelinePos, m_timePos.maximum());
+        if (relTimelinePos != m_timePos.getValue())
+            slotPositionChanged(relTimelinePos, false);
+    }
+}
+
 void Geometryval::updateTransitionPath()
 {
     if (m_fixedMode) return;
index 1eee0374978522ae9696cd3b3fd3d5e4ff6240a9..3bacb18d26396754b2be91b38a98b579d7af09ba 100644 (file)
@@ -72,6 +72,8 @@ private:
 
 public slots:
     void setupParam(const QDomElement, int minframe, int maxframe);
+    /** @brief Updates position of the local timeline to @param relTimelinePos.  */
+    void slotSyncPosition(int relTimelinePos);
 
 private slots:
     void slotNextFrame();
index 72572e44ab63779e225639a7b3ad11e9a7f0f13e..ad20fefc16ed71e8770f0c4375b3df1e8b3f772c 100644 (file)
@@ -108,7 +108,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
 
     m_scene = monitor->getEffectScene();
     connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateGeometry()));
-    connect(m_monitor->render, SIGNAL(rendererPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
+    connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
     connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties()));
 }
 
@@ -147,6 +147,7 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
         // Keyframes are disabled
         m_ui.widgetTimeWrapper->setHidden(true);
     } else {
+        m_ui.widgetTimeWrapper->setHidden(false);
         m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint - 1);
         m_timeline->update();
         m_timePos->setRange(0, m_outPoint - m_inPoint - 1);
@@ -172,6 +173,16 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
     slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
 }
 
+void GeometryWidget::slotSyncPosition(int relTimelinePos)
+{
+    if (m_timePos->maximum() > 0 && KdenliveSettings::transitionfollowcursor()) {
+        relTimelinePos = qMax(0, relTimelinePos);
+        relTimelinePos = qMin(relTimelinePos, m_timePos->maximum());
+        if (relTimelinePos != m_timePos->getValue())
+            slotPositionChanged(relTimelinePos, false);
+    }
+}
+
 
 void GeometryWidget::slotPositionChanged(int pos, bool seek)
 {
index 35369f434154e2d27016ccf26dde65934da3b968..18ff8622d2049766f5b39fe904be494952322a4f 100644 (file)
@@ -55,6 +55,8 @@ public slots:
     * @param minframe In point of the clip
     * @param maxframe Out point of the clip */
     void setupParam(const QDomElement elem, int minframe, int maxframe);
+    /** @brief Updates position of the local timeline to @param relTimelinePos.  */
+    void slotSyncPosition(int relTimelinePos);
 
 private:
     Ui::GeometryWidget_UI m_ui;
index 68f6651f5684d5b2c0cae5d14bd3bebb7ff14765..e7984f19d16bef67f80522e3fff315762d1fa6db 100644 (file)
@@ -63,6 +63,7 @@ TransitionSettings::TransitionSettings(Monitor *monitor, QWidget* parent) :
     connect(transitionList, SIGNAL(activated(int)), this, SLOT(slotTransitionChanged()));
     connect(transitionTrack, SIGNAL(activated(int)), this, SLOT(slotTransitionTrackChanged()));
     connect(m_effectEdit, SIGNAL(parameterChanged(const QDomElement&, const QDomElement&)), this , SLOT(slotUpdateEffectParams(const QDomElement&, const QDomElement&)));
+    connect(monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
 }
 
 void TransitionSettings::updateProjectFormat(MltVideoProfile profile, Timecode t, const QList <TrackInfo> info)
@@ -205,3 +206,10 @@ void TransitionSettings::raiseWindow(QWidget* dock)
 
 }
 
+void TransitionSettings::slotRenderPos(int pos)
+{
+    if (m_usedTransition)
+        m_effectEdit->slotSyncEffectsPos(pos - m_usedTransition->startPos().frames(KdenliveSettings::project_fps()));
+}
+
+#include "transitionsettings.moc"
index 0a31e2a0550a1ea73fbf9d60f961218e4f41eb3c..81d652c110ce228dd401898f7bb275160f5f52e8 100644 (file)
@@ -53,9 +53,10 @@ public slots:
     void slotUpdateEffectParams(const QDomElement&, const QDomElement&);
 
 private slots:
-
     /** @brief Sets the new B track for the transition (automatic or forced). */
     void slotTransitionTrackChanged();
+    /** @brief Pass position changes in project monitor/timline to the effects to keep their local timelines in sync. */
+    void slotRenderPos(int pos);
 
 signals:
     void transitionUpdated(Transition *, QDomElement);