]> git.sesse.net Git - kdenlive/blobdiff - src/renderwidget.cpp
Make it easier to save render scripts with custom names: http://www.kdenlive.org...
[kdenlive] / src / renderwidget.cpp
index 690e36e5e19ed4c7b6c63cc3777368122dad4218..512583ab467c0239dfb519297f17ab5ebd0fdcdc 100644 (file)
@@ -1551,7 +1551,6 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
     bool replaceLibfaacCodec = false;
     if (!acodecsList.contains("aac") && acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
 
-
     if (editable || groups.count() == 0) {
         QDomElement profiles = doc.documentElement();
         if (editable && profiles.attribute("version", 0).toInt() < 1) {
@@ -2077,7 +2076,7 @@ void RenderWidget::setRenderProfile(QMap <QString, QString> props)
 bool RenderWidget::startWaitingRenderJobs()
 {
     m_blockProcessing = true;
-    QString autoscriptFile = getFreeScriptName("auto");
+    QString autoscriptFile = getFreeScriptName(KUrl(), "auto");
     QFile file(autoscriptFile);
     if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
         kWarning() << "//////  ERROR writing to file: " << autoscriptFile;
@@ -2115,15 +2114,18 @@ bool RenderWidget::startWaitingRenderJobs()
     return true;
 }
 
-QString RenderWidget::getFreeScriptName(const QString &prefix)
+QString RenderWidget::getFreeScriptName(const KUrl &projectName, const QString &prefix)
 {
     int ix = 0;
     QString scriptsFolder = m_projectFolder + "scripts/";
     KStandardDirs::makeDir(scriptsFolder);
     QString path;
+    QString fileName;
+    if (projectName.isEmpty()) fileName = i18n("script");
+    else fileName = projectName.fileName().section('.', 0, -2) + "_";
     while (path.isEmpty() || QFile::exists(path)) {
         ix++;
-        path = scriptsFolder + prefix + i18n("script") + QString::number(ix).rightJustified(3, '0', false) + ".sh";
+        path = scriptsFolder + prefix + fileName + QString::number(ix).rightJustified(3, '0', false) + ".sh";
     }
     return path;
 }