X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcustomtrackview.h;h=9c7af680e614216e279fdb3c96f58fcb8f8cb4a6;hb=f77746744a2b7c21dadfcc4fc364d41a9ee10d81;hp=e878e5959c1d50f1cf4e6cf16c1194de06ba4423;hpb=a23790875ee20326ba0fb9d30b7719979659c2cd;p=kdenlive diff --git a/src/customtrackview.h b/src/customtrackview.h index e878e595..9c7af680 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -21,6 +21,8 @@ #ifndef CUSTOMTRACKVIEW_H #define CUSTOMTRACKVIEW_H +#include + #include #include #include @@ -51,7 +53,8 @@ public: virtual void mouseDoubleClickEvent(QMouseEvent *event); void addTrack(TrackInfo type, int ix = -1); void removeTrack(int ix); - void changeTrack(int ix, TrackInfo type); + /** @brief Makes the document use new track infos (name, type, ...). */ + void configTracks(QList trackInfos); int cursorPos(); void checkAutoScroll(); void moveClip(const ItemInfo start, const ItemInfo end, bool refresh); @@ -79,8 +82,9 @@ 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); + void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup, QMenu *markermenu); void checkTrackHeight(); //QList tracksList() const; void setTool(PROJECTTOOL tool); @@ -90,31 +94,51 @@ public: double getSnapPointForPos(double pos); void editKeyFrame(const GenTime pos, const int track, const int index, const QString keyframes); bool findString(const QString &text); + void selectFound(QString track, QString pos); bool findNextString(const QString &text); void initSearchStrings(); void clearSearchStrings(); + QList findId(const QString &clipId); void clipStart(); void clipEnd(); void changeClipSpeed(); void doChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, const double speed, const double oldspeed, int strobe, const QString &id); + /** @brief Sets the document as modified. */ void setDocumentModified(); void setInPoint(); void setOutPoint(); + + /** @brief Prepares inserting space. + * + * Shows a dialog to configure length and track. */ void slotInsertSpace(); + /** @brief Prepares removing space. */ void slotRemoveSpace(); void insertSpace(QList clipsToMove, QList transToMove, int track, const GenTime duration, const GenTime offset); ClipItem *getActiveClipUnderCursor(bool allowOutsideCursor = false) const; void deleteTimelineTrack(int ix, TrackInfo trackinfo); - void changeTimelineTrack(int ix, TrackInfo trackinfo); void saveThumbnails(); void autoTransition(); QStringList getLadspaParams(QDomElement effect) const; void initCursorPos(int pos); + + /** @brief Locks or unlocks a track. + * @param ix number of track + * @param lock whether to lock or unlock + * + * Makes sure no clip on track to lock is selected. */ void lockTrack(int ix, bool lock); void groupClips(bool group = true); void doGroupClips(QList clipInfos, QList transitionInfos, bool group); void loadGroups(const QDomNodeList groups); + + /** @brief Creates SplitAudioCommands for selected clips. */ void splitAudio(); + + /** @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 + * @param split Split or unsplit */ void doSplitAudio(const GenTime &pos, int track, bool split); void setVideoOnly(); void setAudioOnly(); @@ -125,20 +149,47 @@ public: void updateProjectFps(); double fps() const; int selectedTrack() const; - void selectClip(bool add, bool group = false); + QStringList selectedClips() const; + QList selectedClipItems() const; + + /** @brief Selects a clip. + * @param add Whether to select or deselect + * @param group (optional) Whether to add the clip to a group + * @param track (optional) The track of the clip (has to be combined with @param pos) + * @param pos (optional) The position of the clip (has to be combined with @param track) */ + void selectClip(bool add, bool group = false, int track = -1, int pos = -1); void selectTransition(bool add, bool group = false); QStringList extractTransitionsLumas(); void setEditMode(EDITMODE mode); + /** @brief Inserts @param clip. + * @param clip The clip to insert + * @param in The inpoint of the clip (crop from start) + * @param out The outpoint of the clip (crop from end) + * + * Inserts at the position of timeline cursor and selected track. */ + void insertClipCut(DocClipBase *clip, int in, int out); + void clearSelection(); + void editItemDuration(); + void buildGuidesMenu(QMenu *goMenu) const; + 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); + 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 slotUpdateClipRegion(ClipItem *clip, int ix, QString region); void slotRefreshEffects(ClipItem *clip); void setDuration(int duration); void slotAddTransition(ClipItem* clip, ItemInfo transitionInfo, int endTrack, QDomElement transition = QDomElement()); @@ -162,20 +213,44 @@ public slots: void slotUpdateAllThumbs(); void slotCheckPositionScrolling(); void slotInsertTrack(int ix); + + /** @brief Shows a dialog for selecting a track to delete. + * @param ix Number of the track, which should be pre-selected in the dialog */ void slotDeleteTrack(int ix); - void slotChangeTrack(int ix); + /** @brief Shows the configure tracks dialog. */ + void slotConfigTracks(int ix); void clipNameChanged(const QString id, const QString name); void slotTrackUp(); void slotTrackDown(); 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); + protected: virtual void drawBackground(QPainter * painter, const QRectF & rect); //virtual void drawForeground ( QPainter * painter, const QRectF & rect ); virtual void dragEnterEvent(QDragEnterEvent * event); virtual void dragMoveEvent(QDragMoveEvent * event); virtual void dragLeaveEvent(QDragLeaveEvent * event); + /** @brief Something has been dropped onto the timeline */ virtual void dropEvent(QDropEvent * event); virtual void wheelEvent(QWheelEvent * e); virtual void keyPressEvent(QKeyEvent * event); @@ -221,6 +296,7 @@ private: QMenu *m_timelineContextMenu; QMenu *m_timelineContextClipMenu; QMenu *m_timelineContextTransitionMenu; + QMenu *m_markerMenu; QAction *m_autoTransition; QAction *m_pasteEffectsAction; QAction *m_ungroupAction; @@ -229,6 +305,8 @@ private: QActionGroup *m_clipTypeGroup; QTimer m_scrollTimer; QTimer m_thumbsTimer; + /** @brief Monitor for changes in timeline (do we have audio data) */ + QTimer m_audioMonitorTimer; int m_scrollOffset; bool m_clipDrag; @@ -244,6 +322,7 @@ private: AbstractGroupItem *m_selectionGroup; QList m_waitingThumbs; int m_selectedTrack; + int m_spacerOffset; /** Get the index of the video track that is just below current track */ int getPreviousVideoTrack(int track); @@ -267,8 +346,39 @@ private: /** Selects all items in the scene rect, and sets ok to false if a group going over several tracks is found in it */ QList checkForGroups(const QRectF &rect, bool *ok); /** Adjust clips under another one when working in overwrite mode */ - void adjustTimelineClips(EDITMODE mode, ClipItem *item, QUndoCommand *command); + void adjustTimelineClips(EDITMODE mode, ClipItem *item, ItemInfo posinfo, QUndoCommand *command); 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. + * @param clip clip to display the tip on + * @param mode operation mode for which the tip should be displayed + * @param size size of the tip */ + void setTipAnimation(AbstractClipItem *clip, OPERATIONTYPE mode, const double size); + + /** @brief Takes care of updating effects and attached transitions during a resize from start. + * @param item Item to resize + * @param oldInfo The item's info before resizement (set to item->info() is @param check true) + * @param pos New startPos + * @param check (optional, default = false) Whether to check for collisions + * @param command (optional) Will be used as parent command (for undo history) */ + void prepareResizeClipStart(AbstractClipItem *item, ItemInfo oldInfo, int pos, bool check = false, QUndoCommand *command = NULL); + + /** @brief Takes care of updating effects and attached transitions during a resize from end. + * @param item Item to resize + * @param oldInfo The item's info before resizement (set to item->info() is @param check true) + * @param pos New endPos + * @param check (optional, default = false) Whether to check for collisions + * @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); private slots: void slotRefreshGuides(); @@ -278,6 +388,9 @@ private slots: void slotDeleteTimeLineGuide(); void slotFetchNextThumbs(); void checkTrackSequence(int track); + void slotGoToMarker(QAction *action); + void slotResetMenuPosition(); + void slotDoResetMenuPosition(); signals: void cursorMoved(int, int); @@ -290,10 +403,13 @@ signals: void trackHeightChanged(); void tracksChanged(); void displayMessage(const QString, MessageType); - void showClipFrame(DocClipBase *, const int); + void showClipFrame(DocClipBase *, QPoint, const int); void doTrackLock(int, bool); 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(); }; #endif