Jobs can now be aborted from the "running job" view

svn path=/branches/KDE4/; revision=2922
parent 997e9f8a
......@@ -80,9 +80,18 @@ RenderJob::~RenderJob() {
m_logfile.close();
}
void RenderJob::slotAbort(const QString& url) {
if (m_dest == url) slotAbort();
}
void RenderJob::slotAbort() {
qDebug() << "Kdenlive-render: JOB ABORTED BY USER...";
m_renderProcess->kill();
if (m_kdenliveinterface) {
m_dbusargs[1] = -3;
m_kdenliveinterface->callWithArgumentList(QDBus::NoBlock, "setRenderingProgress", m_dbusargs);
}
if (m_jobUiserver) m_jobUiserver->call("terminate", QString());
if (m_erase) {
QFile f(m_scenelist);
......@@ -173,6 +182,8 @@ void RenderJob::start() {
m_dbusargs.append(m_dest);
m_dbusargs.append((int) 0);
m_kdenliveinterface->callWithArgumentList(QDBus::NoBlock, "setRenderingProgress", m_dbusargs);
connect(m_kdenliveinterface, SIGNAL(abortRenderJob(const QString &)),
this, SLOT(slotAbort(const QString&)));
}
// Because of the logging, we connect to stderr in all cases.
......
......@@ -40,6 +40,7 @@ private slots:
void slotIsOver(int exitcode, QProcess::ExitStatus status);
void receivedStderr();
void slotAbort();
void slotAbort(const QString& url);
private:
QString m_scenelist;
......
......@@ -1395,6 +1395,7 @@ void MainWindow::slotRenderProject() {
if (!m_renderWidget) {
m_renderWidget = new RenderWidget(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(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
if (m_activeDocument) {
m_renderWidget->setProfile(m_activeDocument->mltProfile());
m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
......
......@@ -287,6 +287,9 @@ private slots:
void generateClip();
void slotZoneMoved(int start, int end);
void slotUpdatePreviewSettings();
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
};
......
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kdenlive.MainWindow">
<signal name="abortRenderJob">
<arg name="url" type="s" direction="out"/>
</signal>
<method name="setRenderingProgress">
<arg name="url" type="s" direction="in"/>
<arg name="progress" type="i" direction="in"/>
......
......@@ -68,6 +68,7 @@ RenderWidget::RenderWidget(QWidget * parent): QDialog(parent) {
connect(m_view.buttonEdit, SIGNAL(clicked()), this, SLOT(slotEditProfile()));
connect(m_view.buttonDelete, SIGNAL(clicked()), this, SLOT(slotDeleteProfile()));
connect(m_view.buttonStart, SIGNAL(clicked()), this, SLOT(slotExport()));
connect(m_view.abort_job, SIGNAL(clicked()), this, SLOT(slotAbortCurrentJob()));
connect(m_view.buttonClose, SIGNAL(clicked()), this, SLOT(hide()));
connect(m_view.buttonClose2, SIGNAL(clicked()), this, SLOT(hide()));
connect(m_view.out_file, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButtons()));
......@@ -645,6 +646,10 @@ void RenderWidget::setRenderJob(const QString &dest, int progress) {
// Rendering crashed
existing.at(0)->setIcon(0, KIcon("dialog-close"));
existing.at(0)->setData(1, Qt::UserRole, 0);
} else if (progress == -3) {
// User aborted job
existing.at(0)->setIcon(0, KIcon("dialog-close"));
existing.at(0)->setData(1, Qt::UserRole, 100);
} else existing.at(0)->setData(1, Qt::UserRole, progress);
return;
}
......@@ -657,8 +662,17 @@ void RenderWidget::setRenderJob(const QString &dest, int progress) {
// Rendering crashed
item->setIcon(0, KIcon("dialog-close"));
item->setData(1, Qt::UserRole, 0);
} else if (progress == -3) {
// User aborted job
item->setIcon(0, KIcon("dialog-close"));
item->setData(1, Qt::UserRole, 100);
} else item->setData(1, Qt::UserRole, progress);
}
void RenderWidget::slotAbortCurrentJob() {
QTreeWidgetItem *current = m_view.running_jobs->currentItem();
if (current) emit abortProcess(current->text(0));
}
#include "renderwidget.moc"
......@@ -87,6 +87,7 @@ private slots:
void slotCheckEndGuidePosition();
void showInfoPanel();
void slotUpdateExperimentalRendering();
void slotAbortCurrentJob();
private:
Ui::RenderWidget_UI m_view;
......@@ -97,6 +98,7 @@ private:
signals:
void doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool);
void abortProcess(const QString &url);
};
......
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