]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Merge branch 'master' of git://anongit.kde.org/kdenlive
[kdenlive] / src / mainwindow.cpp
index 460cff92619027e7e3dc0e7137b7b96927b6ba76..76e8ba25a2cbefaf8406370e5f1bb28772ba26ae 100644 (file)
@@ -64,7 +64,7 @@
 #include "audioscopes/spectrogram.h"
 #include "archivewidget.h"
 #include "databackup/backupwidget.h"
-#include "utils/freesound.h"
+#include "utils/resourcewidget.h"
 
 
 #include <KApplication>
@@ -1640,9 +1640,9 @@ void MainWindow::setupActions()
     collection.addAction("add_folder", addFolderButton);
     connect(addFolderButton , SIGNAL(triggered()), m_projectList, SLOT(slotAddFolder()));
     
-    QAction *downloadAudio = new KAction(KIcon("download"), i18n("Download Audio"), this);
-    collection.addAction("download_audio", downloadAudio);
-    connect(downloadAudio , SIGNAL(triggered()), this, SLOT(slotDownloadAudio()));
+    QAction *downloadResources = new KAction(KIcon("download"), i18n("Online Resources"), this);
+    collection.addAction("download_resource", downloadResources);
+    connect(downloadResources , SIGNAL(triggered()), this, SLOT(slotDownloadResources()));
 
     QAction *clipProperties = new KAction(KIcon("document-edit"), i18n("Clip Properties"), this);
     collection.addAction("clip_properties", clipProperties);
@@ -1686,6 +1686,7 @@ void MainWindow::setupActions()
     addClips->addAction(addTitleClip);
     addClips->addAction(addTitleTemplateClip);
     addClips->addAction(addFolderButton);
+    addClips->addAction(downloadResources);
 
     addClips->addAction(reloadClip);
     addClips->addAction(proxyClip);
@@ -1846,13 +1847,14 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
     QString profileName = KdenliveSettings::default_profile();
     KUrl projectFolder = KdenliveSettings::defaultprojectfolder();
     QMap <QString, QString> documentProperties;
+    QMap <QString, QString> documentMetadata;
     QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
     if (!showProjectSettings) {
         if (!KdenliveSettings::activatetabs())
             if (!closeCurrentDocument())
                 return;
     } else {
-        ProjectSettings *w = new ProjectSettings(NULL, QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
+        ProjectSettings *w = new ProjectSettings(NULL, QMap <QString, QString> (), QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
         if (w->exec() != QDialog::Accepted)
             return;
         if (!KdenliveSettings::activatetabs())
@@ -1872,12 +1874,13 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
         documentProperties.insert("proxyextension", w->proxyExtension());
         documentProperties.insert("generateimageproxy", QString::number((int) w->generateImageProxy()));
         documentProperties.insert("proxyimageminsize", QString::number(w->proxyImageMinSize()));
+        documentMetadata = w->metadata();
         delete w;
     }
     m_timelineArea->setEnabled(true);
     m_projectList->setEnabled(true);
     bool openBackup;
-    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, documentProperties, projectTracks, m_projectMonitor->render, m_notesWidget, &openBackup, this);
+    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, documentProperties, documentMetadata, projectTracks, m_projectMonitor->render, m_notesWidget, &openBackup, this);
     doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
     bool ok;
     TrackView *trackView = new TrackView(doc, &ok, this);
@@ -2110,7 +2113,7 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
     qApp->processEvents();
 
     bool openBackup;
-    KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QMap <QString, QString> (), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, &openBackup, this, &progressDialog);
+    KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QMap <QString, QString> (), QMap <QString, QString> (), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, &openBackup, this, &progressDialog);
 
     progressDialog.progressBar()->setValue(1);
     progressDialog.progressBar()->setMaximum(4);
@@ -2278,7 +2281,7 @@ void MainWindow::slotDetectAudioDriver()
 void MainWindow::slotEditProjectSettings()
 {
     QPoint p = m_activeDocument->getTracksCount();
-    ProjectSettings *w = new ProjectSettings(m_projectList, m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
+    ProjectSettings *w = new ProjectSettings(m_projectList, m_activeDocument->metadata(), m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
     connect(w, SIGNAL(disableProxies()), this, SLOT(slotDisableProxies()));
 
     if (w->exec() == QDialog::Accepted) {
@@ -2324,6 +2327,7 @@ void MainWindow::slotEditProjectSettings()
             m_activeDocument->setModified();
             slotUpdateProxySettings();
         }
+        m_activeDocument->setMetadata(w->metadata());
     }
     delete w;
 }
@@ -3055,10 +3059,10 @@ void MainWindow::slotEditItemDuration()
         m_activeTimeline->projectView()->editItemDuration();
 }
 
-void MainWindow::slotAddProjectClip(KUrl url)
+void MainWindow::slotAddProjectClip(KUrl url, const QString &comment)
 {
     if (m_activeDocument)
-        m_activeDocument->slotAddClipFile(url, QString());
+        m_activeDocument->slotAddClipFile(url, QString(), QString(), comment);
 }
 
 void MainWindow::slotAddProjectClipList(KUrl::List urls)
@@ -4078,7 +4082,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
         return;
     }
     file.close();
-    m_renderWidget->slotExport(scriptExport, m_activeTimeline->inPoint(), m_activeTimeline->outPoint(), playlistPath, scriptPath, exportAudio);
+    m_renderWidget->slotExport(scriptExport, m_activeTimeline->inPoint(), m_activeTimeline->outPoint(), m_activeDocument->metadata(), playlistPath, scriptPath, exportAudio);
 }
 
 void MainWindow::slotUpdateTimecodeFormat(int ix)
@@ -4502,13 +4506,13 @@ void MainWindow::slotElapsedTime()
 }
 
 
-void MainWindow::slotDownloadAudio()
+void MainWindow::slotDownloadResources()
 {
     QString currentFolder;
     if (m_activeDocument) currentFolder = m_activeDocument->projectFolder().path();
     else currentFolder = KdenliveSettings::defaultprojectfolder();
-    FreeSound *d = new FreeSound(currentFolder);
-    connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
+    ResourceWidget *d = new ResourceWidget(currentFolder);
+    connect(d, SIGNAL(addClip(KUrl, const QString &)), this, SLOT(slotAddProjectClip(KUrl, const QString &)));
     d->show();
 }