From: Jean-Baptiste Mardelle Date: Thu, 23 Jun 2011 19:21:25 +0000 (+0000) Subject: Fix "save zone" saving proxy instead of real clip: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=75ab956438547fe8d71102c8117ad37b561580eb;p=kdenlive Fix "save zone" saving proxy instead of real clip: http://kdenlive.org/mantis/view.php?id=2184 svn path=/trunk/kdenlive/; revision=5726 --- diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d6d4363c..fe3fcd83 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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); + } } diff --git a/src/mainwindow.h b/src/mainwindow.h index c8d0ff24..9ae254db 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -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(); diff --git a/src/monitor.cpp b/src/monitor.cpp index 4cf150df..ab0cc3cf 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -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); } diff --git a/src/monitor.h b/src/monitor.h index 6e06f685..2359e745 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -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); diff --git a/src/renderer.cpp b/src/renderer.cpp index 7a488673..fd6a4858 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -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");