X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcustomtrackview.h;h=11e65110a256e0a2dd4d897812af5e9493ec7d37;hb=12c52e2d2e97f703714b83dfd385db2de5f03f18;hp=50ad4932e73bfc160228a80092fc79e075278384;hpb=4cf9cdc9891b0ce00d5818320f942349946d695b;p=kdenlive diff --git a/src/customtrackview.h b/src/customtrackview.h index 50ad4932..11e65110 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -22,12 +22,15 @@ #define CUSTOMTRACKVIEW_H #include +#include #include #include #include #include #include +#include +#include #include "kdenlivedoc.h" #include "docclipbase.h" @@ -40,6 +43,7 @@ class AbstractClipItem; class AbstractGroupItem; class Transition; + class CustomTrackView : public QGraphicsView { Q_OBJECT @@ -82,6 +86,7 @@ public: void activateMonitor(); int duration() const; void deleteSelectedClips(); + /** @brief Cuts all clips that are selected at the timeline cursor position. */ void cutSelectedClips(); void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup, QMenu *markermenu); void checkTrackHeight(); @@ -124,9 +129,10 @@ public: /** @brief Locks or unlocks a track. * @param ix number of track * @param lock whether to lock or unlock + * @param requestUpdate (default = true) Whether to request an update of the icon in the track header * * Makes sure no clip on track to lock is selected. */ - void lockTrack(int ix, bool lock); + void lockTrack(int ix, bool lock, bool requestUpdate = true); void groupClips(bool group = true); void doGroupClips(QList clipInfos, QList transitionInfos, bool group); void loadGroups(const QDomNodeList groups); @@ -174,15 +180,20 @@ public: KPixmapCache* pixmapCache; /** update the timeline objects when palette changes */ void updatePalette(); + /** @brief Returns true if a track has audio data on it. + * @param track The track number + * + * Check whether given track has a clip with audio in it. */ + bool hasAudio(int track) const; public slots: void setCursorPos(int pos, bool seek = true); void moveCursorPos(int delta); void updateCursorPos(); - void slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup = true); - void slotChangeEffectState(ClipItem *clip, int effectPos, bool disable); - void slotChangeEffectPosition(ClipItem *clip, int currentPos, int newPos); - void slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect, int ix); + 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 slotUpdateClipRegion(ClipItem *clip, int ix, QString region); void slotRefreshEffects(ClipItem *clip); void setDuration(int duration); @@ -193,9 +204,17 @@ public slots: void slotSwitchTrackVideo(int ix); void slotSwitchTrackLock(int ix); void slotUpdateClip(const QString &clipId, bool reload = true); + + /** @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); bool addGuide(const GenTime pos, const QString &comment); - void slotAddGuide(); + + /** @brief Shows a dialog for adding a guide. + * @param dialog (default = true) false = do not show the dialog but use current position as position and comment */ + void slotAddGuide(bool dialog = true); void slotEditGuide(CommentedTime guide); void slotEditGuide(int guidePos = -1); void slotDeleteGuide(int guidePos = -1); @@ -219,6 +238,36 @@ public slots: void slotSelectTrack(int ix); void insertZoneOverwrite(QStringList data, int in); + /** @brief Rebuilds a group to fit again after children changed. + * @param childTrack the track of one of the groups children + * @param childPos The position of the same child */ + void rebuildGroup(int childTrack, GenTime childPos); + /** @brief Rebuilds a group to fit again after children changed. + * @param group The group to rebuild */ + void rebuildGroup(AbstractGroupItem *group); + + /** @brief Cuts a group into two parts. + * @param clips1 Clips before the cut + * @param transitions1 Transitions before the cut + * @param clipsCut Clips that need to be cut + * @param transitionsCut Transitions that need to be cut + * @param clips2 Clips behind the cut + * @param transitions2 Transitions behind the cut + * @param cutPos Absolute position of the cut + * @param cut true = cut, false = "uncut" */ + void slotRazorGroup(QList clips1, QList transitions1, QList clipsCut, QList transitionsCut, QList clips2, QList transitions2, GenTime cutPos, bool cut); + + /** @brief Add en effect to a track. + * @param effect The new effect xml + * @param ix The track index */ + void slotAddTrackEffect(const QDomElement effect, int ix); + + /** @brief Update the list of snap points (sticky timeline hotspots). + * @param selected The currently selected clip if any + * @param offsetList The list of points that should also snap (for example when movin a clip, start and end points should snap + * @param skipSelectedItems if true, the selected item start and end points will not be added to snap list */ + void updateSnapPoints(AbstractClipItem *selected, QList offsetList = QList (), bool skipSelectedItems = false); + protected: virtual void drawBackground(QPainter * painter, const QRectF & rect); //virtual void drawForeground ( QPainter * painter, const QRectF & rect ); @@ -255,7 +304,7 @@ private: QPoint m_clickEvent; QList m_searchPoints; QList m_guides; - void updateSnapPoints(AbstractClipItem *selected, QList offsetList = QList (), bool skipSelectedItems = false); + ClipItem *getClipItemAt(int pos, int track); ClipItem *getClipItemAt(GenTime pos, int track); ClipItem *getClipItemAtEnd(GenTime pos, int track); @@ -297,6 +346,14 @@ private: int m_selectedTrack; int m_spacerOffset; + QMutex m_mutex; + QWaitCondition m_producerNotReady; + KStatefulBrush m_activeTrackBrush; + + /** 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; + /** Get the index of the video track that is just below current track */ int getPreviousVideoTrack(int track); void updatePositionEffects(ClipItem * item, ItemInfo info); @@ -307,8 +364,6 @@ private: bool canBeMoved(QList items, GenTime offset, int trackOffset) const; ClipItem *getClipUnderCursor() const; AbstractClipItem *getMainActiveClip() const; - /** @brief Rebuilds @param group to fit changes to it's childen. */ - void rebuildGroup(AbstractGroupItem *group); void resetSelectionGroup(bool selectItems = true); void groupSelectedItems(bool force = false, bool createNewGroup = false); /** Get available space for clip move (min and max free positions) */ @@ -325,7 +380,7 @@ private: void adjustTimelineTransitions(EDITMODE mode, Transition *item, QUndoCommand *command); /** Adjust keyframes when pasted to another clip */ void adjustKeyfames(GenTime oldstart, GenTime newstart, GenTime duration, QDomElement xml); - + /** @brief Removes the tip and stops the animation timer. */ void removeTipAnimation(); /** @brief Creates a new tip animation. @@ -350,6 +405,34 @@ private: * @param command (optional) Will be used as parent command (for undo history) */ void prepareResizeClipEnd(AbstractClipItem *item, ItemInfo oldInfo, int pos, bool check = false, QUndoCommand *command = NULL); + /** @brief Collects information about the group's children to pass it on to RazorGroupCommand. + * @param group The group to cut + * @param cutPos The absolute position of the cut */ + void razorGroup(AbstractGroupItem *group, GenTime cutPos); + + /** @brief Gets the effect parameters that will be passed to Mlt. */ + EffectsParameterList getEffectArgs(const QDomElement effect); + + /** @brief Updates @param item's pan and zoom effect after resize or cut. + * @param item clip whose pan and zoom effect should be updated + * @param cutPos (optional) if clip was cut, cut position relative to the original's clip position */ + void updatePanZoom(ClipItem *item, GenTime cutPos = GenTime()); + + /** @brief Update Tracknames to fit again after track was added/deleted. + * @param track Number of track which was added/deleted + * @param added true = track added, false = track deleted + * + * The default track name consists of type + number. If we add/delete a track the number has to be adjusted + * if the name is still the default one. */ + void updateTrackNames(int track, bool added); + + /** @brief Updates the duration stored in a track's TrackInfo. + * @param track Number of track as used in ItemInfo (not the numbering used in KdenliveDoc) (negative for all tracks) + * @param command If effects need to be updated the commands to do this will be attached to this undo command + * + * In addition to update the duration in TrackInfo it updates effects with keyframes on the track. */ + void updateTrackDuration(int track, QUndoCommand *command); + private slots: void slotRefreshGuides(); void slotEnableRefresh(); @@ -378,6 +461,12 @@ signals: void updateClipMarkers(DocClipBase *); void updateTrackHeaders(); void playMonitor(); + /** @brief Monitor document changes (for example the presence of audio data in timeline for export widget.*/ + void documentModified(); + void forceClipProcessing(const QString &); + void showTrackEffects(int, TrackInfo); + /** @brief Update the track effect button that shows if a track has effects or not.*/ + void updateTrackEffectState(int); }; #endif