]> git.sesse.net Git - kdenlive/blob - src/documenttrack.cpp
Reindent all source files
[kdenlive] / src / documenttrack.cpp
1
2 #include <QMouseEvent>
3 #include <QStylePainter>
4
5 #include <KDebug>
6 #include <QFrame>
7 #include <QWidget>
8 #include <QPainter>
9
10
11 #include "documenttrack.h"
12
13 DocumentTrack::DocumentTrack(QDomElement xml, TrackView * view, QWidget *parent)
14         : QWidget(parent), m_xml(xml), m_trackDuration(0) {
15     setFixedHeight(50);
16     addFunctionDecorator("move", "move");
17     parseXml();
18 }
19
20 int DocumentTrack::documentTrackIndex() {
21     return 0;
22 }
23
24 TrackViewClip *DocumentTrack::getClipAt(GenTime pos) {
25     return 0;
26 }
27
28 void DocumentTrack::addFunctionDecorator(const QString & mode, const QString & function) {
29     m_trackPanelFunctions[mode].append(function);
30 }
31
32 QStringList DocumentTrack::applicableFunctions(const QString & mode) {
33     return m_trackPanelFunctions[mode];
34 }
35
36 void DocumentTrack::parseXml() {
37     m_clipList.clear();
38     int position = 0;
39     for (QDomNode n = m_xml.firstChild(); !n.isNull(); n = n.nextSibling()) {
40         QDomElement elem = n.toElement();
41         if (elem.tagName() == "blank") {
42             position += elem.attribute("length", 0).toInt();
43         } else if (elem.tagName() == "entry") {
44             TrackViewClip clip;
45             clip.startTime = position;
46             int in = elem.attribute("in", 0).toInt();
47             int out = elem.attribute("out", 0).toInt() - in;
48             clip.cropTime = in;
49             clip.duration = out;
50             position += out;
51             clip.producer = elem.attribute("producer", QString::null);
52             kDebug() << "++++++++++++++\n\n / / /ADDING CLIP: " << clip.cropTime << ", out: " << clip.duration << ", Producer: " << clip.producer << "\n\n++++++++++++++++++++";
53             m_clipList.append(clip);
54         }
55     }
56     m_trackDuration = position;
57 }
58
59 int DocumentTrack::duration() {
60     return m_trackDuration;
61 }
62
63 QList <TrackViewClip> DocumentTrack::clipList() {
64     return m_clipList;
65 }
66
67 // virtual
68 /*
69 void DocumentTrack::paintEvent(QPaintEvent *e )
70 {
71     QRect region = e->rect();
72     region.setBottomRight(QPoint(region.right() - 1, region.bottom() - 1));
73     QPainter painter(this);
74     painter.fillRect(region, QBrush(Qt::red));
75     painter.drawLine(region.bottomLeft (), region.bottomRight ());
76 }
77 */
78
79 #include "documenttrack.moc"