]> git.sesse.net Git - kdenlive/commitdiff
Show current document name in window title
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 7 Mar 2008 12:59:19 +0000 (12:59 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 7 Mar 2008 12:59:19 +0000 (12:59 +0000)
svn path=/branches/KDE4/; revision=2002

src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp

index c507231b10f56f9dc794c84a537e7e328e2a3eae..e2418dd34e328b2d62486a55b8cd9a38b36d30a4 100644 (file)
@@ -28,7 +28,7 @@
 #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;
@@ -36,7 +36,6 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, MltVideoProfile profile, QWidget *pare
             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());
@@ -115,7 +114,7 @@ ClipManager *KdenliveDoc::clipManager() {
     return m_clipManager;
 }
 
-QString KdenliveDoc::profilePath() {
+QString KdenliveDoc::profilePath() const {
     return m_profile.path;
 }
 
@@ -193,18 +192,14 @@ QDomDocument KdenliveDoc::generateSceneList() {
     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");
 }
@@ -213,22 +208,29 @@ 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);
index e55777371df8443391ea4377cf5e7bbf46219f26..e4e4c05544b803314c6a87fff600d8b5a2b20f79 100644 (file)
@@ -41,15 +41,14 @@ Q_OBJECT public:
 
     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);
@@ -67,7 +66,8 @@ Q_OBJECT public:
     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;
index ef4e096f5505ef708b2c95321bd3f6aee0d2f921..10dc35d7a6c64237ed327ff7d1cb3be5c8283792 100644 (file)
@@ -349,7 +349,7 @@ void MainWindow::openFile(const KUrl &url) { //new
     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);
@@ -497,6 +497,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
         w->addAction(redo);
     }
     m_undoView->setStack(doc->commandStack());
+    setCaption(doc->description());
     m_activeDocument = doc;
 }