]> git.sesse.net Git - kdenlive/blob - src/trackview.h
Rewrote the handling of timeline in QGraphicsView. Now we use the built in zoom featu...
[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 #ifndef TRACKVIEW_H
22 #define TRACKVIEW_H
23
24 #include <QScrollArea>
25 #include <QVBoxLayout>
26 #include <KRuler>
27 #include <QGroupBox>
28 #include <QGraphicsScene>
29 #include <QGraphicsLineItem>
30 #include <QDomElement>
31
32 #define FRAME_SIZE 90
33
34 #include "customtrackscene.h"
35 #include "ui_timeline_ui.h"
36
37 class ClipItem;
38 class Transition;
39 class CustomTrackView;
40 class KdenliveDoc;
41 class CustomRuler;
42
43 class TrackView : public QWidget {
44     Q_OBJECT
45
46 public:
47     TrackView(KdenliveDoc *doc, QWidget *parent = 0);
48
49     const double zoomFactor() const;
50     const int mapLocalToValue(int x) const;
51     void setEditMode(const QString & editMode);
52     const QString & editMode() const;
53     QGraphicsScene *projectScene();
54     CustomTrackView *projectView();
55     int duration() const;
56     int tracksNumber() const;
57     KdenliveDoc *document();
58     void refresh() ;
59     int outPoint() const;
60     int inPoint() const;
61     int fitZoom() const;
62
63
64 public slots:
65     void slotDeleteClip(int clipId);
66     void slotChangeZoom(int factor);
67     void setDuration(int dur);
68
69 private:
70     Ui::TimeLine_UI *view;
71     CustomRuler *m_ruler;
72     CustomTrackView *m_trackview;
73     double m_scale;
74     int m_projectTracks;
75     QString m_editMode;
76     CustomTrackScene *m_scene;
77
78     KdenliveDoc *m_doc;
79     QVBoxLayout *m_tracksLayout;
80     QVBoxLayout *m_headersLayout;
81     QScrollArea *m_scrollArea;
82     QFrame *m_scrollBox;
83     QVBoxLayout *m_tracksAreaLayout;
84     void parseDocument(QDomDocument doc);
85     int slotAddProjectTrack(int ix, QDomElement xml, bool videotrack);
86
87 private slots:
88     void setCursorPos(int pos);
89     void moveCursorPos(int pos);
90     void slotClipItemSelected(ClipItem*);
91     void slotTransitionItemSelected(Transition*);
92     void slotRebuildTrackHeaders();
93
94
95 signals:
96     void mousePosition(int);
97     void cursorMoved();
98     void clipItemSelected(ClipItem*);
99     void transitionItemSelected(Transition*);
100 };
101
102 #endif