]> git.sesse.net Git - kdenlive/commitdiff
Fix "save zone" saving proxy instead of real clip:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 23 Jun 2011 19:21:25 +0000 (19:21 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 23 Jun 2011 19:21:25 +0000 (19:21 +0000)
http://kdenlive.org/mantis/view.php?id=2184

svn path=/trunk/kdenlive/; revision=5726

src/mainwindow.cpp
src/mainwindow.h
src/monitor.cpp
src/monitor.h
src/renderer.cpp

index d6d4363cf1ba30d6f45a7439814aafd06ef08928..fe3fcd837510ef9f546b99ce026818698e963041 100644 (file)
@@ -860,8 +860,8 @@ void MainWindow::slotConnectMonitors()
 
     connect(m_projectMonitor, SIGNAL(requestFrameForAnalysis(bool)), this, SLOT(slotMonitorRequestRenderFrame(bool)));
 
-    connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
-    connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
+    connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint, DocClipBase *)), this, SLOT(slotSaveZone(Render *, QPoint, DocClipBase *)));
+    connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint, DocClipBase *)), this, SLOT(slotSaveZone(Render *, QPoint, DocClipBase *)));
 }
 
 void MainWindow::slotAdjustClipMonitor()
@@ -3516,7 +3516,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
 }
 
 
-void MainWindow::slotSaveZone(Render *render, QPoint zone)
+void MainWindow::slotSaveZone(Render *render, QPoint zone, DocClipBase *baseClip, KUrl path)
 {
     KDialog *dialog = new KDialog(this);
     dialog->setCaption("Save clip zone");
@@ -3527,9 +3527,15 @@ void MainWindow::slotSaveZone(Render *render, QPoint zone)
 
     QVBoxLayout *vbox = new QVBoxLayout(widget);
     QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
-    QString path = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash);
-    path.append("untitled.mlt");
-    KUrlRequester *url = new KUrlRequester(KUrl(path), this);
+    if (path.isEmpty()) {
+        QString tmppath = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash);
+        if (baseClip == NULL) tmppath.append("untitled.mlt");
+        else {
+            tmppath.append((baseClip->name().isEmpty() ? baseClip->fileURL().fileName() : baseClip->name()) + "-" + QString::number(zone.x()).rightJustified(4, '0') + ".mlt");
+        }
+        path = KUrl(tmppath);
+    }
+    KUrlRequester *url = new KUrlRequester(path, this);
     url->setFilter("video/mlt-playlist");
     QLabel *label2 = new QLabel(i18n("Description:"), this);
     KLineEdit *edit = new KLineEdit(this);
@@ -3537,8 +3543,19 @@ void MainWindow::slotSaveZone(Render *render, QPoint zone)
     vbox->addWidget(url);
     vbox->addWidget(label2);
     vbox->addWidget(edit);
-    if (dialog->exec() == QDialog::Accepted)
-        render->saveZone(url->url(), edit->text(), zone);
+    if (dialog->exec() == QDialog::Accepted) {
+        if (QFile::exists(url->url().path())) {
+            if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", url->url().path())) == KMessageBox::No) {
+                slotSaveZone(render, zone, baseClip, url->url());
+                return;
+            }
+        }
+        if (baseClip && !baseClip->fileURL().isEmpty()) {
+            // create zone from clip url, so that we don't have problems with proxy clips
+            QProcess::startDetached(KdenliveSettings::rendererpath(), QStringList() << baseClip->fileURL().path() << "in=" + QString::number(zone.x()) << "out=" + QString::number(zone.y()) << "-consumer" << "xml:" + url->url().path());
+        }
+        else render->saveZone(url->url(), edit->text(), zone);
+    }
 
 }
 
index c8d0ff241947d545f866917040cf500a271e53d0..9ae254db655924d1473693242b2a46b162a19d6c 100644 (file)
@@ -444,7 +444,7 @@ private slots:
 
     void slotAdjustClipMonitor();
     void slotAdjustProjectMonitor();
-    void slotSaveZone(Render *render, QPoint zone);
+    void slotSaveZone(Render *render, QPoint zone, DocClipBase *baseClip = NULL, KUrl path = KUrl());
 
     void slotSetInPoint();
     void slotSetOutPoint();
index 4cf150df7ac76e303fc5b3e396d39c669bb67c82..ab0cc3cfe1ef8f6f70641d769bc0a1ad20ad0c6c 100644 (file)
@@ -850,7 +850,7 @@ void Monitor::slotOpenFile(const QString &file)
 void Monitor::slotSaveZone()
 {
     if (render == NULL) return;
-    emit saveZone(render, m_ruler->zone());
+    emit saveZone(render, m_ruler->zone(), m_currentClip);
 
     //render->setSceneList(doc, 0);
 }
index 6e06f685bf08f9ec8558b92179643f55571fc39c..2359e745878b7d97e53860ce35c124c6f839c71d 100644 (file)
@@ -252,7 +252,7 @@ signals:
     void refreshClipThumbnail(const QString &, bool);
     void adjustMonitorSize();
     void zoneUpdated(QPoint);
-    void saveZone(Render *, QPoint);
+    void saveZone(Render *, QPoint, DocClipBase *);
     /** @brief  Editing transitions / effects over the monitor requires the renderer to send frames as QImage.
      *      This causes a major slowdown, so we only enable it if required */
     void requestFrameForAnalysis(bool);
index 7a4886737309bcf5cb9c503e5704314c7ab9766d..fd6a48585b89985b35ce3a64613e5b40d9b96545 100644 (file)
@@ -185,7 +185,6 @@ void Render::buildConsumer(const QString profileName)
 {
     m_activeProfile = profileName;
     char *tmp = qstrdup(m_activeProfile.toUtf8().constData());
-    setenv("MLT_PROFILE", tmp, 1);
     delete m_blackClip;
     m_blackClip = NULL;
 
@@ -194,7 +193,7 @@ void Render::buildConsumer(const QString profileName)
     if (m_mltProfile) delete m_mltProfile;
 
     m_mltProfile = new Mlt::Profile(tmp);
-    m_mltProfile->get_profile()->is_explicit = 1;
+    m_mltProfile->set_explicit(true);
     delete[] tmp;
 
     m_blackClip = new Mlt::Producer(*m_mltProfile, "colour", "black");