]> git.sesse.net Git - kdenlive/blobdiff - renderer/kdenlive_render.cpp
Start to add QLatin1String
[kdenlive] / renderer / kdenlive_render.cpp
index 079420b120b42f37aabea8f59f1ed2a8c2324859..72fa66ed46a9d6b8a23fec729963055bb0c5189b 100644 (file)
@@ -39,30 +39,30 @@ int main(int argc, char **argv)
         args.removeFirst();
 
         bool erase = false;
-        if (args.at(0) == "-erase") {
+        if (args.at(0) == QLatin1String("-erase")) {
             erase = true;
             args.removeFirst();
         }
         bool usekuiserver = false;
-        if (args.at(0) == "-kuiserver") {
+        if (args.at(0) == QLatin1String("-kuiserver")) {
             usekuiserver = true;
             args.removeFirst();
         }
-        if (QString(args.at(0)).startsWith("-pid:")) {
-            pid = QString(args.at(0)).section(':', 1).toInt();
+        if (QString(args.at(0)).startsWith(QLatin1String("-pid:"))) {
+            pid = QString(args.at(0)).section(QLatin1Char(':'), 1).toInt();
             args.removeFirst();
         }
 
-        if (QString(args.at(0)).startsWith("-locale:")) {
-            locale = QString(args.at(0)).section(':', 1);
+        if (QString(args.at(0)).startsWith(QLatin1String("-locale:"))) {
+            locale = QString(args.at(0)).section(QLatin1Char(':'), 1);
             args.removeFirst();
         }
-        if (args.at(0).startsWith("in="))
-            in = args.takeFirst().section('=', -1).toInt();
-        if (args.at(0).startsWith("out="))
-            out = args.takeFirst().section('=', -1).toInt();
-        if (args.at(0).startsWith("preargs="))
-            preargs = args.takeFirst().section('=', 1).split(' ', QString::SkipEmptyParts);
+        if (args.at(0).startsWith(QLatin1String("in=")))
+            in = args.takeFirst().section(QLatin1Char('='), -1).toInt();
+        if (args.at(0).startsWith(QLatin1String("out=")))
+            out = args.takeFirst().section(QLatin1Char('='), -1).toInt();
+        if (args.at(0).startsWith(QLatin1String("preargs=")))
+            preargs = args.takeFirst().section(QLatin1Char('='), 1).split(QLatin1Char(' '), QString::SkipEmptyParts);
 
         QString render = args.takeFirst();
         QString profile = args.takeFirst();
@@ -73,38 +73,38 @@ int main(int argc, char **argv)
         QString src = srcurl.path();
         // The QUrl path() strips the consumer: protocol, so re-add it if necessary
         if (srcString.startsWith("consumer:"))
-            src.prepend("consumer:");
+            src.prepend(QLatin1String("consumer:"));
         QUrl desturl = QUrl::fromEncoded(args.takeFirst().toUtf8());
         QString dest = desturl.path();
         bool dualpass = false;
         bool doerase;
         QString vpre;
 
-        int vprepos = args.indexOf(QRegExp("vpre=.*"));
+        int vprepos = args.indexOf(QRegExp(QLatin1String("vpre=.*")));
         if (vprepos >= 0) {
             vpre=args.at(vprepos);
         }
-        QStringList vprelist = vpre.replace("vpre=", "").split(',');
+        QStringList vprelist = vpre.replace(QLatin1String("vpre="), QLatin1String("")).split(QLatin1Char(','));
         if (vprelist.size() > 0) {
-            args.replaceInStrings(QRegExp("^vpre=.*"), QString("vpre=").append(vprelist.at(0)));
+            args.replaceInStrings(QRegExp(QLatin1String("^vpre=.*")), QString::fromLatin1("vpre=%1").arg(vprelist.at(0)));
         }
 
-        if (args.contains("pass=2")) {
+        if (args.contains(QLatin1String("pass=2"))) {
             // dual pass encoding
             dualpass = true;
             doerase = false;
-            args.replace(args.indexOf("pass=2"), "pass=1");
-            if (args.contains("vcodec=libx264")) args << QString("passlogfile=%1").arg(dest + ".log");
+            args.replace(args.indexOf(QLatin1String("pass=2")), QLatin1String("pass=1"));
+            if (args.contains(QLatin1String("vcodec=libx264"))) args << QString::fromLatin1("passlogfile=%1").arg(dest + QLatin1String(".log"));
         } else {
-            args.removeAll("pass=1");
+            args.removeAll(QLatin1String("pass=1"));
             doerase = erase;
         }
         
         // Decode metadata
         for (int i = 0; i < args.count(); ++i) {
-            if (args.at(i).startsWith("meta.attr")) {
+            if (args.at(i).startsWith(QLatin1String("meta.attr"))) {
                 QString data = args.at(i);
-                args.replace(i, data.section('=', 0, 0) + "=\"" + QUrl::fromPercentEncoding(data.section('=', 1).toUtf8()) + "\"");
+                args.replace(i, data.section(QLatin1Char('='), 0, 0) + QLatin1String("=\"") + QUrl::fromPercentEncoding(data.section(QLatin1Char('='), 1).toUtf8()) + QLatin1String("\""));
             }
         }
 
@@ -114,8 +114,8 @@ int main(int argc, char **argv)
         job->start();
         if (dualpass) {
             if (vprelist.size()>1)
-                args.replaceInStrings(QRegExp("^vpre=.*"),QString("vpre=").append(vprelist.at(1)));
-            args.replace(args.indexOf("pass=1"), "pass=2");
+                args.replaceInStrings(QRegExp(QLatin1String("^vpre=.*")),QString::fromLatin1("vpre=%1").arg(vprelist.at(1)));
+            args.replace(args.indexOf(QLatin1String("pass=1")), QLatin1String("pass=2"));
             RenderJob *dualjob = new RenderJob(erase, usekuiserver, pid, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
             QObject::connect(job, SIGNAL(renderingFinished()), dualjob, SLOT(start()));
         }