]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Show progress when archiving compressed project
[kdenlive] / src / mainwindow.cpp
index c7aa40f8e6e1fc71bee91b762178f6c8f417117d..a6bd5c50d0fc8f407afacc8b78e64fd62f7741ec 100644 (file)
@@ -61,6 +61,7 @@
 #include "colorscopes/histogram.h"
 #include "audiospectrum.h"
 #include "spectrogram.h"
+#include "archivewidget.h"
 
 #include <KApplication>
 #include <KAction>
@@ -215,7 +216,10 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
 
     m_notesDock = new QDockWidget(i18n("Project Notes"), this);
     m_notesDock->setObjectName("notes_widget");
-    m_notesWidget = new KTextEdit();
+    m_notesWidget = new NotesWidget();
+    connect(m_notesWidget, SIGNAL(insertNotesTimecode()), this, SLOT(slotInsertNotesTimecode()));
+    connect(m_notesWidget, SIGNAL(seekProject(int)), m_projectMonitor->render, SLOT(seekToFrame(int)));
+    
     m_notesWidget->setTabChangesFocus(true);
 #if KDE_IS_VERSION(4,4,0)
     m_notesWidget->setClickMessage(i18n("Enter your project notes here ..."));
@@ -844,7 +848,7 @@ void MainWindow::slotConnectMonitors()
     connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool, bool)));
 
     connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
-    connect(m_projectMonitor->render, SIGNAL(removeInvalidProxy(const QString &)), m_projectList, SLOT(slotRemoveInvalidProxy(const QString &)));
+    connect(m_projectMonitor->render, SIGNAL(removeInvalidProxy(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidProxy(const QString &, bool)));
 
     connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &, bool)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &, bool)));
 
@@ -1203,6 +1207,11 @@ void MainWindow::setupActions()
     collection.addAction("transcode_clip", transcodeClip);
     connect(transcodeClip, SIGNAL(triggered(bool)), this, SLOT(slotTranscodeClip()));
 
+    KAction *archiveProject =  new KAction(KIcon("file-save"), i18n("Archive Project"), this);
+    collection.addAction("archive_project", archiveProject);
+    connect(archiveProject, SIGNAL(triggered(bool)), this, SLOT(slotArchiveProject()));
+    
+
     KAction *markIn = collection.addAction("mark_in");
     markIn->setText(i18n("Set Zone In"));
     markIn->setShortcut(Qt::Key_I);
@@ -3821,18 +3830,48 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
 
         // replace proxy clips with originals
         QMap <QString, QString> proxies = m_projectList->getProxies();
-        QMapIterator<QString, QString> i(proxies);
+
+
+        QDomNodeList producers = doc.elementsByTagName("producer");
+        QString producerResource;
+        QString suffix;
+        for (uint n = 0; n < producers.length(); n++) {
+            QDomElement e = producers.item(n).toElement();
+            producerResource = EffectsList::property(e, "resource");
+            if (producerResource.contains('?')) {
+                suffix = "?" + producerResource.section('?', 1);
+                producerResource = producerResource.section('?', 0, 0);
+            }
+            else suffix.clear();
+            if (!producerResource.isEmpty()) {
+                if (proxies.contains(producerResource)) {
+                    EffectsList::setProperty(e, "resource", proxies.value(producerResource) + suffix);
+                    // We need to delete the "aspect_ratio" property because proxy clips
+                    // sometimes have different ratio than original clips
+                    EffectsList::removeProperty(e, "aspect_ratio");
+                }
+                else if (!root.isEmpty() && producerResource.startsWith(root) && proxies.contains(producerResource.remove(0, root.count() + 1))) {
+                    EffectsList::setProperty(e, "resource", proxies.value(producerResource.remove(0, root.count() + 1)) + suffix);
+                    // We need to delete the "aspect_ratio" property because proxy clips
+                    // sometimes have different ratio than original clips
+                    EffectsList::removeProperty(e, "aspect_ratio");
+                }
+            }
+        }
+        
+        /*QMapIterator<QString, QString> i(proxies);
         while (i.hasNext()) {
             i.next();
             // Replace all keys with their values (proxy path with original path)
             QString key = i.key();
             playlistContent.replace(key, i.value());
             if (!root.isEmpty() && key.startsWith(root)) {
-                // in case ther resource path in MLT playlist is relative
+                // in case the resource path in MLT playlist is relative
                 key.remove(0, root.count() + 1);
                 playlistContent.replace(key, i.value());
             }
-        }
+        }*/
+        playlistContent = doc.toString();
     }
     
     // Do save scenelist
@@ -3910,11 +3949,12 @@ void MainWindow::slotChangePalette(QAction *action, const QString &themename)
         plt = QApplication::desktop()->palette();
     } else {
         KSharedConfigPtr config = KSharedConfig::openConfig(theme);
-        
-        // Since there currently is a bug (or feature change) in KGlobalSettings::createApplicationPalette, we need
-        // to do the palette loading stuff ourselves...
-        //plt = KGlobalSettings::createApplicationPalette(config);
+
+#if KDE_IS_VERSION(4,6,3)
+        plt = KGlobalSettings::createNewApplicationPalette(config);
+#else
+        // Since there was a bug in createApplicationPalette in KDE < 4.6.3 we need
+        // to do the palette loading stuff ourselves. (https://bugs.kde.org/show_bug.cgi?id=263497)     
         QPalette::ColorGroup states[3] = { QPalette::Active, QPalette::Inactive,
                                             QPalette::Disabled };
         // TT thinks tooltips shouldn't use active, so we use our active colors for all states
@@ -3948,7 +3988,9 @@ void MainWindow::slotChangePalette(QAction *action, const QString &themename)
             plt.setBrush( state, QPalette::Link, schemeView.foreground( KColorScheme::LinkText ) );
             plt.setBrush( state, QPalette::LinkVisited, schemeView.foreground( KColorScheme::VisitedText ) );
         }
+#endif
     }
+
     kapp->setPalette(plt);
     const QObjectList children = statusBar()->children();
 
@@ -4200,6 +4242,22 @@ void MainWindow::slotUpdateProxySettings()
     m_projectList->updateProxyConfig();
 }
 
+void MainWindow::slotInsertNotesTimecode()
+{
+    int frames = m_projectMonitor->render->seekPosition().frames(m_activeDocument->fps());
+    QString position = m_activeDocument->timecode().getTimecodeFromFrames(frames);
+    m_notesWidget->insertHtml("<a href=\"" + QString::number(frames) + "\">" + position + "</a> ");
+}
+
+void MainWindow::slotArchiveProject()
+{
+    QList <DocClipBase*> list = m_projectList->documentClipList();
+    QDomDocument doc = m_activeDocument->xmlSceneList(m_projectMonitor->sceneList(), m_projectList->expandedFolders());
+    ArchiveWidget *d = new ArchiveWidget(m_activeDocument->url().fileName(), doc, list, m_activeTimeline->projectView()->extractTransitionsLumas(), this);
+    d->exec();
+}
+
+
 #include "mainwindow.moc"
 
 #ifdef DEBUG_MAINW