]> git.sesse.net Git - kdenlive/blob - src/trackview.h
0529f8498237b522f489b27741444dd7709ac229
[kdenlive] / src / trackview.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 /**
21 * @class TrackView
22 * @brief Manages the timline
23 * @author Jean-Baptiste Mardelle
24 */
25
26 #ifndef TRACKVIEW_H
27 #define TRACKVIEW_H
28
29 #include <QScrollArea>
30 #include <QGroupBox>
31 #include <QGraphicsScene>
32 #include <QGraphicsLineItem>
33 #include <QDomElement>
34
35 #include <KRuler>
36
37 #include "customtrackscene.h"
38 #include "ui_timeline_ui.h"
39
40 class ClipItem;
41 class Transition;
42 class CustomTrackView;
43 class KdenliveDoc;
44 class CustomRuler;
45 class DocClipBase;
46
47 class TrackView : public QWidget, public Ui::TimeLine_UI
48 {
49     Q_OBJECT
50
51 public:
52     explicit TrackView(KdenliveDoc *doc, bool *ok, QWidget *parent = 0);
53     virtual ~ TrackView();
54     void setEditMode(const QString & editMode);
55     const QString & editMode() const;
56     QGraphicsScene *projectScene();
57     CustomTrackView *projectView();
58     int duration() const;
59     int tracksNumber() const;
60     KdenliveDoc *document();
61     void refresh() ;
62     void updateProjectFps();
63     int outPoint() const;
64     int inPoint() const;
65     int fitZoom() const;
66
67     /** @brief Updates (redraws) the ruler.
68     *
69     * Used to change from displaying frames to timecode or vice versa. */
70     void updateRuler();
71
72
73 protected:
74     virtual void keyPressEvent(QKeyEvent * event);
75
76 public slots:
77     void slotDeleteClip(const QString &clipId);
78     void slotChangeZoom(int horizontal, int vertical = -1);
79     void setDuration(int dur);
80     void slotSetZone(QPoint p);
81
82 private:
83     CustomRuler *m_ruler;
84     CustomTrackView *m_trackview;
85     QList <QString> m_invalidProducers;
86     double m_scale;
87     int m_projectTracks;
88     QString m_editMode;
89     CustomTrackScene *m_scene;
90
91     KdenliveDoc *m_doc;
92     int m_verticalZoom;
93     QString m_documentErrors;
94     void parseDocument(QDomDocument doc);
95     int slotAddProjectTrack(int ix, QDomElement xml, bool locked);
96     DocClipBase *getMissingProducer(const QString id) const;
97     void adjustTrackHeaders();
98
99 private slots:
100     void setCursorPos(int pos);
101     void moveCursorPos(int pos);
102     /** @brief Rebuilds the track headers */
103     void slotRebuildTrackHeaders();
104     /** @brief The tracks count or a track name changed, rebuild and notify */
105     void slotReloadTracks();
106     void slotChangeTrackLock(int ix, bool lock);
107     void slotVerticalZoomDown();
108     void slotVerticalZoomUp();
109
110     /** @brief Changes the name of a track.
111     * @param ix Number of the track
112     * @param name New name */
113     void slotRenameTrack(int ix, QString name);
114     void slotRepaintTracks();
115
116     /** @brief Adjusts the margins of the header area.
117      *
118      * Avoid a shift between header area and trackview if
119      * the horizontal scrollbar is visible and the position
120      * of the vertical scrollbar is maximal */
121     void slotUpdateVerticalScroll(int min, int max);
122
123     /** @brief Parse tracks to see if project has audio in it.
124     *
125     * Parses all tracks to check if there is audio data. */
126     void slotCheckProjectAudio();
127
128 signals:
129     void mousePosition(int);
130     void cursorMoved();
131     void zoneMoved(int, int);
132     void insertTrack(int);
133     void deleteTrack(int);
134     void configTrack(int);
135     void updateTracksInfo();
136     void setZoom(int);
137     /** @brief Inform render widget if our project has audio */
138     void projectHasAudio(bool);
139 };
140
141 #endif