]> git.sesse.net Git - kdenlive/blobdiff - src/customtrackview.h
Enter 2012.
[kdenlive] / src / customtrackview.h
index 6a66ae68c253e59b88a21b98c571e0f49753011d..0df31b42816866a99f5f32ba566e4af022712d99 100644 (file)
@@ -42,6 +42,7 @@ class ClipItem;
 class AbstractClipItem;
 class AbstractGroupItem;
 class Transition;
+class AudioCorrelation;
 
 class CustomTrackView : public QGraphicsView
 {
@@ -60,7 +61,13 @@ public:
     void configTracks(QList <TrackInfo> trackInfos);
     int cursorPos();
     void checkAutoScroll();
-    void moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh);
+    /**
+      Move the clip at \c start to \c end.
+
+      If \c out_actualEnd is not NULL, it will be set to the position the clip really ended up at.
+      For example, attempting to move a clip to t = -1 s will actually move it to t = 0 s.
+      */
+    bool moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh, ItemInfo *out_actualEnd = NULL);
     void moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> startTransition, const GenTime &offset, const int trackOffset, bool reverseMove = false);
     /** move transition, startPos = (old start, old end), endPos = (new start, new end) */
     void moveTransition(const ItemInfo &start, const ItemInfo &end, bool refresh);
@@ -76,8 +83,10 @@ public:
     void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
     void addEffect(int track, GenTime pos, QDomElement effect);
     void deleteEffect(int track, GenTime pos, QDomElement effect);
-    void updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool triggeredByUser = true);
-    void moveEffect(int track, GenTime pos, int oldPos, int newPos);
+    void updateEffect(int track, GenTime pos, QDomElement insertedEffect, bool refreshEffectStack = false);
+    /** @brief Enable / disable a list of effects */
+    void updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack);
+    void moveEffect(int track, GenTime pos, QList <int> oldPos, QList <int> newPos);
     void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
     void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
     void updateTransition(int track, GenTime pos,  QDomElement oldTransition, QDomElement transition, bool updateTransitionWidget);
@@ -138,6 +147,12 @@ public:
     /** @brief Creates SplitAudioCommands for selected clips. */
     void splitAudio();
 
+    /// Define which clip to take as reference for automatic audio alignment
+    void setAudioAlignReference();
+
+    /// Automatically align the currently selected clips to synchronize their audio with the reference's audio
+    void alignAudio();
+
     /** @brief Seperates the audio of a clip to a audio track.
     * @param pos Position of the clip to split
     * @param track Track of the clip
@@ -192,9 +207,9 @@ public slots:
     void moveCursorPos(int delta);
     void updateCursorPos();
     void slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup = true);
-    void slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable);
-    void slotChangeEffectPosition(ClipItem *clip, int track, int currentPos, int newPos);
-    void slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix);
+    void slotChangeEffectState(ClipItem *clip, int track, QList <int> effectIndexes, bool disable);
+    void slotChangeEffectPosition(ClipItem *clip, int track, QList <int> currentPos, int newPos);
+    void slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix, bool refreshEffectStack = true);
     void slotUpdateClipRegion(ClipItem *clip, int ix, QString region);
     void slotRefreshEffects(ClipItem *clip);
     void setDuration(int duration);
@@ -317,6 +332,7 @@ private:
     ClipItem *getClipItemAt(GenTime pos, int track);
     ClipItem *getClipItemAtEnd(GenTime pos, int track);
     ClipItem *getClipItemAtStart(GenTime pos, int track);
+    Transition *getTransitionItem(TransitionInfo info);
     Transition *getTransitionItemAt(int pos, int track);
     Transition *getTransitionItemAt(GenTime pos, int track);
     Transition *getTransitionItemAtEnd(GenTime pos, int track);
@@ -358,6 +374,9 @@ private:
     QWaitCondition m_producerNotReady;
     KStatefulBrush m_activeTrackBrush;
 
+    AudioCorrelation *m_audioCorrelator;
+    ClipItem *m_audioAlignmentReference;
+
     /** stores the state of the control modifier during mouse press.
      * Will then be used to identify whether we resize a group or only one item of it. */
     bool m_controlModifier;
@@ -444,6 +463,9 @@ private:
     
     /** @brief Prepare an add clip command for an effect */
     void processEffect(ClipItem *item, QDomElement effect, QUndoCommand *effectCommand);
+    
+    /** @brief Get effect parameters ready for MLT*/
+    void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, const QString &prefix = QString());
 
 private slots:
     void slotRefreshGuides();
@@ -471,9 +493,8 @@ signals:
     void mousePosition(int);
     /** @brief A clip was selected in timeline, update the effect stack
      *  @param clip The clip
-     *  @param ix The index of currently selected effect
      *  @param raise If true, the effect stack widget will be raised (come to front). */
-    void clipItemSelected(ClipItem *clip, int ix = -1, bool raise = true);
+    void clipItemSelected(ClipItem *clip, bool raise = true);
     void transitionItemSelected(Transition*, int track = 0, QPoint p = QPoint(), bool update = false);
     void activateDocumentMonitor();
     void trackHeightChanged();