X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcustomtrackview.h;h=747d490b60d1889ee88527d569e2a8e23c951274;hb=099cce018342e4c3d8888142f8e1521de057970e;hp=c437b0731cb2f55632becd53c51a452583ff1bf6;hpb=8c544c0cf9380fe81a529ab36b63d7c9993747ff;p=kdenlive diff --git a/src/customtrackview.h b/src/customtrackview.h index c437b073..747d490b 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -21,7 +21,8 @@ #ifndef CUSTOMTRACKVIEW_H #define CUSTOMTRACKVIEW_H -#include +#include +#include #include #include @@ -59,16 +60,16 @@ public: void configTracks(QList trackInfos); int cursorPos(); void checkAutoScroll(); - void moveClip(const ItemInfo start, const ItemInfo end, bool refresh); - void moveGroup(QList startClip, QList startTransition, const GenTime offset, const int trackOffset, bool reverseMove = false); + void moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh); + void moveGroup(QList startClip, QList 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 m_refresh); - void resizeClip(const ItemInfo start, const ItemInfo end, bool dontWorry = false); + void moveTransition(const ItemInfo &start, const ItemInfo &end, bool refresh); + void resizeClip(const ItemInfo &start, const ItemInfo &end, bool dontWorry = false); void addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList list = EffectsList(), bool overwrite = false, bool push = false, bool refresh = true); 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 GenTime &pos, const QString &comment); void setScale(double scaleFactor, double verticalScale); void deleteClip(const QString &clipId); void slotAddEffect(QDomElement effect, GenTime pos, int track); @@ -87,14 +88,15 @@ public: /** @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(); + bool checkTrackHeight(); + void updateSceneFrameWidth(); //QList tracksList() const; void setTool(PROJECTTOOL tool); ClipItem *cutClip(ItemInfo info, GenTime cutTime, bool cut, bool execute = true); void slotSeekToPreviousSnap(); void slotSeekToNextSnap(); double getSnapPointForPos(double pos); - void editKeyFrame(const GenTime pos, const int track, const int index, const QString keyframes); + 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); @@ -103,7 +105,6 @@ public: 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(); @@ -116,12 +117,11 @@ public: void slotInsertSpace(); /** @brief Prepares removing space. */ void slotRemoveSpace(); - void insertSpace(QList clipsToMove, QList transToMove, int track, const GenTime duration, const GenTime offset); + 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 saveThumbnails(); void autoTransition(); - QStringList getLadspaParams(QDomElement effect) const; void initCursorPos(int pos); /** @brief Locks or unlocks a track. @@ -133,7 +133,7 @@ public: 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); + void loadGroups(const QDomNodeList &groups); /** @brief Creates SplitAudioCommands for selected clips. */ void splitAudio(); @@ -142,7 +142,7 @@ public: * @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 doSplitAudio(const GenTime &pos, int track, EffectsList effects, bool split); void setVideoOnly(); void setAudioOnly(); void setAudioAndVideo(); @@ -154,6 +154,8 @@ public: int selectedTrack() const; QStringList selectedClips() const; QList selectedClipItems() const; + /** @brief Checks wheter an item can be inserted (make sure it does not overlap another item) */ + bool canBePastedTo(ItemInfo info, int type) const; /** @brief Selects a clip. * @param add Whether to select or deselect @@ -175,7 +177,6 @@ public: 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. @@ -184,6 +185,8 @@ public: * Check whether given track has a clip with audio in it. */ bool hasAudio(int track) const; + int getFrameWidth(); + public slots: void setCursorPos(int pos, bool seek = true); void moveCursorPos(int delta); @@ -202,14 +205,22 @@ 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(); + bool addGuide(const GenTime &pos, const QString &comment); + + /** @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); void slotDeleteAllGuides(); - void editGuide(const GenTime oldPos, const GenTime pos, const QString &comment); + void editGuide(const GenTime &oldPos, const GenTime &pos, const QString &comment); void copyClip(); void pasteClip(); void pasteClipEffects(); @@ -222,7 +233,7 @@ public slots: void slotDeleteTrack(int ix); /** @brief Shows the configure tracks dialog. */ void slotConfigTracks(int ix); - void clipNameChanged(const QString id, const QString name); + void clipNameChanged(const QString &id, const QString &name); void slotTrackUp(); void slotTrackDown(); void slotSelectTrack(int ix); @@ -250,7 +261,13 @@ public slots: /** @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); + 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); @@ -266,6 +283,7 @@ protected: virtual Qt::DropActions supportedDropActions() const; private: + int m_ct; int m_tracksHeight; int m_projectDuration; int m_cursorPos; @@ -288,7 +306,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); @@ -332,12 +350,16 @@ private: 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); - bool insertDropClips(const QMimeData *data, const QPoint pos); - bool canBePastedTo(ItemInfo info, int type) const; + void updatePositionEffects(ClipItem * item, ItemInfo info, bool standalone = true); + bool insertDropClips(const QMimeData *data, const QPoint &pos); bool canBePastedTo(QList infoList, int type) const; bool canBePasted(QList items, GenTime offset, int trackOffset) const; bool canBeMoved(QList items, GenTime offset, int trackOffset) const; @@ -390,14 +412,29 @@ private: void razorGroup(AbstractGroupItem *group, GenTime cutPos); /** @brief Gets the effect parameters that will be passed to Mlt. */ - EffectsParameterList getEffectArgs(const QDomElement effect); + 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 + /** @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 * - */ - void updatePanZoom(ClipItem *item, GenTime cutPos = GenTime()); + * 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); + + /** @brief Adjusts effects after a clip resize. + * @param item The item that was resized + * @param oldInfo pre resize info + * @param fromStart false = resize from end + * @param command Used as a parent for EditEffectCommand */ + void adjustEffects(ClipItem *item, ItemInfo oldInfo, QUndoCommand *command); private slots: void slotRefreshGuides(); @@ -410,19 +447,29 @@ private slots: void slotGoToMarker(QAction *action); void slotResetMenuPosition(); void slotDoResetMenuPosition(); + /** @brief Re-create the clip thumbnails. + * @param id The clip's Id string. + * @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); signals: void cursorMoved(int, int); void zoomIn(); void zoomOut(); void mousePosition(int); - void clipItemSelected(ClipItem*, int ix = -1); + /** @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 transitionItemSelected(Transition*, int track = 0, QPoint p = QPoint(), bool update = false); void activateDocumentMonitor(); void trackHeightChanged(); void tracksChanged(); - void displayMessage(const QString, MessageType); - void showClipFrame(DocClipBase *, QPoint, const int); + void displayMessage(const QString &, MessageType); + void showClipFrame(DocClipBase *, QPoint, bool, const int); void doTrackLock(int, bool); void updateClipMarkers(DocClipBase *); void updateTrackHeaders();