From 9e60a3feb2846a2ad1d1533749874825c433aebf Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 1 Feb 2010 21:16:52 +0000 Subject: [PATCH] Fix bug in project default rendering settings: http://kdenlive.org/mantis/view.php?id=1402 svn path=/trunk/kdenlive/; revision=4267 --- src/mainwindow.cpp | 9 +++++---- src/mainwindow.h | 2 +- src/renderer.cpp | 2 +- src/renderwidget.cpp | 33 ++++++++++++++++++--------------- src/renderwidget.h | 4 ++-- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9274d5af..15afb56e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1852,7 +1852,7 @@ void MainWindow::slotRenderProject() QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder(); m_renderWidget = new RenderWidget(projectfolder, this); connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown())); - connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString&))); + connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString &, const QString&))); connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&))); connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &))); connect(m_renderWidget, SIGNAL(openDvdWizard(const QString &, const QString &)), this, SLOT(slotDvdWizard(const QString &, const QString &))); @@ -1860,7 +1860,7 @@ void MainWindow::slotRenderProject() m_renderWidget->setProfile(m_activeDocument->mltProfile()); m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration()); m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); - m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl")); + m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("rendercategory"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl")); } } /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget(); @@ -2051,7 +2051,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha m_renderWidget->setProfile(doc->mltProfile()); m_renderWidget->setGuides(doc->guidesXml(), doc->projectDuration()); m_renderWidget->setDocumentPath(doc->projectFolder().path(KUrl::AddTrailingSlash)); - m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl")); + m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("rendercategory"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl")); } //doc->setRenderer(m_projectMonitor->render); m_commandStack->setActiveStack(doc->commandStack()); @@ -3073,10 +3073,11 @@ void MainWindow::slotTranscodeClip() slotTranscode(urls); } -void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &name, const QString &file) +void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file) { if (m_activeDocument == NULL) return; m_activeDocument->setDocumentProperty("renderdestination", dest); + m_activeDocument->setDocumentProperty("rendercategory", group); m_activeDocument->setDocumentProperty("renderprofile", name); m_activeDocument->setDocumentProperty("renderurl", file); m_activeDocument->setModified(true); diff --git a/src/mainwindow.h b/src/mainwindow.h index 86ca504c..a5d44a4e 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -324,7 +324,7 @@ private slots: void slotMaximizeCurrent(bool show); void slotTranscode(KUrl::List urls = KUrl::List()); void slotTranscodeClip(); - void slotSetDocumentRenderProfile(const QString &dest, const QString &name, const QString &file); + void slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file); void slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile); void slotUpdateTimecodeFormat(int ix); /** Removes the focus of anything */ diff --git a/src/renderer.cpp b/src/renderer.cpp index d5123fa2..6788360e 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -1341,7 +1341,7 @@ void Render::playZone(const GenTime & startTime, const GenTime & stopTime) return; m_isBlocked = false; if (!m_isZoneMode) m_originalOut = m_mltProducer->get_playtime() - 1; - m_mltProducer->set("out", (int) (stopTime.frames(m_fps))); + m_mltProducer->set("out", (int)(stopTime.frames(m_fps))); m_mltProducer->seek((int)(startTime.frames(m_fps))); m_mltProducer->set_speed(1.0); m_mltConsumer->set("refresh", 1); diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index 26cd9294..a778a221 100644 --- a/src/renderwidget.cpp +++ b/src/renderwidget.cpp @@ -808,7 +808,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const m_view.tabWidget->setCurrentIndex(1); // Save rendering profile to document - emit selectedRenderProfile(m_view.size_list->currentItem()->data(MetaGroupRole).toString(), m_view.size_list->currentItem()->text(), dest); + emit selectedRenderProfile(m_view.size_list->currentItem()->data(MetaGroupRole).toString(), m_view.size_list->currentItem()->data(GroupRole).toString(), m_view.size_list->currentItem()->text(), dest); // insert item in running jobs list QTreeWidgetItem *renderItem; @@ -1659,34 +1659,37 @@ void RenderWidget::slotHideLog() m_view.error_box->setVisible(false); } -void RenderWidget::setRenderProfile(const QString &dest, const QString &name, const QString &url) +void RenderWidget::setRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &url) { m_view.destination_list->blockSignals(true); m_view.format_list->blockSignals(true); - m_view.size_list->blockSignals(true); if (!url.isEmpty()) m_view.out_file->setUrl(KUrl(url)); + // set destination for (int i = 0; i < m_view.destination_list->count(); i++) { if (m_view.destination_list->itemData(i, Qt::UserRole) == dest) { m_view.destination_list->setCurrentIndex(i); break; } } + refreshCategory(); + + // set category + if (!group.isEmpty()) { + QList childs = m_view.format_list->findItems(group, Qt::MatchExactly); + if (!childs.isEmpty()) { + m_view.format_list->setCurrentItem(childs.at(0)); + } + refreshView(); + } + + // set profile QList childs = m_view.size_list->findItems(name, Qt::MatchExactly); if (!childs.isEmpty()) { - QListWidgetItem *profile = childs.at(0); - if (profile->isHidden()) { - QString group = profile->data(GroupRole).toString(); - childs = m_view.format_list->findItems(group, Qt::MatchExactly); - if (!childs.isEmpty()) { - m_view.format_list->setCurrentItem(childs.at(0)); - } - } - //refreshView(); - m_view.size_list->blockSignals(false); - m_view.size_list->setCurrentItem(profile); - } else m_view.size_list->blockSignals(false); + m_view.size_list->setCurrentItem(childs.at(0)); + } + //refreshView(); m_view.destination_list->blockSignals(false); m_view.format_list->blockSignals(false); diff --git a/src/renderwidget.h b/src/renderwidget.h index fd808535..57b4c65a 100644 --- a/src/renderwidget.h +++ b/src/renderwidget.h @@ -108,7 +108,7 @@ public: void setRenderStatus(const QString &dest, int status, const QString &error); void setDocumentPath(const QString path); void reloadProfiles(); - void setRenderProfile(const QString &dest, const QString &name, const QString &url); + void setRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &url); int waitingJobsCount() const; QString getFreeScriptName(const QString &prefix = QString()); bool startWaitingRenderJobs(); @@ -167,7 +167,7 @@ signals: void openDvdWizard(const QString &url, const QString &profile); /** Send the infos about rendering that will be saved in the document: (profile destination, profile name and url of rendered file */ - void selectedRenderProfile(const QString &, const QString &, const QString &); + void selectedRenderProfile(const QString &, const QString &, const QString &, const QString &); void prepareRenderingData(bool scriptExport, bool zoneOnly, const QString &chapterFile); void shutdown(); }; -- 2.39.5