#include "kdenlivedoc.h"
#include "docclipbase.h"
-KdenliveDoc::KdenliveDoc(const KUrl &url, double fps, int width, int height, QWidget *parent): QObject(parent), m_render(NULL), m_url(url), m_fps(fps), m_width(width), m_height(height), m_projectName(NULL), m_commandStack(new KUndoStack()) {
+KdenliveDoc::KdenliveDoc(const KUrl &url, MltVideoProfile profile, QUndoGroup *undoGroup, QWidget *parent): QObject(parent), m_render(NULL), m_url(url), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)) {
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QString tmpFile;
QFile file(tmpFile);
m_document.setContent(&file, false);
file.close();
- m_projectName = url.fileName();
KIO::NetAccess::removeTempFile(tmpFile);
} else {
KMessageBox::error(parent, KIO::NetAccess::lastErrorString());
doc.appendChild(tractor);
}
- if (fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
- else m_timecode.setFormat((int) fps);
+ m_scenelist = m_document.toString();
+ if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
+ else m_timecode.setFormat((int) m_fps);
}
KdenliveDoc::~KdenliveDoc() {
return m_clipManager;
}
+QString KdenliveDoc::profilePath() const {
+ return m_profile.path;
+}
+
void KdenliveDoc::setThumbsProgress(KUrl url, int progress) {
emit thumbsProgress(url, progress);
}
void KdenliveDoc::setRenderer(Render *render) {
m_render = render;
- if (m_render) m_render->setSceneList(m_document);
+ if (m_render) m_render->setSceneList(m_scenelist);
}
Render *KdenliveDoc::renderer() {
QDomElement prod = doc.createElement("producer");
}
-QDomDocument KdenliveDoc::toXml() {
+QDomDocument KdenliveDoc::toXml() const {
return m_document;
}
-Timecode KdenliveDoc::timecode() {
+Timecode KdenliveDoc::timecode() const {
return m_timecode;
}
-QString KdenliveDoc::documentName() {
- return m_projectName;
-}
-
QDomNodeList KdenliveDoc::producersList() {
return m_document.elementsByTagName("producer");
}
-void KdenliveDoc::setProducers(QDomElement doc) {
- QDomNode kdenlivedocument = m_document.elementsByTagName("kdenlivedoc").item(0);
-
- QDomNodeList list = m_document.elementsByTagName("producer");
- int ct = list.count();
- kDebug() << "DELETING CHILD PRODUCERS: " << ct;
- for (int i = ct; i > 0; i--) {
- kdenlivedocument.removeChild(list.item(i));
- }
-
- QDomNode n = doc.firstChild();
- ct = 0;
- while (!n.isNull()) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
- if (!e.isNull() && e.tagName() == "producer") {
- kdenlivedocument.appendChild(m_document.importNode(e, true));
- ct++;
- }
- n = n.nextSibling();
- }
- kDebug() << "ADDING CHILD PRODS: " << ct << "\n";
- //kDebug()<<m_document.toString();
+void KdenliveDoc::backupMltPlaylist() {
+ if (m_render) m_scenelist = m_render->sceneList();
}
-double KdenliveDoc::fps() {
+double KdenliveDoc::fps() const {
return m_fps;
}
-int KdenliveDoc::width() {
+int KdenliveDoc::width() const {
return m_width;
}
-int KdenliveDoc::height() {
+int KdenliveDoc::height() const {
return m_height;
}
-KUrl KdenliveDoc::url() {
+KUrl KdenliveDoc::url() const {
return m_url;
}
+QString KdenliveDoc::description() const {
+ if (m_url.isEmpty())
+ return i18n("Untitled") + " / " + m_profile.description;
+ else
+ return m_url.fileName() + " / " + m_profile.description;
+}
+
void KdenliveDoc::addClip(const QDomElement &elem, const int clipId) {
kDebug() << "///////// DOCUM, CREATING NEW CLIP, ID:" << clipId;
DocClipBase *clip = new DocClipBase(m_clipManager, elem, clipId);