]> git.sesse.net Git - kdenlive/commitdiff
Display some progress info when opening document
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 26 May 2008 10:52:47 +0000 (10:52 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 26 May 2008 10:52:47 +0000 (10:52 +0000)
svn path=/branches/KDE4/; revision=2198

src/clipmanager.cpp
src/clipmanager.h
src/mainwindow.cpp
src/mainwindow.h
src/trackview.cpp

index a47e6a7030b3b006f027f0b04d1e4f31072d11de..7eb4145b93ef2dd6872322700a8ad1fa088df9fc 100644 (file)
@@ -42,8 +42,8 @@ void ClipManager::checkAudioThumbs() {
     }
 }
 
-void ClipManager::setThumbsProgress(KUrl url, int progress) {
-    m_doc->setThumbsProgress(url, progress);
+void ClipManager::setThumbsProgress(const QString &message, int progress) {
+    m_doc->setThumbsProgress(message, progress);
 }
 
 QList <DocClipBase*> ClipManager::documentClipList() {
index 2fac528a2e6b6403023b96e956dc5fdbb6981d1b..164d49a6e5f6c08b83c0de28216d98efae5ec7de 100644 (file)
@@ -54,7 +54,7 @@ Q_OBJECT public:
     void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, bool loop, const QString group, const int groupId);
     DocClipBase *getClipById(int clipId);
     void slotDeleteClip(uint clipId);
-    void setThumbsProgress(KUrl url, int progress);
+    void setThumbsProgress(const QString &message, int progress);
     void checkAudioThumbs();
     QList <DocClipBase*> documentClipList();
     int getFreeClipId();
index a45f030195eff2cfc78686b01986d93fef02ba4f..97daf70f9170888ecaf6c74bcf8fa6ff1cc4f10d 100644 (file)
@@ -572,17 +572,20 @@ void MainWindow::newFile() {
     }
     MltVideoProfile prof = ProfilesDialog::getVideoProfile(profileName);
     if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
-    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, prof, m_commandStack);
+    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, prof, m_commandStack, this);
     TrackView *trackView = new TrackView(doc, this);
     m_timelineArea->addTab(trackView, KIcon("kdenlive"), i18n("Untitled") + " / " + prof.description);
-    if (m_timelineArea->count() == 1)
+    if (m_timelineArea->count() == 1) {
+               connectDocumentInfo(doc);
         connectDocument(trackView, doc);
+       }
     else m_timelineArea->setTabBarHidden(false);
 }
 
 void MainWindow::activateDocument() {
     TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
     KdenliveDoc *currentDoc = currentTab->document();
+       connectDocumentInfo(currentDoc);
     connectDocument(currentTab, currentDoc);
 }
 
@@ -627,7 +630,7 @@ void MainWindow::saveFile() {
 }
 
 void MainWindow::openFile() { //changed
-    KUrl url = KFileDialog::getOpenUrl(KUrl(), "application/vnd.kde.kdenlive;*.kdenlive");
+    KUrl url = KFileDialog::getOpenUrl(KUrl(), "*.kdenlive|Kdenlive project files (*.kdenlive)\n*.westley|MLT project files (*.westley)");
     if (url.isEmpty()) return;
     m_fileOpenRecent->addUrl(url);
     openFile(url);
@@ -637,11 +640,13 @@ void MainWindow::openFile(const KUrl &url) { //new
     //TODO: get video profile from url before opening it
     MltVideoProfile prof = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
     if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
-    KdenliveDoc *doc = new KdenliveDoc(url, KUrl(), prof, m_commandStack);
+    KdenliveDoc *doc = new KdenliveDoc(url, KUrl(), prof, m_commandStack, this);
+       connectDocumentInfo(doc);
     TrackView *trackView = new TrackView(doc, this);
     m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
     m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
     if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
+       slotGotProgressInfo(QString(), -1);
     //connectDocument(trackView, doc);
 }
 
@@ -780,6 +785,14 @@ void MainWindow::slotUpdateDocumentState(bool modified) {
     }
 }
 
