]> git.sesse.net Git - kdenlive/blobdiff - src/initeffects.cpp
Use const'ref
[kdenlive] / src / initeffects.cpp
index 74ea0a83dfa9f19c5980c4a836833b57637a79dd..e2f7734e6e4073ecbfe7f96b5d9766af4579d69d 100644 (file)
@@ -200,8 +200,10 @@ void initEffects::parseEffectFiles(const QString &locale)
         while (!in.atEnd()) {
             QString black = in.readLine().simplified();
             if (!black.isEmpty() && !black.startsWith('#') &&
-                    mltFiltersList.contains(black))
+                    mltFiltersList.contains(black)) {
                 mltFiltersList.removeAll(black);
+           }
+           
         }
         file2.close();
     }
@@ -229,8 +231,7 @@ void initEffects::parseEffectFiles(const QString &locale)
     MainWindow::transitions.clearList();
     foreach(const QDomElement & effect, effectsMap)
         MainWindow::transitions.append(effect);
-    effectsMap.clear();
-
+    effectsMap.clear();    
     // Create effects from MLT
     foreach(const QString & filtername, mltFiltersList) {
         QDomDocument doc = createDescriptionFromMlt(repository, "filters", filtername);
@@ -243,7 +244,9 @@ void initEffects::parseEffectFiles(const QString &locale)
                     if (desc.startsWith("Process audio using a SoX")) {
                         // Remove MLT's SOX generated effects since the parameters properties are unusable for us
                     }
-                    else audioEffectsMap.insert(doc.documentElement().firstChildElement("name").text().toLower().toUtf8().data(), doc.documentElement());
+                    else {
+                       audioEffectsMap.insert(doc.documentElement().firstChildElement("name").text().toLower().toUtf8().data(), doc.documentElement());
+                   }
                 }
             }
             else
@@ -341,7 +344,7 @@ void initEffects::parseCustomEffectsFile()
            }
            effectsMap.insert(groupName.toLower().toUtf8().data(), base);
         } else if (base.tagName() == "effect") {
-            effectsMap.insert(e.firstChildElement("name").text().toLower().toUtf8().data(), base);
+            effectsMap.insert(base.firstChildElement("name").text().toLower().toUtf8().data(), base);
         }
         else kDebug() << "Unsupported effect file: " << itemName;
     }
@@ -482,16 +485,23 @@ QDomDocument initEffects::createDescriptionFromMlt(Mlt::Repository* repository,
                 QDomElement params = ret.createElement("parameter");
 
                 Mlt::Properties paramdesc((mlt_properties) param_props.get_data(param_props.get_name(j)));
-
                 params.setAttribute("name", paramdesc.get("identifier"));
+               if (params.attribute("name") == "argument") {
+                   // This parameter has to be given as attribute when using command line, do not show it in Kdenlive
+                   continue;
+               }
 
                 if (paramdesc.get("maximum")) params.setAttribute("max", paramdesc.get("maximum"));
                 if (paramdesc.get("minimum")) params.setAttribute("min", paramdesc.get("minimum"));
 
                 QString paramType = paramdesc.get("type");
                 
-                if (paramType == "integer")
-                    params.setAttribute("type", "constant");
+                if (paramType == "integer") {
+                   if (params.attribute("min") == "0" && params.attribute("max") == "1")
+                       params.setAttribute("type", "bool");
+                    else params.setAttribute("type", "constant");
+                   
+               }
                 else if (paramType == "float") {
                     params.setAttribute("type", "constant");
                     // param type is float, set default decimals to 3
@@ -516,6 +526,12 @@ QDomDocument initEffects::createDescriptionFromMlt(Mlt::Repository* repository,
                 QDomElement pname = ret.createElement("name");
                 pname.appendChild(ret.createTextNode(paramdesc.get("title")));
                 params.appendChild(pname);
+               
+               if (paramdesc.get("description")) {
+                   QDomElement desc = ret.createElement("comment");
+                   desc.appendChild(ret.createTextNode(paramdesc.get("description")));
+                   params.appendChild(desc);
+               }
 
                 eff.appendChild(params);
             }