Commit 984df727 authored by Vincent Pinon's avatar Vincent Pinon
Browse files

Fix script export & QScript header left

parent 6f5584ee
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <QProcess> #include <QProcess>
#include <QDBusConnectionInterface> #include <QDBusConnectionInterface>
#include <QThread> #include <QThread>
#include <QScriptEngine>
#include <QKeyEvent> #include <QKeyEvent>
#include <QTimer> #include <QTimer>
#include <QStandardPaths> #include <QStandardPaths>
...@@ -92,7 +91,7 @@ enum JOBSTATUS { ...@@ -92,7 +91,7 @@ enum JOBSTATUS {
ABORTEDJOB ABORTEDJOB
}; };
#ifdef _WIN32 #ifdef Q_OS_WIN
const QLatin1String ScriptFormat(".bat"); const QLatin1String ScriptFormat(".bat");
QString ScriptSetVar(const QString name, const QString value) { return QString("set ") + name + "=" + value; } QString ScriptSetVar(const QString name, const QString value) { return QString("set ") + name + "=" + value; }
QString ScriptGetVar(const QString varName) { return QString('%') + varName + '%'; } QString ScriptGetVar(const QString varName) { return QString('%') + varName + '%'; }
...@@ -1073,7 +1072,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, ...@@ -1073,7 +1072,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut,
return; return;
} }
QTextStream outStream(&file); QTextStream outStream(&file);
#ifndef _WIN32 #ifndef Q_OS_WIN
outStream << "#! /bin/sh" << '\n' << '\n'; outStream << "#! /bin/sh" << '\n' << '\n';
#endif #endif
outStream << ScriptSetVar("RENDERER", m_renderer) << '\n'; outStream << ScriptSetVar("RENDERER", m_renderer) << '\n';
...@@ -1093,7 +1092,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, ...@@ -1093,7 +1092,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut,
if (!scriptExport) { if (!scriptExport) {
render_process_args << QStringLiteral("-erase"); render_process_args << QStringLiteral("-erase");
} }
#ifndef _WIN32 #ifndef Q_OS_WIN
if (KdenliveSettings::usekuiserver()) { if (KdenliveSettings::usekuiserver()) {
render_process_args << QStringLiteral("-kuiserver"); render_process_args << QStringLiteral("-kuiserver");
} }
...@@ -2305,13 +2304,12 @@ void RenderWidget::slotCLeanUpJobs() ...@@ -2305,13 +2304,12 @@ void RenderWidget::slotCLeanUpJobs()
void RenderWidget::parseScriptFiles() void RenderWidget::parseScriptFiles()
{ {
QStringList scriptsFilter; QStringList scriptsFilter;
scriptsFilter << QStringLiteral("*.sh"); scriptsFilter << QLatin1Char('*') + ScriptFormat;
m_view.scripts_list->clear(); m_view.scripts_list->clear();
QTreeWidgetItem *item; QTreeWidgetItem *item;
// List the project scripts // List the project scripts
QDir directory(m_projectFolder); QDir directory(m_projectFolder + QStringLiteral("scripts/"));
directory.cd(QStringLiteral("scripts"));
QStringList scriptFiles = directory.entryList(scriptsFilter, QDir::Files); QStringList scriptFiles = directory.entryList(scriptsFilter, QDir::Files);
for (int i = 0; i < scriptFiles.size(); ++i) { for (int i = 0; i < scriptFiles.size(); ++i) {
QUrl scriptpath = QUrl::fromLocalFile(directory.absoluteFilePath(scriptFiles.at(i))); QUrl scriptpath = QUrl::fromLocalFile(directory.absoluteFilePath(scriptFiles.at(i)));
...@@ -2323,15 +2321,15 @@ void RenderWidget::parseScriptFiles() ...@@ -2323,15 +2321,15 @@ void RenderWidget::parseScriptFiles()
QTextStream stream(&file); QTextStream stream(&file);
while (!stream.atEnd()) { while (!stream.atEnd()) {
QString line = stream.readLine(); QString line = stream.readLine();
if (line.startsWith(QLatin1String("TARGET_0="))) { if (line.contains(QLatin1String("TARGET_0="))) {
target = line.section(QStringLiteral("TARGET_0=\""), 1); target = line.section(QStringLiteral("TARGET_0="), 1);
target = target.section(QLatin1Char('"'), 0, 0); target = target.section(QLatin1Char('"'), 0, 0, QString::SectionSkipEmpty);
} else if (line.startsWith(QLatin1String("RENDERER="))) { } else if (line.contains(QLatin1String("RENDERER="))) {
renderer = line.section(QStringLiteral("RENDERER=\""), 1); renderer = line.section(QStringLiteral("RENDERER="), 1);
renderer = renderer.section(QLatin1Char('"'), 0, 0); renderer = renderer.section(QLatin1Char('"'), 0, 0, QString::SectionSkipEmpty);
} else if (line.startsWith(QLatin1String("MELT="))) { } else if (line.contains(QLatin1String("MELT="))) {
melt = line.section(QStringLiteral("MELT=\""), 1); melt = line.section(QStringLiteral("MELT="), 1);
melt = melt.section(QLatin1Char('"'), 0, 0); melt = melt.section(QLatin1Char('"'), 0, 0, QString::SectionSkipEmpty);
} }
} }
file.close(); file.close();
......
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