Commit c603cadc authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '1904'

parents 1318cec4 c0b3b54c
......@@ -28,6 +28,7 @@
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QObject>
#include <cstdio>
int main(int argc, char **argv)
......@@ -138,8 +139,12 @@ int main(int argc, char **argv)
}
}
auto *rJob = new RenderJob(render, playlist, target, pid, in, out);
auto *rJob = new RenderJob(render, playlist, target, pid, in, out, qApp);
rJob->start();
QObject::connect(rJob, &RenderJob::renderingFinished, [&, rJob]() {
rJob->deleteLater();
app.quit();
});
return app.exec();
} else {
fprintf(stderr,
......
......@@ -32,8 +32,8 @@ public:
static void msleep(unsigned long msecs) { QThread::msleep(msecs); }
};
RenderJob::RenderJob(const QString &render, const QString &scenelist, const QString &target, int pid, int in, int out)
: QObject()
RenderJob::RenderJob(const QString &render, const QString &scenelist, const QString &target, int pid, int in, int out, QObject *parent)
: QObject(parent)
, m_scenelist(scenelist)
, m_dest(std::move(target))
, m_progress(0)
......@@ -73,6 +73,8 @@ RenderJob::RenderJob(const QString &render, const QString &scenelist, const QStr
RenderJob::~RenderJob()
{
delete m_jobUiserver;
delete m_kdenliveinterface;
delete m_renderProcess;
m_logfile.close();
}
......@@ -256,7 +258,7 @@ void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
{
if (m_jobUiserver) {
m_jobUiserver->call(QStringLiteral("setDescriptionField"), (uint)1, tr("Rendered file"), m_dest);
// m_jobUiserver->call(QStringLiteral("terminate"), QString());
m_jobUiserver->call(QStringLiteral("terminate"), QString());
}
if (!isWritable) {
QString error = tr("Cannot write to %1, check permissions.").arg(m_dest);
......@@ -265,9 +267,10 @@ void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
m_dbusargs.append(error);
m_kdenliveinterface->callWithArgumentList(QDBus::NoBlock, QStringLiteral("setRenderingFinished"), m_dbusargs);
}
QProcess::startDetached(QStringLiteral("kdialog"), QStringList() << QStringLiteral("--error") << error);
QProcess::startDetached(QStringLiteral("kdialog"), {QStringLiteral("--error"), error});
m_logstream << error << endl;
qApp->quit();
emit renderingFinished();
//qApp->quit();
}
if (m_erase) {
QFile(m_scenelist).remove();
......@@ -284,7 +287,7 @@ void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
args << QStringLiteral("--error") << error;
m_logstream << error << endl;
QProcess::startDetached(QStringLiteral("kdialog"), args);
qApp->quit();
emit renderingFinished();
} else {
if (!m_dualpass && (m_kdenliveinterface != nullptr)) {
m_dbusargs[1] = (int)-1;
......@@ -302,11 +305,10 @@ void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
}
m_logstream.flush();
if (m_dualpass) {
emit renderingFinished();
deleteLater();
} else {
m_logfile.remove();
qApp->quit();
}
}
emit renderingFinished();
}
......@@ -33,7 +33,7 @@ class RenderJob : public QObject
Q_OBJECT
public:
RenderJob(const QString &render, const QString &scenelist, const QString &target, int pid = -1, int in = -1, int out = -1);
RenderJob(const QString &render, const QString &scenelist, const QString &target, int pid = -1, int in = -1, int out = -1, QObject *parent = nullptr);
~RenderJob();
void setLocale(const QString &locale);
......
......@@ -35,6 +35,7 @@
#include <QInputDialog>
#include <QScopedPointer>
#include <KIO/RenameDialog>
#include <mlt++/Mlt.h>
SpeedJob::SpeedJob(const QString &binId, double speed, QString destUrl)
......@@ -83,6 +84,17 @@ int SpeedJob::prepareJob(const std::shared_ptr<JobManager> &ptr, const std::vect
auto binClip = pCore->projectItemModel()->getClipByBinID(binId);
// Filter several clips, destination points to a folder
QString mltfile = QFileInfo(binClip->url()).absoluteFilePath() + QStringLiteral(".mlt");
if (QFile::exists(mltfile)) {
KIO::RenameDialog renameDialog(qApp->activeWindow(), QString(), /*i18n("File already exists"), */QUrl::fromLocalFile(mltfile), QUrl::fromLocalFile(mltfile), KIO::RenameDialog_Option::RenameDialog_Overwrite );
if (renameDialog.exec() == QDialog::Accepted) {
QUrl final = renameDialog.newDestUrl();
if (final.isValid()) {
mltfile = final.toLocalFile();
}
} else {
return -1;
}
}
destinations[binId] = mltfile;
}
// Now we have to create the jobs objects. This is trickier than usual, since the parameters are different for each job (each clip has its own
......
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