1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
22 * @brief Manages the timline
23 * @author Jean-Baptiste Mardelle
29 #include <QScrollArea>
31 #include <QGraphicsScene>
32 #include <QGraphicsLineItem>
33 #include <QDomElement>
37 #include "customtrackscene.h"
38 #include "ui_timeline_ui.h"
42 class CustomTrackView;
47 class TrackView : public QWidget, public Ui::TimeLine_UI
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();
59 int tracksNumber() const;
60 KdenliveDoc *document();
62 void updateProjectFps();
67 /** @brief Updates (redraws) the ruler.
69 * Used to change from displaying frames to timecode or vice versa. */
72 /** @brief Parse tracks to see if project has audio in it.
74 * Parses all tracks to check if there is audio data. */
75 bool checkProjectAudio() const;
78 virtual void keyPressEvent(QKeyEvent * event);
81 void slotDeleteClip(const QString &clipId);
82 void slotChangeZoom(int horizontal, int vertical = -1);
83 void setDuration(int dur);
84 void slotSetZone(QPoint p);
88 CustomTrackView *m_trackview;
89 QList <QString> m_invalidProducers;
93 CustomTrackScene *m_scene;
97 QString m_documentErrors;
98 void parseDocument(QDomDocument doc);
99 int slotAddProjectTrack(int ix, QDomElement xml, bool locked);
100 DocClipBase *getMissingProducer(const QString id) const;
101 void adjustTrackHeaders();
104 void setCursorPos(int pos);
105 void moveCursorPos(int pos);
106 /** @brief Rebuilds the track headers */
107 void slotRebuildTrackHeaders();
108 /** @brief The tracks count or a track name changed, rebuild and notify */
109 void slotReloadTracks();
110 void slotChangeTrackLock(int ix, bool lock);
111 void slotVerticalZoomDown();
112 void slotVerticalZoomUp();
114 /** @brief Changes the name of a track.
115 * @param ix Number of the track
116 * @param name New name */
117 void slotRenameTrack(int ix, QString name);
118 void slotRepaintTracks();
120 /** @brief Adjusts the margins of the header area.
122 * Avoid a shift between header area and trackview if
123 * the horizontal scrollbar is visible and the position
124 * of the vertical scrollbar is maximal */
125 void slotUpdateVerticalScroll(int min, int max);
128 void mousePosition(int);
130 void zoneMoved(int, int);
131 void insertTrack(int);
132 void deleteTrack(int);
133 void configTrack(int);
134 void updateTracksInfo();