+ // Check for MLT luma files.
+ KUrl folder(mlt_environment("MLT_DATA"));
+ folder.addPath("lumas");
+ folder.addPath(mlt_environment("MLT_NORMALISATION"));
+ QDir lumafolder(folder.path());
+ QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
+ foreach(const QString & fname, filesnames) {
+ imagenamelist.append(fname);
+ KUrl path(folder);
+ path.addPath(fname);
+ imagefiles.append(path.toLocalFile());
+ }
+
+ //WARNING: this is a hack to get around temporary invalid metadata in MLT, 2nd of june 2011 JBM
+ QStringList customTransitions;
+ customTransitions << "composite" << "luma" << "affine" << "mix" << "region";
+
+ foreach(const QString & name, names) {
+ QDomDocument ret;
+ QDomElement ktrans = ret.createElement("ktransition");
+ ret.appendChild(ktrans);
+ ktrans.setAttribute("tag", name);
+
+ QDomElement tname = ret.createElement("name");
+ QDomElement desc = ret.createElement("description");
+ ktrans.appendChild(tname);
+ ktrans.appendChild(desc);
+ Mlt::Properties *metadata = NULL;
+ if (!customTransitions.contains(name)) metadata = repository->metadata(transition_type, name.toUtf8().data());
+ if (metadata && metadata->is_valid()) {
+ // If possible, set name and description.
+ if (metadata->get("title") && metadata->get("identifier"))
+ tname.appendChild(ret.createTextNode(metadata->get("title")));
+ desc.appendChild(ret.createTextNode(metadata->get("description")));
+
+ Mlt::Properties param_props((mlt_properties) metadata->get_data("parameters"));
+ for (int i = 0; param_props.is_valid() && i < param_props.count(); ++i) {
+ QDomElement params = ret.createElement("parameter");
+
+ Mlt::Properties paramdesc((mlt_properties) param_props.get_data(param_props.get_name(i)));
+
+ params.setAttribute("name", paramdesc.get("identifier"));
+
+ if (paramdesc.get("maximum"))
+ params.setAttribute("max", paramdesc.get("maximum"));
+ if (paramdesc.get("minimum"))
+ params.setAttribute("min", paramdesc.get("minimum"));
+ if (QString(paramdesc.get("type")) == "integer") {
+ params.setAttribute("type", "constant");
+ params.setAttribute("factor", "100");
+ }
+ if (QString(paramdesc.get("type")) == "boolean")
+ params.setAttribute("type", "bool");
+ if (!QString(paramdesc.get("format")).isEmpty()) {
+ params.setAttribute("type", "complex");
+ params.setAttribute("format", paramdesc.get("format"));
+ }
+ if (paramdesc.get("default"))
+ params.setAttribute("default", paramdesc.get("default"));
+ if (paramdesc.get("value"))
+ params.setAttribute("value", paramdesc.get("value"));
+ else
+ params.setAttribute("value", paramdesc.get("default"));
+
+ QDomElement pname = ret.createElement("name");
+ pname.appendChild(ret.createTextNode(paramdesc.get("title")));
+ params.appendChild(pname);
+ ktrans.appendChild(params);
+ }
+ } else {
+ /*
+ * Check for Kdenlive installed luma files, add empty string at
+ * start for no luma file.
+ */
+
+ // Implement default transitions.
+ QList<QDomElement> paramList;
+ if (name == "luma") {
+ ktrans.setAttribute("id", name);
+ tname.appendChild(ret.createTextNode(i18n("Wipe")));
+ desc.appendChild(ret.createTextNode(i18n("Applies a stationary transition between the current and next frames.")));
+
+ paramList.append(quickParameterFill(ret, i18n("Softness"), "softness", "double", "0", "0", "100", "", "", "100"));
+ paramList.append(quickParameterFill(ret, i18nc("@property: means that the image is inverted", "Invert"), "invert", "bool", "0", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Image File"), "resource", "list", "", "", "", imagefiles.join(";"), imagenamelist.join(",")));
+ paramList.append(quickParameterFill(ret, i18n("Reverse Transition"), "reverse", "bool", "0", "0", "1"));
+ //thumbnailer.prepareThumbnailsCall(imagelist);
+ } else if (name == "composite") {
+ ktrans.setAttribute("id", name);
+ tname.appendChild(ret.createTextNode(i18n("Composite")));
+ desc.appendChild(ret.createTextNode(i18n("A key-framable alpha-channel compositor for two frames.")));
+ paramList.append(quickParameterFill(ret, i18n("Geometry"), "geometry", "geometry", "0%/0%:100%x100%:100", "-500;-500;-500;-500;0", "500;500;500;500;100"));
+ paramList.append(quickParameterFill(ret, i18n("Alpha Channel Operation"), "operator", "list", "over", "", "", "over,and,or,xor", i18n("Over,And,Or,Xor")));
+ paramList.append(quickParameterFill(ret, i18n("Align"), "aligned", "bool", "1", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Fill"), "fill", "bool", "1", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Distort"), "distort", "bool", "0", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Wipe File"), "luma", "list", "", "", "", imagefiles.join(";"), imagenamelist.join(",")));
+ paramList.append(quickParameterFill(ret, i18n("Wipe Softness"), "softness", "double", "0", "0", "100", "", "", "100"));
+ paramList.append(quickParameterFill(ret, i18n("Wipe Invert"), "luma_invert", "bool", "0", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Force Progressive Rendering"), "progressive", "bool", "1", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Force Deinterlace Overlay"), "deinterlace", "bool", "0", "0", "1"));
+ } else if (name == "affine") {
+ tname.appendChild(ret.createTextNode(i18n("Affine")));
+ ret.documentElement().setAttribute("showrotation", "1");
+ /*paramList.append(quickParameterFill(ret, i18n("Rotate Y"), "rotate_y", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Rotate X"), "rotate_x", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Rotate Z"), "rotate_z", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Rotate Y"), "fix_rotate_y", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Rotate X"), "fix_rotate_x", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Rotate Z"), "fix_rotate_z", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Shear Y"), "shear_y", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Shear X"), "shear_x", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Shear Z"), "shear_z", "double", "0", "0", "360"));*/
+ /*paramList.append(quickParameterFill(ret, i18n("Fix Shear Y"), "fix_shear_y", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Shear X"), "fix_shear_x", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Shear Z"), "fix_shear_z", "double", "0", "0", "360"));*/
+
+ paramList.append(quickParameterFill(ret, "keyed", "keyed", "fixed", "1", "1", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Geometry"), "geometry", "geometry", "0/0:100%x100%:100%", "0/0:100%x100%:100%", "0/0:100%x100%:100%", "", "", "", "", "", "true"));
+ paramList.append(quickParameterFill(ret, i18n("Distort"), "distort", "bool", "0", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Rotate X"), "rotate_x", "addedgeometry", "0", "-1800", "1800", QString(), QString(), "10"));
+ paramList.append(quickParameterFill(ret, i18n("Rotate Y"), "rotate_y", "addedgeometry", "0", "-1800", "1800", QString(), QString(), "10"));
+ paramList.append(quickParameterFill(ret, i18n("Rotate Z"), "rotate_z", "addedgeometry", "0", "-1800", "1800", QString(), QString(), "10"));
+ /*paramList.append(quickParameterFill(ret, i18n("Rotate Y"), "rotate_y", "simplekeyframe", "0", "-1800", "1800", QString(), QString(), "10"));
+ paramList.append(quickParameterFill(ret, i18n("Rotate Z"), "rotate_z", "simplekeyframe", "0", "-1800", "1800", QString(), QString(), "10"));*/
+
+ paramList.append(quickParameterFill(ret, i18n("Fix Shear Y"), "shear_y", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Shear X"), "shear_x", "double", "0", "0", "360"));
+ paramList.append(quickParameterFill(ret, i18n("Fix Shear Z"), "shear_z", "double", "0", "0", "360"));
+ } else if (name == "mix") {
+ tname.appendChild(ret.createTextNode(i18n("Mix")));
+ } else if (name == "region") {
+ ktrans.setAttribute("id", name);
+ tname.appendChild(ret.createTextNode(i18n("Region")));
+ desc.appendChild(ret.createTextNode(i18n("Use alpha channel of another clip to create a transition.")));
+ paramList.append(quickParameterFill(ret, i18n("Transparency clip"), "resource", "url", "", "", "", "", "", ""));
+ paramList.append(quickParameterFill(ret, i18n("Geometry"), "composite.geometry", "geometry", "0%/0%:100%x100%:100", "-500;-500;-500;-500;0", "500;500;500;500;100"));
+ paramList.append(quickParameterFill(ret, i18n("Alpha Channel Operation"), "composite.operator", "list", "over", "", "", "over,and,or,xor", i18n("Over,And,Or,Xor")));
+ paramList.append(quickParameterFill(ret, i18n("Align"), "composite.aligned", "bool", "1", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Fill"), "composite.fill", "bool", "1", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Distort"), "composite.distort", "bool", "0", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Wipe File"), "composite.luma", "list", "", "", "", imagefiles.join(";"), imagenamelist.join(",")));
+ paramList.append(quickParameterFill(ret, i18n("Wipe Softness"), "composite.softness", "double", "0", "0", "100", "", "", "100"));
+ paramList.append(quickParameterFill(ret, i18n("Wipe Invert"), "composite.luma_invert", "bool", "0", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Force Progressive Rendering"), "composite.progressive", "bool", "1", "0", "1"));
+ paramList.append(quickParameterFill(ret, i18n("Force Deinterlace Overlay"), "composite.deinterlace", "bool", "0", "0", "1"));
+ }
+ foreach(const QDomElement & e, paramList)
+ ktrans.appendChild(e);
+ }
+ delete metadata;
+ metadata = 0;
+ // Add the transition to the global list.
+ transitions->append(ret.documentElement());
+ //kDebug() << ret.toString();
+ }