]> git.sesse.net Git - kdenlive/blobdiff - src/trackview.h
Const'ref
[kdenlive] / src / trackview.h
index 39ca417f87789433bdafb6b5b292ac14590e9267..755b8e11173c17c89da22afdb3ba519e651ee7c7 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
+/**
+* @class TrackView
+* @brief Manages the timline
+* @author Jean-Baptiste Mardelle
+*/
 
 #ifndef TRACKVIEW_H
 #define TRACKVIEW_H
 
 #include <QScrollArea>
-#include <QVBoxLayout>
-#include <KRuler>
 #include <QGroupBox>
 #include <QGraphicsScene>
 #include <QGraphicsLineItem>
+#include <QDomElement>
 
-#define FRAME_SIZE 90
+#include <KRuler>
 
+#include "customtrackscene.h"
+#include "effectslist.h"
 #include "ui_timeline_ui.h"
-#include "customruler.h"
-#include "kdenlivedoc.h"
-#include "documenttrack.h"
-#include "trackpanelfunctionfactory.h"
-#include "trackpanelfunction.h"
-#include "customtrackview.h"
-
-class TrackView : public QWidget
-{
-  Q_OBJECT
-  
-  public:
-    TrackView(KdenliveDoc *doc, QWidget *parent=0);
+#include "definitions.h"
+
+class ClipItem;
+class CustomTrackView;
+class KdenliveDoc;
+class CustomRuler;
+class DocClipBase;
 
-       /** This event occurs when the mouse has been moved. */
-    void mouseMoveEvent(QMouseEvent * event);
+class TrackView : public QWidget, public Ui::TimeLine_UI
+{
+    Q_OBJECT
 
-    const double zoomFactor() const;
-    DocumentTrack *panelAt(int y);
-    const int mapLocalToValue(int x) const;
+public:
+    explicit TrackView(KdenliveDoc *doc, const QList <QAction *>& actions, bool *ok, QWidget *parent = 0);
+    virtual ~ TrackView();
     void setEditMode(const QString & editMode);
     const QString & editMode() const;
     QGraphicsScene *projectScene();
     CustomTrackView *projectView();
-    int duration();
-    int tracksNumber();
-
-  public slots:
+    int duration() const;
+    int tracksNumber() const;
     KdenliveDoc *document();
+    void refresh() ;
+    void updateProjectFps();
+    int outPoint() const;
+    int inPoint() const;
+    int fitZoom() const;
+
+    /** @brief Updates (redraws) the ruler.
+    *
+    * Used to change from displaying frames to timecode or vice versa. */
+    void updateRuler();
+
+    /** @brief Parse tracks to see if project has audio in it.
+    *
+    * Parses all tracks to check if there is audio data. */
+    bool checkProjectAudio() const;
 
-  private:
-    Ui::TimeLine_UI *view;
+    void checkTrackHeight();
+    void updateProfile();
+    void updatePalette();
+
+protected:
+    void keyPressEvent(QKeyEvent * event);
+
+public slots:
+    void slotDeleteClip(const QString &clipId);
+    void slotChangeZoom(int horizontal, int vertical = -1);
+    void setDuration(int dur);
+    void slotSetZone(const QPoint &p, bool updateDocumentProperties = true);
+    /** @brief Save a snapshot image of current timeline view */
+    void slotSaveTimelinePreview(const QString &path);
+private:
     CustomRuler *m_ruler;
     CustomTrackView *m_trackview;
+    QList <QString> m_invalidProducers;
     double m_scale;
-    QList <DocumentTrack*> documentTracks;
-    int m_projectDuration;
     int m_projectTracks;
-    TrackPanelFunctionFactory m_factory;
-    DocumentTrack *m_panelUnderMouse;
-       /** The currently applied function. This lasts from mousePressed until mouseRelease. */
-    TrackPanelFunction *m_function;
     QString m_editMode;
-    QGraphicsScene *m_scene;
-    uint m_currentZoom;
-
+    CustomTrackScene *m_scene;
+    /** @brief A list of producer ids to be replaced when opening a corrupted document*/
+    QMap <QString, QString> m_replacementProducerIds;
 
     KdenliveDoc *m_doc;
-    QVBoxLayout *m_tracksLayout;
-    QVBoxLayout *m_headersLayout;
-    QScrollArea *m_scrollArea;
-    QFrame *m_scrollBox;
-    QVBoxLayout *m_tracksAreaLayout;
-    void parseDocument(QDomDocument doc);
-    int slotAddAudioTrack(int ix, QDomElement xml);
-    int slotAddVideoTrack(int ix, QDomElement xml);
-    void registerFunction(const QString & name, TrackPanelFunction * function);
-    TrackPanelFunction *getApplicableFunction(DocumentTrack * panel, const QString & editMode, QMouseEvent * event);
-
-  private slots:
-    void slotChangeZoom(int factor);
-    void slotCursorMoved(int pos, bool slotCursorMoved = false);
-    void slotZoomIn();
-    void slotZoomOut();
+    int m_verticalZoom;
+    QString m_documentErrors;
+    QList <QAction *> m_trackActions;
+    
+    void parseDocument(const QDomDocument &doc);
+    int slotAddProjectTrack(int ix, QDomElement xml, bool locked, const QDomNodeList &producers);
+    DocClipBase *getMissingProducer(const QString &id) const;
+    void adjustTrackHeaders();
+    /** @brief Add effects from the xml. Returns true if some effect was upgraded, false if everything went fine.*/
+    void slotAddProjectEffects(QDomNodeList effects, QDomElement parentNode, ClipItem *clip, int trackIndex);
+    
+    /** @brief Returns a kdenlive effect xml description from an effect tag / id */
+    QDomElement getEffectByTag(const QString &effecttag, const QString &effectid);
+    
+    /** @brief Adjust kdenlive effect xml parameters to the MLT value*/
+    void adjustparameterValue(QDomNodeList clipeffectparams, const QString &paramname, const QString &paramvalue);
+
+private slots:
+    void setCursorPos(int pos);
+    void moveCursorPos(int pos);
+    /** @brief Rebuilds the track headers */
+    void slotRebuildTrackHeaders();
+    /** @brief The tracks count or a track name changed, rebuild and notify */
+    void slotReloadTracks();
+    void slotChangeTrackLock(int ix, bool lock);
+    void slotVerticalZoomDown();
+    void slotVerticalZoomUp();
+
+    /** @brief Changes the name of a track.
+    * @param ix Number of the track
+    * @param name New name */
+    void slotRenameTrack(int ix, const QString &name);
+    void slotRepaintTracks();
+
+    /** @brief Adjusts the margins of the header area.
+     *
+     * Avoid a shift between header area and trackview if
+     * the horizontal scrollbar is visible and the position
+     * of the vertical scrollbar is maximal */
+    void slotUpdateVerticalScroll(int min, int max);
+    void slotShowTrackEffects(int);
+    /** @brief Update the track label showing applied effects.*/
+    void slotUpdateTrackEffectState(int);
+
+signals:
+    void mousePosition(int);
+    void cursorMoved();
+    void zoneMoved(int, int);
+    void configTrack(int);
+    void updateTracksInfo();
+    void setZoom(int);
+    void showTrackEffects(int, const TrackInfo&);
 };
 
 #endif