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) {
16 addFunctionDecorator("move", "move");
20 int DocumentTrack::documentTrackIndex() {
24 TrackViewClip *DocumentTrack::getClipAt(GenTime pos) {
28 void DocumentTrack::addFunctionDecorator(const QString & mode, const QString & function) {
29 m_trackPanelFunctions[mode].append(function);
32 QStringList DocumentTrack::applicableFunctions(const QString & mode) {
33 return m_trackPanelFunctions[mode];
36 void DocumentTrack::parseXml() {
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") {
45 clip.startTime = position;
46 int in = elem.attribute("in", 0).toInt();
47 int out = elem.attribute("out", 0).toInt() - in;
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);
56 m_trackDuration = position;
59 int DocumentTrack::duration() {
60 return m_trackDuration;
63 QList <TrackViewClip> DocumentTrack::clipList() {
69 void DocumentTrack::paintEvent(QPaintEvent *e )
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 ());
79 #include "documenttrack.moc"