+void MainWindow::connectDocumentInfo(KdenliveDoc *doc) {
+    if (m_activeDocument) {
+        if (m_activeDocument == doc) return;
+        disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
+       }
+       connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
+}
+
 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //changed
     //m_projectMonitor->stop();
     kDebug() << "///////////////////   CONNECTING DOC TO PROJECT VIEW ////////////////";
@@ -795,7 +808,6 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(m_activeDocument, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
             disconnect(m_activeDocument, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
             disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int)));
-            disconnect(m_activeDocument, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
             disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
             disconnect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
             disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
@@ -828,7 +840,6 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     connect(doc, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
 
     connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
-    connect(doc, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
     connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
 
 
@@ -986,13 +997,13 @@ void MainWindow::slotFitZoom() {
     }
 }
 
-void MainWindow::slotGotProgressInfo(KUrl url, int progress) {
+void MainWindow::slotGotProgressInfo(const QString &message, int progress) {
     statusProgressBar->setValue(progress);
-    if (progress > 0) {
-        statusLabel->setText(tr("Creating Audio Thumbs"));
+    if (progress >= 0) {
+        if (!message.isEmpty()) statusLabel->setText(message);
         statusProgressBar->setVisible(true);
     } else {
-        statusLabel->setText("");
+        statusLabel->setText(QString());
         statusProgressBar->setVisible(false);
     }
 }
index ee58677a7e2770f0d441f5fd881cc7a13d325f26..78c56391e0d7b39d7946587811bb328be259df8f 100644 (file)
@@ -131,9 +131,11 @@ private:
     void saveOptions();
     void activateShuttleDevice();
     void slotShuttleAction(int code);
+       void connectDocumentInfo(KdenliveDoc *doc);
 
 public slots:
     void openFile(const KUrl &url);
+    void slotGotProgressInfo(const QString &message, int progress);
 
 private slots:
     void newFile();
@@ -156,7 +158,6 @@ private slots:
     void slotEditProfiles();
     void slotEditProjectSettings();
     void slotDisplayActionMessage(QAction *a);
-    void slotGotProgressInfo(KUrl url, int progress);
     void slotSwitchVideoThumbs();
     void slotSwitchAudioThumbs();
     void slotSwitchMarkersComments();
index 8117e5eb1f18429e1bbd301e0c7fa8b1733f9095..9c45abbdba7641361d6eb64a80667deb0a62c2ba 100644 (file)
@@ -136,8 +136,9 @@ void TrackView::parseDocument(QDomDocument doc) {
     QDomElement e;
     QDomElement p;
     bool videotrack;
-    kDebug() << "//////////// TIMELINE FOUND: " << m_projectTracks << " tracks";
+    
     int pos = m_projectTracks - 1;
+
     for (int i = 0; i < m_projectTracks; i++) {
         e = tracks.item(i).toElement();
         QString playlist_name = e.attribute("producer");
@@ -153,10 +154,16 @@ void TrackView::parseDocument(QDomDocument doc) {
             pos--;
             kDebug() << " PRO DUR: " << trackduration << ", TRACK DUR: " << duration;
             if (trackduration > duration) duration = trackduration;
-        } else pos--;
+        } else {
+                       // background black track
+                       int black_clips = e.childNodes().count();
+                       for (int i = 0; i < black_clips; i++)
+                               m_doc->loadingProgressed();
+                       qApp->processEvents();
+                       pos--;
+               }
     }
 
-
     // parse transitions
     QDomNodeList transitions = doc.elementsByTagName("transition");
     int projectTransitions = transitions.count();
@@ -283,6 +290,8 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) {
         if (elem.tagName() == "blank") {
             position += elem.attribute("length").toInt();
         } else if (elem.tagName() == "entry") {
+                       m_doc->loadingProgressed();
+                       qApp->processEvents();
             // Found a clip
             int in = elem.attribute("in").toInt();
             int id = elem.attribute("producer").toInt();