Remember render settings for project (zone, guides,...):

http://www.kdenlive.org/mantis/view.php?id=1681

svn path=/trunk/kdenlive/; revision=4649
parent 4e1438fe
......@@ -1245,5 +1245,16 @@ const QString KdenliveDoc::getDocumentProperty(const QString &name) const
return m_documentProperties.value(name);
}
QMap <QString, QString> KdenliveDoc::getRenderProperties() const
{
QMap <QString, QString> renderProperties;
QMapIterator<QString, QString> i(m_documentProperties);
while (i.hasNext()) {
i.next();
if (i.key().startsWith("render")) renderProperties.insert(i.key(), i.value());
}
return renderProperties;
}
#include "kdenlivedoc.moc"
......@@ -114,6 +114,8 @@ Q_OBJECT public:
bool isTrackLocked(int ix) const;
void setDocumentProperty(const QString &name, const QString &value);
const QString getDocumentProperty(const QString &name) const;
/** @brief get the list of renderer properties that were saved in the document */
QMap <QString, QString> getRenderProperties() const;
private:
KUrl m_url;
......
......@@ -1977,7 +1977,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 &, const QString&, bool, bool, int, int)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString &, const QString&, bool, bool, int, int)));
connect(m_renderWidget, SIGNAL(selectedRenderProfile(QMap <QString, QString>)), this, SLOT(slotSetDocumentRenderProfile(QMap <QString, 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 &)));
......@@ -1985,7 +1985,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("rendercategory"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl"), m_activeDocument->getDocumentProperty("renderzone") == "1", m_activeDocument->getDocumentProperty("renderguide") == "1", m_activeDocument->getDocumentProperty("startguide").toInt(), m_activeDocument->getDocumentProperty("endguide").toInt());
m_renderWidget->setRenderProfile(m_activeDocument->getRenderProperties());
}
}
slotCheckRenderStatus();
......@@ -2196,7 +2196,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("rendercategory"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl"), doc->getDocumentProperty("renderzone") == "1", doc->getDocumentProperty("renderguide") == "1", doc->getDocumentProperty("startguide").toInt(), doc->getDocumentProperty("endguide").toInt());
m_renderWidget->setRenderProfile(doc->getRenderProperties());
}
//doc->setRenderer(m_projectMonitor->render);
m_commandStack->setActiveStack(doc->commandStack());
......@@ -3358,17 +3358,14 @@ void MainWindow::slotTranscodeClip()
slotTranscode(urls);
}
void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file, bool renderZone, bool renderGuide, int startGuide, int endGuide)
void MainWindow::slotSetDocumentRenderProfile(QMap <QString, QString> props)
{
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->setDocumentProperty("renderzone", QString::number(renderZone));
m_activeDocument->setDocumentProperty("renderguide", QString::number(renderGuide));
m_activeDocument->setDocumentProperty("startguide", QString::number(startGuide));
m_activeDocument->setDocumentProperty("endguide", QString::number(endGuide));
QMapIterator<QString, QString> i(props);
while (i.hasNext()) {
i.next();
m_activeDocument->setDocumentProperty(i.key(), i.value());
}
m_activeDocument->setModified(true);
}
......
......@@ -432,7 +432,7 @@ private slots:
void slotMaximizeCurrent(bool show);
void slotTranscode(KUrl::List urls = KUrl::List());
void slotTranscodeClip();
void slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file, bool renderZone, bool renderGuide, int startGuide, int endGuide);
void slotSetDocumentRenderProfile(QMap <QString, QString> props);
void slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile);
/** @brief Switches between displaying frames or timecode.
......
......@@ -823,7 +823,29 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
renderParameters << scriptName;
// Save rendering profile to document
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, m_view.render_zone->isChecked(), m_view.render_guide->isChecked(), m_view.guide_start->currentIndex(), m_view.guide_end->currentIndex());
QMap <QString, QString> renderProps;
renderProps.insert("renderdestination", m_view.size_list->currentItem()->data(MetaGroupRole).toString());
renderProps.insert("rendercategory", m_view.size_list->currentItem()->data(GroupRole).toString());
renderProps.insert("renderprofile", m_view.size_list->currentItem()->text());
renderProps.insert("renderurl", dest);
renderProps.insert("renderzone", QString::number(m_view.render_zone->isChecked()));
renderProps.insert("renderguide", QString::number(m_view.render_guide->isChecked()));
renderProps.insert("renderstartguide", QString::number(m_view.guide_start->currentIndex()));
renderProps.insert("renderendguide", QString::number(m_view.guide_end->currentIndex()));
renderProps.insert("renderendguide", QString::number(m_view.guide_end->currentIndex()));
renderProps.insert("renderscanning", QString::number(m_view.scanning_list->currentIndex()));
int export_audio = 0;
if (m_view.export_audio->checkState() == Qt::Checked) export_audio = 2;
else if (m_view.export_audio->checkState() == Qt::Unchecked) export_audio = 1;
renderProps.insert("renderexportaudio", QString::number(export_audio));
renderProps.insert("renderrescale", QString::number(m_view.rescale->isChecked()));
renderProps.insert("renderrescalewidth", QString::number(m_view.rescale_width->value()));
renderProps.insert("renderrescaleheight", QString::number(m_view.rescale_height->value()));
renderProps.insert("rendertcoverlay", QString::number(m_view.tc_overlay->isChecked()));
renderProps.insert("renderratio", QString::number(m_view.rescale_keep->isChecked()));
renderProps.insert("renderplay", QString::number(m_view.play_after->isChecked()));
emit selectedRenderProfile(renderProps);
// insert item in running jobs list
QTreeWidgetItem *renderItem;
......@@ -1697,23 +1719,43 @@ void RenderWidget::slotHideLog()
m_view.error_box->setVisible(false);
}
void RenderWidget::setRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &url, bool renderZone, bool renderGuide, int guideStart, int guideEnd)
void RenderWidget::setRenderProfile(QMap <QString, QString> props)
{
m_view.destination_list->blockSignals(true);
m_view.format_list->blockSignals(true);
if (renderZone) m_view.render_zone->setChecked(true);
else if (renderGuide) {
m_view.scanning_list->setCurrentIndex(props.value("renderscanning").toInt());
int exportAudio = props.value("renderexportaudio").toInt();
switch (exportAudio) {
case 1:
m_view.export_audio->setCheckState(Qt::Unchecked);
break;
case 2:
m_view.export_audio->setCheckState(Qt::Checked);
break;
default:
m_view.export_audio->setCheckState(Qt::PartiallyChecked);
}
if (props.contains("renderrescale")) m_view.rescale->setChecked(props.value("renderrescale").toInt());
if (props.contains("renderrescalewidth")) m_view.rescale_width->setValue(props.value("renderrescalewidth").toInt());
if (props.contains("renderrescaleheight")) m_view.rescale_height->setValue(props.value("renderrescaleheight").toInt());
if (props.contains("rendertcoverlay")) m_view.tc_overlay->setChecked(props.value("rendertcoverlay").toInt());
if (props.contains("renderratio")) m_view.rescale_keep->setChecked(props.value("renderratio").toInt());
if (props.contains("renderplay")) m_view.play_after->setChecked(props.value("renderplay").toInt());
if (props.value("renderzone") == "1") m_view.render_zone->setChecked(true);
else if (props.value("renderguide") == "1") {
m_view.render_guide->setChecked(true);
m_view.guide_start->setCurrentIndex(guideStart);
m_view.guide_end->setCurrentIndex(guideEnd);
m_view.guide_start->setCurrentIndex(props.value("renderstartguide").toInt());
m_view.guide_end->setCurrentIndex(props.value("renderendguide").toInt());
} else m_view.render_full->setChecked(true);
slotUpdateGuideBox();
QString url = props.value("renderurl");
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) {
if (m_view.destination_list->itemData(i, Qt::UserRole) == props.value("renderdestination")) {
m_view.destination_list->setCurrentIndex(i);
break;
}
......@@ -1721,6 +1763,7 @@ void RenderWidget::setRenderProfile(const QString &dest, const QString &group, c
refreshCategory();
// set category
QString group = props.value("rendercategory");
if (!group.isEmpty()) {
QList<QListWidgetItem *> childs = m_view.format_list->findItems(group, Qt::MatchExactly);
if (!childs.isEmpty()) {
......@@ -1731,7 +1774,7 @@ void RenderWidget::setRenderProfile(const QString &dest, const QString &group, c
}
// set profile
QList<QListWidgetItem *> childs = m_view.size_list->findItems(name, Qt::MatchExactly);
QList<QListWidgetItem *> childs = m_view.size_list->findItems(props.value("renderprofile"), Qt::MatchExactly);
if (!childs.isEmpty()) {
m_view.size_list->setCurrentItem(childs.at(0));
m_view.size_list->scrollToItem(childs.at(0));
......
......@@ -118,7 +118,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 &group, const QString &name, const QString &url, bool renderZone, bool renderGuide, int guideStart, int guideEnd);
void setRenderProfile(QMap <QString, QString> props);
int waitingJobsCount() const;
QString getFreeScriptName(const QString &prefix = QString());
bool startWaitingRenderJobs();
......@@ -189,7 +189,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 &, const QString &, bool, bool, int, int);
void selectedRenderProfile(QMap <QString, QString> renderProps);
void prepareRenderingData(bool scriptExport, bool zoneOnly, const QString &chapterFile);
void shutdown();
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment