]> git.sesse.net Git - kdenlive/blobdiff - src/customtrackview.h
Merge branch 'master' into feature/pkey
[kdenlive] / src / customtrackview.h
index d3f04980a8c24f292d8876410f3aa07863230c98..bdaa74615ced455dc0a4194b50fccfabb742d120 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);
@@ -69,11 +76,13 @@ public:
     void deleteClip(ItemInfo info, bool refresh = true);
     void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
     void slotDeleteAllClipMarkers(const QString &id);
-    void addMarker(const QString &id, const GenTime &pos, const QString &comment);
+    void addMarker(const QString &id, const CommentedTime marker);
+    void addData(const QString &id, const QString &key, const QString &data);
     void setScale(double scaleFactor, double verticalScale);
     void deleteClip(const QString &clipId);
+    /** @brief Add effect to current clip */
     void slotAddEffect(QDomElement effect, GenTime pos, int track);
-    void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
+    void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group, AbstractClipItem *dropTarget = NULL);
     void addEffect(int track, GenTime pos, QDomElement effect);
     void deleteEffect(int track, GenTime pos, QDomElement effect);
     void updateEffect(int track, GenTime pos, QDomElement insertedEffect, bool refreshEffectStack = false);
@@ -140,6 +149,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
@@ -188,9 +203,14 @@ public:
     bool hasAudio(int track) const;
 
     int getFrameWidth();
+    /** @brief Returns last requested seeking pos (or SEEK_INACTIVE if no seek). */
+    int seekPosition() const;
     
 public slots:
-    void setCursorPos(int pos, bool seek = true);
+    /** @brief Send seek request to MLT. */
+    void seekCursorPos(int pos);
+    /** @brief Move timeline cursor to new position. */
+    void setCursorPos(int pos);
     void moveCursorPos(int delta);
     void updateCursorPos();
     void slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup = true);
@@ -207,12 +227,16 @@ public slots:
     void slotSwitchTrackVideo(int ix);
     void slotSwitchTrackLock(int ix);
     void slotUpdateClip(const QString &clipId, bool reload = true);
-
+    
+    /** @brief Add extra data to a clip. */
+    void slotAddClipExtraData(const QString &id, const QString &key, const QString &data = QString(), QUndoCommand *groupCommand = 0);
     /** @brief Creates a AddClipCommand to add, edit or delete a marker.
      * @param id Id of the marker's clip
      * @param t Position of the marker
      * @param c Comment of the marker */
-    void slotAddClipMarker(const QString &id, GenTime t, QString c);
+    void slotAddClipMarker(const QString &id, QList <CommentedTime> newMarker, QUndoCommand *groupCommand = 0);
+    void slotLoadClipMarkers(const QString &id);
+    void slotSaveClipMarkers(const QString &id);
     bool addGuide(const GenTime &pos, const QString &comment);
 
     /** @brief Shows a dialog for adding a guide.
@@ -276,6 +300,12 @@ public slots:
     void updateSnapPoints(AbstractClipItem *selected, QList <GenTime> offsetList = QList <GenTime> (), bool skipSelectedItems = false);
     
     void slotAddEffect(ClipItem *clip, QDomElement effect);
+    void slotImportClipKeyframes(GRAPHICSRECTITEM type);
+
+    /** @brief Get effect parameters ready for MLT*/
+    static void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, MltVideoProfile profile, const QString &prefix = QString());
+       /** @brief Move playhead to mouse curser position if defined key is pressed */
+    void slotAlignPlayheadToMousePos();
 
 protected:
     virtual void drawBackground(QPainter * painter, const QRectF & rect);
@@ -361,6 +391,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;
@@ -446,10 +479,7 @@ private:
     void adjustEffects(ClipItem *item, ItemInfo oldInfo, QUndoCommand *command);
     
     /** @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());
+    void processEffect(ClipItem *item, QDomElement effect, int offset, QUndoCommand *effectCommand);
 
 private slots:
     void slotRefreshGuides();
@@ -467,7 +497,7 @@ private slots:
      *  @param resetThumbs Should we recreate the timeline thumbnails. */
     void slotRefreshThumbs(const QString &id, bool resetThumbs);
     /** @brief A Filter job producer results. */
-    void slotGotFilterJobResults(const QString &id, int startPos, int track, const QString &filter, stringMap filterParams);
+    void slotGotFilterJobResults(const QString &id, int startPos, int track, stringMap filterParams, stringMap extra);
 
 
 signals:
@@ -487,6 +517,7 @@ signals:
     void showClipFrame(DocClipBase *, QPoint, bool, const int);
     void doTrackLock(int, bool);
     void updateClipMarkers(DocClipBase *);
+    void updateClipExtraData(DocClipBase *);
     void updateTrackHeaders();
     void playMonitor();
     /** @brief Monitor document changes (for example the presence of audio data in timeline for export widget.*/
@@ -495,6 +526,10 @@ signals:
     void showTrackEffects(int, TrackInfo);
     /** @brief Update the track effect button that shows if a track has effects or not.*/
     void updateTrackEffectState(int);
+    /** @brief Cursor position changed, repaint ruler.*/
+    void updateRuler();
+    /** @brief Send data from a clip to be imported as keyframes for effect / transition.*/
+    void importKeyframes(GRAPHICSRECTITEM type, const QString&);
 };
 
 #endif