Commit 1089e039 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

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

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