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 ***************************************************************************/
24 #include <KMessageBox>
26 #include "definitions.h"
27 #include "headertrack.h"
28 #include "trackview.h"
30 #include "transition.h"
31 #include "kdenlivesettings.h"
32 #include "clipmanager.h"
33 #include "customruler.h"
34 #include "kdenlivedoc.h"
35 #include "mainwindow.h"
36 #include "customtrackview.h"
37 #include "initeffects.h"
39 TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
40 : QWidget(parent), m_doc(doc), m_scale(1.0), m_projectTracks(0) {
42 view = new Ui::TimeLine_UI();
45 m_scene = new CustomTrackScene(doc);
46 m_trackview = new CustomTrackView(doc, m_scene, parent);
47 m_trackview->scale(1, 1);
48 m_trackview->setAlignment(Qt::AlignLeft | Qt::AlignTop);
49 //m_scene->addRect(QRectF(0, 0, 100, 100), QPen(), QBrush(Qt::red));
51 m_ruler = new CustomRuler(doc->timecode(), m_trackview);
52 connect(m_ruler, SIGNAL(zoneMoved(int, int)), this, SIGNAL(zoneMoved(int, int)));
53 QHBoxLayout *layout = new QHBoxLayout;
54 view->ruler_frame->setLayout(layout);
57 layout->getContentsMargins(&left_margin, 0, &right_margin, 0);
58 layout->setContentsMargins(left_margin, 0, right_margin, 0);
59 layout->addWidget(m_ruler);
61 QHBoxLayout *tracksLayout = new QHBoxLayout;
62 tracksLayout->setContentsMargins(0, 0, 0, 0);
63 view->tracks_frame->setLayout(tracksLayout);
65 view->headers_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
66 view->headers_area->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
68 m_headersLayout = new QVBoxLayout;
69 m_headersLayout->setContentsMargins(0, 0, 0, 0);
70 m_headersLayout->setSpacing(0);
71 view->headers_container->setLayout(m_headersLayout);
73 connect(view->headers_area->verticalScrollBar(), SIGNAL(valueChanged(int)), m_trackview->verticalScrollBar(), SLOT(setValue(int)));
75 tracksLayout->addWidget(m_trackview);
77 connect(m_trackview->verticalScrollBar(), SIGNAL(valueChanged(int)), view->headers_area->verticalScrollBar(), SLOT(setValue(int)));
78 connect(m_trackview, SIGNAL(trackHeightChanged()), this, SLOT(slotRebuildTrackHeaders()));
80 parseDocument(m_doc->toXml());
81 m_doc->setSceneList();
82 connect(m_trackview, SIGNAL(cursorMoved(int, int)), m_ruler, SLOT(slotCursorMoved(int, int)));
83 connect(m_trackview->horizontalScrollBar(), SIGNAL(valueChanged(int)), m_ruler, SLOT(slotMoveRuler(int)));
84 connect(m_trackview, SIGNAL(mousePosition(int)), this, SIGNAL(mousePosition(int)));
85 connect(m_trackview, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotTransitionItemSelected(Transition*, bool)));
86 slotChangeZoom(m_doc->zoom());
87 slotSetZone(m_doc->zone());
91 int TrackView::duration() const {
92 return m_trackview->duration();
95 int TrackView::tracksNumber() const {
96 return m_projectTracks - 1;
99 int TrackView::inPoint() const {
100 return m_ruler->inPoint();
103 int TrackView::outPoint() const {
104 return m_ruler->outPoint();
107 void TrackView::slotSetZone(QPoint p) {
111 void TrackView::slotTransitionItemSelected(Transition *t, bool update) {
112 emit transitionItemSelected(t, update);
115 void TrackView::setDuration(int dur) {
116 m_trackview->setDuration(dur);
117 m_ruler->setDuration(dur);
120 void TrackView::parseDocument(QDomDocument doc) {
122 m_documentErrors = QString();
123 // kDebug() << "//// DOCUMENT: " << doc.toString();
124 /*QDomNode props = doc.elementsByTagName("properties").item(0);
125 if (!props.isNull()) {
126 cursorPos = props.toElement().attribute("timeline_position").toInt();
129 // parse project tracks
130 QDomElement tractor = doc.elementsByTagName("tractor").item(0).toElement();
131 QDomNodeList tracks = doc.elementsByTagName("track");
132 QDomNodeList playlists = doc.elementsByTagName("playlist");
134 m_projectTracks = tracks.count();
135 int trackduration = 0;
139 int pos = m_projectTracks - 1;
142 for (int i = 0; i < m_projectTracks; i++) {
143 e = tracks.item(i).toElement();
144 QString playlist_name = e.attribute("producer");
145 if (playlist_name != "black_track" && playlist_name != "playlistmain") {
146 // find playlist related to this track
148 for (int j = 0; j < m_projectTracks; j++) {
149 p = playlists.item(j).toElement();
150 if (p.attribute("id") == playlist_name) break;
152 if (p.attribute("id") != playlist_name) { // then it didn't work.
153 kDebug() << "NO PLAYLIST FOUND FOR TRACK " + pos;
155 if (e.attribute("hide") == "video") {
156 m_doc->switchTrackVideo(i - 1, true);
157 } else if (e.attribute("hide") == "audio") {
158 m_doc->switchTrackAudio(i - 1, true);
159 } else if (e.attribute("hide") == "both") {
160 m_doc->switchTrackVideo(i - 1, true);
161 m_doc->switchTrackAudio(i - 1, true);
163 trackduration = slotAddProjectTrack(pos, p);
165 //kDebug() << " PRO DUR: " << trackduration << ", TRACK DUR: " << duration;
166 if (trackduration > duration) duration = trackduration;
168 // background black track
169 for (int j = 0; j < m_projectTracks; j++) {
170 p = playlists.item(j).toElement();
171 if (p.attribute("id") == playlist_name) break;
173 int black_clips = p.childNodes().count();
174 for (int i = 0; i < black_clips; i++)
175 m_doc->loadingProgressed();
176 qApp->processEvents();
182 QDomNodeList transitions = doc.elementsByTagName("transition");
184 //kDebug() << "//////////// TIMELINE FOUND: " << projectTransitions << " transitions";
185 for (int i = 0; i < transitions.count(); i++) {
186 e = transitions.item(i).toElement();
187 QDomNodeList transitionparams = e.childNodes();
188 bool transitionAdd = true;
191 bool isAutomatic = false;
192 bool forceTrack = false;
193 QString mlt_geometry;
195 for (int k = 0; k < transitionparams.count(); k++) {
196 p = transitionparams.item(k).toElement();
198 QString paramName = p.attribute("name");
199 // do not add audio mixing transitions
200 if (paramName == "internal_added" && p.text() == "237") {
201 transitionAdd = false;
202 //kDebug() << "// TRANSITRION " << i << " IS NOT VALID (INTERN ADDED)";
204 } else if (paramName == "a_track") a_track = p.text().toInt();
205 else if (paramName == "b_track") b_track = p.text().toInt();
206 else if (paramName == "mlt_service") mlt_service = p.text();
207 else if (paramName == "geometry") mlt_geometry = p.text();
208 else if (paramName == "automatic" && p.text() == "1") isAutomatic = true;
209 else if (paramName == "force_track" && p.text() == "1") forceTrack = true;
212 if (transitionAdd || mlt_service != "mix") {
213 // Transition should be added to the scene
214 ItemInfo transitionInfo;
215 QString transitionId;
216 if (mlt_service == "composite") {
217 // When adding composite transition, check if it is a wipe transition
218 if (mlt_geometry == "0%,0%:100%x100%") transitionId = "alphatransparency";
219 else if (mlt_geometry.count(';') == 1) {
220 mlt_geometry.remove(QChar('%'), Qt::CaseInsensitive);
221 mlt_geometry.replace(QChar('x'), QChar(','), Qt::CaseInsensitive);
222 QString start = mlt_geometry.section(';', 0, 0);
223 start = start.section(':', 0, 1);
224 start.replace(QChar(':'), QChar(','), Qt::CaseInsensitive);
225 QString end = mlt_geometry.section('=', 1, 1);
226 end = end.section(':', 0, 1);
227 end.replace(QChar(':'), QChar(','), Qt::CaseInsensitive);
228 start.append(',' + end);
229 QStringList numbers = start.split(',', QString::SkipEmptyParts);
230 bool isWipeTransition = true;
232 for (int i = 0; i < numbers.size(); ++i) {
233 checkNumber = qAbs(numbers.at(i).toInt());
234 if (checkNumber != 0 && checkNumber != 100) {
235 isWipeTransition = false;
239 if (isWipeTransition) transitionId = "wipe";
242 QDomElement base = MainWindow::transitions.getEffectByTag(mlt_service, transitionId).cloneNode().toElement();
244 for (int k = 0; k < transitionparams.count(); k++) {
245 p = transitionparams.item(k).toElement();
247 QString paramName = p.attribute("name");
248 QString paramValue = p.text();
250 QDomNodeList params = base.elementsByTagName("parameter");
251 if (paramName != "a_track" && paramName != "b_track") for (int i = 0; i < params.count(); i++) {
252 QDomElement e = params.item(i).toElement();
253 if (!e.isNull() && e.attribute("tag") == paramName) {
254 if (e.attribute("type") == "double") {
255 QString factor = e.attribute("factor", "1");
257 double val = paramValue.toDouble() * factor.toDouble();
258 paramValue = QString::number(val);
261 e.setAttribute("value", paramValue);
269 doc.appendChild(doc.importNode(base, true));
270 kDebug() << "/////// TRANSITION XML: "<< doc.toString();*/
272 transitionInfo.startPos = GenTime(e.attribute("in").toInt(), m_doc->fps());
273 transitionInfo.endPos = GenTime(e.attribute("out").toInt() + 1, m_doc->fps());
274 transitionInfo.track = m_projectTracks - 1 - b_track;
275 //kDebug() << "/////////////// +++++++++++ ADDING TRANSITION ON TRACK: " << b_track << ", TOTAL TRKA: " << m_projectTracks;
276 if (transitionInfo.startPos >= transitionInfo.endPos) {
277 // invalid transition, remove it.
278 m_documentErrors.append(i18n("Removed invalid transition: %1", e.attribute("id")) + '\n');
279 kDebug() << "///// REMOVED INVALID TRANSITION: " << e.attribute("id");
280 tractor.removeChild(transitions.item(i));
283 Transition *tr = new Transition(transitionInfo, a_track, m_doc->fps(), base, isAutomatic);
284 if (forceTrack) tr->setForcedTrack(true, a_track);
285 m_scene->addItem(tr);
291 QDomNodeList guides = doc.elementsByTagName("guide");
292 for (int i = 0; i < guides.count(); i++) {
293 e = guides.item(i).toElement();
294 const QString comment = e.attribute("comment");
295 const GenTime pos = GenTime(e.attribute("time").toDouble());
296 m_trackview->addGuide(pos, comment);
299 m_trackview->setDuration(duration);
300 kDebug() << "/////////// TOTAL PROJECT DURATION: " << duration;
301 slotRebuildTrackHeaders();
302 if (!m_documentErrors.isNull()) KMessageBox::sorry(this, m_documentErrors);
303 //m_trackview->setCursorPos(cursorPos);
304 //m_scrollBox->setGeometry(0, 0, 300 * zoomFactor(), m_scrollArea->height());
307 void TrackView::slotDeleteClip(const QString &clipId) {
308 m_trackview->deleteClip(clipId);
311 void TrackView::setCursorPos(int pos) {
312 m_trackview->setCursorPos(pos);
315 void TrackView::moveCursorPos(int pos) {
316 m_trackview->setCursorPos(pos, false);
319 void TrackView::slotChangeZoom(int factor) {
320 m_doc->setZoom(factor);
321 m_ruler->setPixelPerMark(factor);
322 m_scale = (double) FRAME_SIZE / m_ruler->comboScale[factor]; // m_ruler->comboScale[m_currentZoom] /
323 m_trackview->setScale(m_scale);
326 int TrackView::fitZoom() const {
327 int zoom = (int)((duration() + 20 / m_scale) * FRAME_SIZE / m_trackview->width());
329 for (i = 0; i < 13; i++)
330 if (m_ruler->comboScale[i] > zoom) break;
334 const double TrackView::zoomFactor() const {
338 const int TrackView::mapLocalToValue(int x) const {
339 return (int)(x * zoomFactor());
342 KdenliveDoc *TrackView::document() {
346 void TrackView::refresh() {
347 m_trackview->viewport()->update();
350 void TrackView::slotRebuildTrackHeaders() {
351 QList <TrackInfo> list = m_doc->tracksList();
352 QList<HeaderTrack *> widgets = this->findChildren<HeaderTrack *>();
353 for (int i = 0; i < widgets.count(); i++)
354 delete widgets.at(i);
355 int max = list.count();
356 for (int i = 0; i < max; i++) {
357 HeaderTrack *header = new HeaderTrack(i, list.at(max - i - 1), this);
358 connect(header, SIGNAL(switchTrackVideo(int)), m_trackview, SLOT(slotSwitchTrackVideo(int)));
359 connect(header, SIGNAL(switchTrackAudio(int)), m_trackview, SLOT(slotSwitchTrackAudio(int)));
361 connect(header, SIGNAL(deleteTrack(int)), this, SIGNAL(deleteTrack(int)));
362 connect(header, SIGNAL(insertTrack(int)), this, SIGNAL(insertTrack(int)));
363 connect(header, SIGNAL(changeTrack(int)), this, SIGNAL(changeTrack(int)));
364 m_headersLayout->addWidget(header);
366 view->headers_container->adjustSize();
370 int TrackView::slotAddProjectTrack(int ix, QDomElement xml) {
371 int trackTop = KdenliveSettings::trackheight() * ix;
374 for (QDomNode n = xml.firstChild(); !n.isNull(); n = n.nextSibling()) {
375 QDomElement elem = n.toElement();
376 if (elem.tagName() == "blank") {
377 position += elem.attribute("length").toInt();
378 } else if (elem.tagName() == "entry") {
379 m_doc->loadingProgressed();
380 qApp->processEvents();
382 int in = elem.attribute("in").toInt();
383 int out = elem.attribute("out").toInt();
384 if (in > out || in == out) {
385 m_documentErrors.append(i18n("Invalid clip removed from track %1 at %2\n", ix, position));
388 QString idString = elem.attribute("producer");
389 QString id = idString;
391 if (idString.startsWith("slowmotion")) {
392 id = idString.section(":", 1, 1);
393 speed = idString.section(":", 2, 2).toDouble();
394 } else id = id.section('_', 0, 0);
395 DocClipBase *clip = m_doc->clipManager()->getClipById(id);
398 clipinfo.startPos = GenTime(position, m_doc->fps());
399 clipinfo.endPos = clipinfo.startPos + GenTime(out - in + 1, m_doc->fps());
400 clipinfo.cropStart = GenTime(in, m_doc->fps());
402 //kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
403 ClipItem *item = new ClipItem(clip, clipinfo, m_doc->fps(), speed, false);
404 m_scene->addItem(item);
405 clip->addReference();
406 position += (out - in + 1);
408 // parse clip effects
409 QDomNodeList effects = elem.childNodes();
410 for (int ix = 0; ix < effects.count(); ix++) {
411 QDomElement effect = effects.at(ix).toElement();
412 if (effect.tagName() == "filter") {
413 // add effect to clip
417 QString ladspaEffectFile;
418 // Get effect tag & index
419 for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
420 // parse effect parameters
421 QDomElement effectparam = n3.toElement();
422 if (effectparam.attribute("name") == "tag") {
423 effecttag = effectparam.text();
424 } else if (effectparam.attribute("name") == "kdenlive_id") {
425 effectid = effectparam.text();
426 } else if (effectparam.attribute("name") == "kdenlive_ix") {
427 effectindex = effectparam.text();
428 } else if (effectparam.attribute("name") == "src") {
429 ladspaEffectFile = effectparam.text();
430 if (!QFile::exists(ladspaEffectFile)) {
431 // If the ladspa effect file is missing, recreate it
432 kDebug() << "// MISSING LADSPA FILE: " << ladspaEffectFile;
433 ladspaEffectFile = m_doc->getLadspaFile();
434 effectparam.firstChild().setNodeValue(ladspaEffectFile);
435 kDebug() << "// ... REPLACED WITH: " << ladspaEffectFile;
439 //kDebug() << "+ + CLIP EFF FND: " << effecttag << ", " << effectid << ", " << effectindex;
440 // get effect standard tags
441 QDomElement clipeffect = MainWindow::customEffects.getEffectByTag(QString(), effectid);
442 if (clipeffect.isNull()) clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid);
443 if (clipeffect.isNull()) clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid);
444 if (clipeffect.isNull()) {
445 kDebug() << "/// WARNING, EFFECT: " << effecttag << ": " << effectid << " not found, removing it from project";
446 m_documentErrors.append(i18n("Effect %1:%2 not found in MLT, it was removed from this project\n", effecttag, effectid));
447 elem.removeChild(effects.at(ix));
450 QDomElement currenteffect = clipeffect.cloneNode().toElement();
451 currenteffect.setAttribute("kdenlive_ix", effectindex);
452 QDomNodeList clipeffectparams = currenteffect.childNodes();
454 if (MainWindow::videoEffects.hasKeyFrames(currenteffect)) {
455 //kDebug() << " * * * * * * * * * * ** CLIP EFF WITH KFR FND * * * * * * * * * * *";
456 // effect is key-framable, read all effects to retrieve keyframes
460 QDomNodeList params = currenteffect.elementsByTagName("parameter");
461 for (int i = 0; i < params.count(); i++) {
462 QDomElement e = params.item(i).toElement();
463 if (e.attribute("type") == "keyframe") {
464 starttag = e.attribute("starttag", "start");
465 endtag = e.attribute("endtag", "end");
466 factor = e.attribute("factor", "1").toDouble();
471 int effectin = effect.attribute("in").toInt();
472 int effectout = effect.attribute("out").toInt();
475 for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
476 // parse effect parameters
477 QDomElement effectparam = n3.toElement();
478 if (effectparam.attribute("name") == starttag)
479 startvalue = effectparam.text().toDouble() * factor;
480 if (effectparam.attribute("name") == endtag)
481 endvalue = effectparam.text().toDouble() * factor;
483 // add first keyframe
484 keyframes.append(QString::number(effectin) + ":" + QString::number(startvalue) + ";" + QString::number(effectout) + ":" + QString::number(endvalue) + ";");
485 QDomNode lastParsedEffect;
487 QDomNode n2 = effects.at(ix);
488 bool continueParsing = true;
489 for (; !n2.isNull() && continueParsing; n2 = n2.nextSibling()) {
491 QDomElement kfreffect = n2.toElement();
492 int effectout = kfreffect.attribute("out").toInt();
494 for (QDomNode n4 = kfreffect.firstChild(); !n4.isNull(); n4 = n4.nextSibling()) {
495 // parse effect parameters
496 QDomElement subeffectparam = n4.toElement();
497 if (subeffectparam.attribute("name") == "kdenlive_ix" && subeffectparam.text() != effectindex) {
498 //We are not in the same effect, stop parsing
499 lastParsedEffect = n2.previousSibling();
501 continueParsing = false;
503 } else if (subeffectparam.attribute("name") == endtag) {
504 endvalue = subeffectparam.text().toDouble() * factor;
508 if (continueParsing) {
509 keyframes.append(QString::number(effectout) + ":" + QString::number(endvalue) + ";");
514 params = currenteffect.elementsByTagName("parameter");
515 for (int i = 0; i < params.count(); i++) {
516 QDomElement e = params.item(i).toElement();
517 if (e.attribute("type") == "keyframe") e.setAttribute("keyframes", keyframes);
519 if (!continueParsing) {
520 n2 = lastParsedEffect;
523 // Check if effect has in/out points
524 if (effect.hasAttribute("in")) {
525 EffectsList::setParameter(currenteffect, "in", effect.attribute("in"));
527 if (effect.hasAttribute("out")) {
528 EffectsList::setParameter(currenteffect, "out", effect.attribute("out"));
532 // adjust effect parameters
533 for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
534 // parse effect parameters
535 QDomElement effectparam = n3.toElement();
536 QString paramname = effectparam.attribute("name");
537 QString paramvalue = effectparam.text();
540 // try to find this parameter in the effect xml
542 for (int k = 0; k < clipeffectparams.count(); k++) {
543 e = clipeffectparams.item(k).toElement();
544 if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == paramname) {
545 double factor = e.attribute("factor", "1").toDouble();
547 e.setAttribute("value", paramvalue.toDouble() * factor);
548 } else e.setAttribute("value", paramvalue);
553 if (effecttag == "ladspa") {
554 //QString ladspaEffectFile = EffectsList::parameter(effect, "src", "property");
556 if (!QFile::exists(ladspaEffectFile)) {
557 // If the ladspa effect file is missing, recreate it
558 initEffects::ladspaEffectFile(ladspaEffectFile, currenteffect.attribute("ladspaid").toInt(), m_trackview->getLadspaParams(currenteffect));
560 currenteffect.setAttribute("src", ladspaEffectFile);
562 item->addEffect(currenteffect, false);
563 item->effectsCounter();
568 // The clip in playlist was not listed in the kdenlive producers,
569 // something went wrong, repair required.
570 kWarning() << "CANNOT INSERT CLIP " << id;
571 int out = elem.attribute("out").toInt();
574 clipinfo.startPos = GenTime(position, m_doc->fps());
575 clipinfo.endPos = clipinfo.startPos + GenTime(out - in + 1, m_doc->fps());
576 clipinfo.cropStart = GenTime(in, m_doc->fps());
578 //kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
580 DocClipBase *missingClip = getMissingProducer(id);
582 // We cannot find the producer, something is really wrong, add
583 // placeholder color clip
584 QDomElement producerXml;
585 producerXml.setTagName("producer");
586 producerXml.setAttribute("resource", "0xff0000ff");
587 producerXml.setAttribute("mlt_service", "colour");
588 producerXml.setAttribute("length", "15000");
589 producerXml.setAttribute("id", id);
590 missingClip = new DocClipBase(m_doc->clipManager(), producerXml, id);
591 m_documentErrors.append(i18n("Boken clip producer %1", id) + '\n');
592 } else m_documentErrors.append(i18n("Replaced wrong clip producer %1 with %2", id, missingClip->getId()) + '\n');
593 ClipItem *item = new ClipItem(missingClip, clipinfo, m_doc->fps(), 1.0, false);
594 m_scene->addItem(item);
595 missingClip->addReference();
596 position += (out - in + 1);
598 m_doc->setModified(true);
600 //m_clipList.append(clip);
603 //m_trackDuration = position;
606 //documentTracks.insert(ix, track);
607 kDebug() << "************* ADD DOC TRACK " << ix << ", DURATION: " << position;
612 DocClipBase *TrackView::getMissingProducer(const QString id) const {
613 QDomElement missingXml = QDomElement();
614 QDomDocument doc = m_doc->toXml();
615 QString docRoot = doc.documentElement().attribute("root");
616 if (!docRoot.endsWith('/')) docRoot.append('/');
617 QDomNodeList prods = doc.elementsByTagName("producer");
618 int maxprod = prods.count();
619 for (int i = 0; i < maxprod; i++) {
620 QDomNode m = prods.at(i);
621 QString prodId = m.toElement().attribute("id");
623 missingXml = m.toElement();
627 if (missingXml == QDomElement()) return NULL;
629 QDomNodeList params = missingXml.childNodes();
632 for (int j = 0; j < params.count(); j++) {
633 QDomElement e = params.item(j).toElement();
634 if (e.attribute("name") == "resource") {
635 resource = e.firstChild().nodeValue();
636 } else if (e.attribute("name") == "mlt_service") {
637 mlt_service = e.firstChild().nodeValue();
640 resource.prepend(docRoot);
641 DocClipBase *missingClip = NULL;
642 if (!resource.isEmpty())
643 missingClip = m_doc->clipManager()->getClipByResource(resource);
647 QGraphicsScene *TrackView::projectScene() {
651 CustomTrackView *TrackView::projectView() {
655 void TrackView::setEditMode(const QString & editMode) {
656 m_editMode = editMode;
659 const QString & TrackView::editMode() const {
665 #include "trackview.moc"