From: Jean-Baptiste Mardelle Date: Fri, 7 Mar 2008 12:59:19 +0000 (+0000) Subject: Show current document name in window title X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=7f9804a0ad296e0d757848a90f2c7f07295c42a0;p=kdenlive Show current document name in window title svn path=/branches/KDE4/; revision=2002 --- diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index c507231b..e2418dd3 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -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); diff --git a/src/kdenlivedoc.h b/src/kdenlivedoc.h index e5577737..e4e4c055 100644 --- a/src/kdenlivedoc.h +++ b/src/kdenlivedoc.h @@ -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; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ef4e096f..10dc35d7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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; }