Allow %width, %height and %dar as placeholders for rendering profiles:

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

svn path=/branches/KDE4/; revision=2650
parent 6f7abb5d
......@@ -532,12 +532,12 @@ void KdenliveDoc::convertDocument(double version) {
content.setAttribute("font-color", colorToString(c));
// todo: These fields are missing from the newly generated xmldata:
// transform, startviewport, endviewport, background
QDomText conttxt = tdoc.createTextNode(ob.attribute("text"));
content.appendChild(conttxt);
item.appendChild(position);
item.appendChild(content);
title.appendChild(item);
title.appendChild(item);
} else if (ob.attribute("type") == "5") {
// rectangle object
QDomElement item = tdoc.createElement("item");
......@@ -607,25 +607,25 @@ void KdenliveDoc::convertDocument(double version) {
if (wproducer.isNull()) {
kWarning() << "Found producer in westley0, that was not a QDomElement";
} else {
// We have to do slightly different things, depending on the type
kDebug() << "Converting producer element with type " << wproducer.attribute("type");
if ( wproducer.attribute("type").toInt() == TEXT ) {
kDebug() << "Found TEXT element in producer" << endl;
QDomElement kproducer = wproducer.cloneNode(true).toElement();
kproducer.setTagName("kdenlive_producer");
kdenlivedoc_new.appendChild(kproducer);
// todo: Perhaps needs some more changes here to "frequency", aspect ratio as a float, frame_size, channels, and later, ressource and title name
} else {
QDomElement kproducer = m_document.createElement("kdenlive_producer");
kproducer.setAttribute("id", wproducer.attribute("id"));
kproducer.setAttribute("description", wproducer.attribute("description"));
kproducer.setAttribute("resource", wproducer.attribute("resource"));
kproducer.setAttribute("type", wproducer.attribute("type"));
kdenlivedoc_new.appendChild(kproducer);
}
if (wproducer.attribute("id").toInt() > max_kproducer_id) {
max_kproducer_id = wproducer.attribute("id").toInt();
}
// We have to do slightly different things, depending on the type
kDebug() << "Converting producer element with type " << wproducer.attribute("type");
if (wproducer.attribute("type").toInt() == TEXT) {
kDebug() << "Found TEXT element in producer" << endl;
QDomElement kproducer = wproducer.cloneNode(true).toElement();
kproducer.setTagName("kdenlive_producer");
kdenlivedoc_new.appendChild(kproducer);
// todo: Perhaps needs some more changes here to "frequency", aspect ratio as a float, frame_size, channels, and later, ressource and title name
} else {
QDomElement kproducer = m_document.createElement("kdenlive_producer");
kproducer.setAttribute("id", wproducer.attribute("id"));
kproducer.setAttribute("description", wproducer.attribute("description"));
kproducer.setAttribute("resource", wproducer.attribute("resource"));
kproducer.setAttribute("type", wproducer.attribute("type"));
kdenlivedoc_new.appendChild(kproducer);
}
if (wproducer.attribute("id").toInt() > max_kproducer_id) {
max_kproducer_id = wproducer.attribute("id").toInt();
}
}
}
}
......@@ -784,12 +784,6 @@ KUrl KdenliveDoc::projectFolder() const {
return m_projectFolder;
}
QString KdenliveDoc::getDocumentStandard() {
//WARNING: this way to tell the video standard is a bit hackish...
if (m_profile.description.contains("pal", Qt::CaseInsensitive) || m_profile.description.contains("25", Qt::CaseInsensitive) || m_profile.description.contains("50", Qt::CaseInsensitive)) return "PAL";
return "NTSC";
}
QString KdenliveDoc::profilePath() const {
return m_profile.path;
}
......
......@@ -88,8 +88,6 @@ Q_OBJECT public:
QString profilePath() const;
MltVideoProfile mltProfile() const;
QString description() const;
/** Returns the document format: PAL or NTSC */
QString getDocumentStandard();
void setUrl(KUrl url);
QDomElement documentInfoXml();
void setProfilePath(QString path);
......
......@@ -1137,7 +1137,7 @@ void MainWindow::slotEditProjectSettings() {
KdenliveSettings::setProject_fps(m_activeDocument->fps());
setCaption(m_activeDocument->description(), m_activeDocument->isModified());
m_monitorManager->resetProfiles(m_activeDocument->timecode());
if (m_renderWidget) m_renderWidget->setDocumentStandard(m_activeDocument->getDocumentStandard());
if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
// We need to desactivate & reactivate monitors to get a refresh
......@@ -1151,7 +1151,7 @@ void MainWindow::slotRenderProject() {
m_renderWidget = new RenderWidget(this);
connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)));
if (m_activeDocument) {
m_renderWidget->setDocumentStandard(m_activeDocument->getDocumentStandard());
m_renderWidget->setProfile(m_activeDocument->mltProfile());
m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
}
}
......@@ -1328,7 +1328,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
m_activeTimeline = trackView;
if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
if (m_renderWidget) m_renderWidget->setProfile(doc->mltProfile());
doc->setRenderer(m_projectMonitor->render);
m_commandStack->setActiveStack(doc->commandStack());
KdenliveSettings::setProject_display_ratio(doc->dar());
......
......@@ -361,13 +361,18 @@ void RenderWidget::slotExport() {
startPos = m_view.guide_start->itemData(m_view.guide_start->currentIndex()).toDouble();
endPos = m_view.guide_end->itemData(m_view.guide_end->currentIndex()).toDouble();
}
emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), overlayargs, m_view.advanced_params->toPlainText().split(' '), m_view.render_zone->isChecked(), m_view.play_after->isChecked(), startPos, endPos);
QString renderArgs = m_view.advanced_params->toPlainText();
renderArgs.replace("%width", QString::number(m_profile.width));
renderArgs.replace("%height", QString::number(m_profile.height));
renderArgs.replace("%dar", QString::number((double) m_profile.display_aspect_num / m_profile.display_aspect_den));
emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), overlayargs, renderArgs.split(' '), m_view.render_zone->isChecked(), m_view.play_after->isChecked(), startPos, endPos);
}
void RenderWidget::setDocumentStandard(QString std) {
if (std == "PAL") m_view.format_selection->setCurrentIndex(0);
void RenderWidget::setProfile(MltVideoProfile profile) {
m_profile = profile;
//WARNING: this way to tell the video standard is a bit hackish...
if (m_profile.description.contains("pal", Qt::CaseInsensitive) || m_profile.description.contains("25", Qt::CaseInsensitive) || m_profile.description.contains("50", Qt::CaseInsensitive)) m_view.format_selection->setCurrentIndex(0);
else m_view.format_selection->setCurrentIndex(1);
refreshView();
}
......
......@@ -24,6 +24,7 @@
#include <QDialog>
#include <QPushButton>
#include "definitions.h"
#include "ui_renderwidget_ui.h"
class RenderWidget : public QDialog {
......@@ -31,9 +32,9 @@ class RenderWidget : public QDialog {
public:
RenderWidget(QWidget * parent = 0);
void setDocumentStandard(QString std);
void setGuides(QDomElement guidesxml, double duration);
void focusFirstVisibleItem();
void setProfile(MltVideoProfile profile);
private slots:
void slotUpdateButtons();
......@@ -50,6 +51,7 @@ private slots:
private:
Ui::RenderWidget_UI m_view;
MltVideoProfile m_profile;
void parseProfiles(QString group = QString(), QString profile = QString());
void parseFile(QString exportFile, bool editable);
......
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