3 #include <QStylePainter>
11 #include "documenttrack.h"
13 DocumentTrack::DocumentTrack(QDomElement xml, TrackView * view, QWidget *parent)
14 : QWidget(parent), m_xml(xml), m_trackDuration(0)
17 addFunctionDecorator("move", "move");
21 int DocumentTrack::documentTrackIndex()
26 TrackViewClip *DocumentTrack::getClipAt(GenTime pos)
31 void DocumentTrack::addFunctionDecorator(const QString & mode, const QString & function)
33 m_trackPanelFunctions[mode].append(function);
36 QStringList DocumentTrack::applicableFunctions(const QString & mode)
38 return m_trackPanelFunctions[mode];
41 void DocumentTrack::parseXml()
45 for(QDomNode n = m_xml.firstChild(); !n.isNull(); n = n.nextSibling())
47 QDomElement elem = n.toElement();
48 if (elem.tagName() == "blank") {
49 position += elem.attribute("length", 0).toInt();
51 else if (elem.tagName() == "entry") {
53 clip.startTime = position;
54 int in = elem.attribute("in", 0).toInt();
55 int out = elem.attribute("out", 0).toInt() - in;
59 clip.producer = elem.attribute("producer", QString::null);
60 kDebug()<<"++++++++++++++\n\n / / /ADDING CLIP: "<<clip.cropTime<<", out: "<<clip.duration<<", Producer: "<<clip.producer<<"\n\n++++++++++++++++++++";
61 m_clipList.append(clip);
64 m_trackDuration = position;
67 int DocumentTrack::duration()
69 return m_trackDuration;
72 QList <TrackViewClip> DocumentTrack::clipList()
79 void DocumentTrack::paintEvent(QPaintEvent *e )
81 QRect region = e->rect();
82 region.setBottomRight(QPoint(region.right() - 1, region.bottom() - 1));
83 QPainter painter(this);
84 painter.fillRect(region, QBrush(Qt::red));
85 painter.drawLine(region.bottomLeft (), region.bottomRight ());
89 #include "documenttrack.moc"