Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Rendering scripts can now be generated from the render dialog:

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

svn path=/branches/KDE4/; revision=3040
parent 233fa54c
......@@ -1399,7 +1399,7 @@ void MainWindow::slotRenderProject() {
if (!m_renderWidget) {
QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path() : KdenliveSettings::defaultprojectfolder();
m_renderWidget = new RenderWidget(projectfolder, this);
connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool)));
connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool, const QString &)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, 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 &)));
if (m_activeDocument) {
......@@ -1413,7 +1413,8 @@ void MainWindow::slotRenderProject() {
m_renderWidget->show();
}
void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd, bool resizeProfile) {
void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd, bool resizeProfile, const QString &scriptExport) {
kDebug() << "// SCRIPT EXPORT: " << scriptExport;
if (dest.isEmpty()) return;
int in;
int out;
......@@ -1425,18 +1426,21 @@ void MainWindow::slotDoRender(const QString &dest, const QString &render, const
KTemporaryFile temp;
temp.setAutoRemove(false);
temp.setSuffix(".westley");
if (temp.open()) {
if (!scriptExport.isEmpty() || temp.open()) {
if (KdenliveSettings::dropbframes()) {
KdenliveSettings::setDropbframes(false);
m_activeDocument->clipManager()->updatePreviewSettings();
m_projectMonitor->saveSceneList(temp.fileName());
if (!scriptExport.isEmpty()) m_projectMonitor->saveSceneList(scriptExport + ".westley");
else m_projectMonitor->saveSceneList(temp.fileName());
KdenliveSettings::setDropbframes(true);
m_activeDocument->clipManager()->updatePreviewSettings();
} else m_projectMonitor->saveSceneList(temp.fileName());
} else {
if (!scriptExport.isEmpty()) m_projectMonitor->saveSceneList(scriptExport + ".westley");
else m_projectMonitor->saveSceneList(temp.fileName());
}
QStringList args;
args << "-erase";
if (scriptExport.isEmpty()) args << "-erase";
if (KdenliveSettings::usekuiserver()) args << "-kuiserver";
if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
else if (guideStart != -1) {
......@@ -1464,14 +1468,36 @@ void MainWindow::slotDoRender(const QString &dest, const QString &render, const
if (resizeProfile) {
// The rendering profile is different from project profile, so use MLT's special producer_consumer
args << "consumer:" + temp.fileName();
} else args << temp.fileName();
args << dest << avformat_args;
if (scriptExport.isEmpty()) args << "consumer:" + temp.fileName();
else args << "consumer:$SOURCE";
} else {
if (scriptExport.isEmpty()) args << temp.fileName();
else args << "$SOURCE";
}
if (scriptExport.isEmpty()) args << dest;
else args << "$TARGET";
args << avformat_args;
QString renderer = QCoreApplication::applicationDirPath() + QString("/kdenlive_render");
if (!QFile::exists(renderer)) renderer = "kdenlive_render";
QProcess::startDetached(renderer, args);
if (scriptExport.isEmpty()) {
QProcess::startDetached(renderer, args);
KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", dest), QPixmap(), this);
} else {
// Generate script file
QFile file(scriptExport);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
m_messageLabel->setMessage(i18n("Cannot write to file %1", scriptExport), ErrorMessage);
return;
}
KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", dest), QPixmap(), this);
QTextStream out(&file);
out << "#! /bin/sh" << "\n" << "\n";
out << "SOURCE=" << "\"" + scriptExport + ".westley\"" << "\n";
out << "TARGET=" << "\"" + dest + "\"" << "\n";
out << renderer << " " << args.join(" ") << "\n" << "\n";
file.close();
QFile::setPermissions(scriptExport, file.permissions() | QFile::ExeUser);
}
}
}
......
......@@ -225,7 +225,7 @@ private slots:
void slotSwitchMarkersComments();
void slotSwitchSnap();
void slotRenderProject();
void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd, bool resizeProfile);
void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd, bool resizeProfile, const QString &scriptExport);
void slotFullScreen();
void slotUpdateDocumentState(bool modified);
void slotZoomIn();
......
This diff is collapsed.
......@@ -94,6 +94,41 @@ public:
};
// RenderScriptDelegate is used to draw the script items.
class RenderScriptDelegate : public QItemDelegate {
Q_OBJECT
public:
RenderScriptDelegate(QWidget *parent) : QItemDelegate(parent) {}
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const {
if (index.column() == 0) {
QRect r1 = option.rect;
painter->save();
if (option.state & (QStyle::State_Selected)) {
painter->setPen(option.palette.color(QPalette::HighlightedText));
painter->fillRect(r1, option.palette.highlight());
} else painter->setPen(option.palette.color(QPalette::Text));
QFont font = painter->font();
font.setBold(true);
painter->setFont(font);
int mid = (int)((r1.height() / 2));
r1.setBottom(r1.y() + mid);
r1.setLeft(r1.left() + 3);
QRect r2 = option.rect;
r2.setTop(r2.y() + mid);
r2.setLeft(r2.left() + 3);
painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
font.setBold(false);
painter->setFont(font);
painter->setPen(option.palette.color(QPalette::Mid));
painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , index.data(Qt::UserRole).toString());
painter->restore();
return;
} else QItemDelegate::paint(painter, option, index);
}
};
class RenderWidget : public QDialog {
Q_OBJECT
......@@ -109,7 +144,7 @@ public:
private slots:
void slotUpdateButtons(KUrl url);
void slotUpdateButtons();
void slotExport();
void slotExport(bool scriptExport = false);
void refreshView();
void refreshParams();
void slotSaveProfile();
......@@ -120,6 +155,12 @@ private slots:
void slotCheckEndGuidePosition();
void showInfoPanel();
void slotAbortCurrentJob();
void slotStartScript();
void slotDeleteScript();
void slotGenerateScript();
void parseScriptFiles();
void slotCheckScript();
void slotCheckJob();
private:
Ui::RenderWidget_UI m_view;
......@@ -131,7 +172,7 @@ private:
KUrl filenameWithExtension(KUrl url, QString extension);
signals:
void doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool);
void doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool, const QString &);
void abortProcess(const QString &url);
void openDvdWizard(const QString &url, const QString &profile);
};
......
This diff is collapsed.
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