#include "kdenlivedoc.h"
#include "docclipbase.h"
-KdenliveDoc::KdenliveDoc(const KUrl &url, MltVideoProfile profile, 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_projectName(NULL), m_commandStack(new KUndoStack()) {
+KdenliveDoc::KdenliveDoc(const KUrl &url, MltVideoProfile profile, 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()) {
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());
return m_clipManager;
}
-QString KdenliveDoc::profilePath() {
+QString KdenliveDoc::profilePath() const {
return m_profile.path;
}
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");
}
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);
KdenliveDoc(const KUrl &url, MltVideoProfile profile, QWidget *parent = 0);
~KdenliveDoc();
- QString documentName();
QDomNodeList producersList();
- double fps();
- int width();
- int height();
- KUrl url();
+ double fps() const;
+ int width() const;
+ int height() const;
+ KUrl url() const;
void backupMltPlaylist();
- Timecode timecode();
- QDomDocument toXml();
+ Timecode timecode() const;
+ QDomDocument toXml() const;
void setRenderer(Render *render);
KUndoStack *commandStack();
QString producerName(int id);
void deleteProjectClip(const uint clipId);
/** Inform application of the audio thumbnails generation progress */
void setThumbsProgress(KUrl url, int progress);
- QString profilePath();
+ QString profilePath() const;
+ QString description() const;
private:
KUrl m_url;
if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
KdenliveDoc *doc = new KdenliveDoc(url, prof);
TrackView *trackView = new TrackView(doc);
- m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, QIcon(), doc->documentName() + " / " + prof.description));
+ m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, QIcon(), doc->description()));
m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
//connectDocument(trackView, doc);
w->addAction(redo);
}
m_undoView->setStack(doc->commandStack());
+ setCaption(doc->description());
m_activeDocument = doc;
}