#include <QFile>
#include <qregexp.h>
#include <QDir>
+#include <QIcon>
#include <KDebug>
#include <kglobal.h>
#include "initeffects.h"
#include "kdenlivesettings.h"
#include "effectslist.h"
+#include "effectstackedit.h"
+#include "mainwindow.h"
+
+initEffectsThumbnailer::initEffectsThumbnailer() {
+
+}
+
+void initEffectsThumbnailer::prepareThumbnailsCall(const QStringList& list) {
+ m_list = list;
+ start();
+ kDebug() << "done";
+}
+
+void initEffectsThumbnailer::run() {
+ foreach(QString entry, m_list) {
+ kDebug() << entry;
+ if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
+ if (!EffectStackEdit::iconCache.contains(entry)) {
+ QImage pix(entry);
+ //if (!pix.isNull())
+ EffectStackEdit::iconCache[entry] = pix.scaled(30, 30);
+ kDebug() << "stored";
+ }
+ }
+ }
+}
+
+initEffectsThumbnailer initEffects::thumbnailer;
initEffects::initEffects() {
+
}
initEffects::~initEffects() {
}
//static
-Mlt::Repository *initEffects::parseEffectFiles(EffectsList *audioEffectList, EffectsList *videoEffectList, EffectsList* transitionsList) {
+Mlt::Repository *initEffects::parseEffectFiles() {
QStringList::Iterator more;
QStringList::Iterator it;
QStringList fileList;
transitionsItemList << transitions->get_name(i);
}
delete transitions;
- fillTransitionsList(repository, transitionsList, transitionsItemList);
+ fillTransitionsList(repository, &MainWindow::transitions, transitionsItemList);
KGlobal::dirs()->addResourceType("ladspa_plugin", 0, "lib/ladspa");
KGlobal::dirs()->addResourceDir("ladspa_plugin", "/usr/lib/ladspa");
fileList = directory.entryList(QDir::Files);
for (it = fileList.begin() ; it != fileList.end() ; ++it) {
itemName = KUrl(*more + *it).path();
- parseEffectFile(audioEffectList, videoEffectList, itemName, filtersList, producersList);
+ parseEffectFile(&MainWindow::audioEffects, &MainWindow::videoEffects, itemName, filtersList, producersList);
// kDebug()<<"// FOUND EFFECT FILE: "<<itemName<<endl;
}
}
foreach(QString filtername, filtersList) {
QDomDocument doc = createDescriptionFromMlt(repository, "filters", filtername);
if (!doc.isNull())
- videoEffectList->append(doc.documentElement());
+ MainWindow::videoEffects.append(doc.documentElement());
}
return repository;
}
params.setAttribute("type", "constant");
if (QString(paramdesc.get("type")) == "boolean")
params.setAttribute("type", "bool");
- if (!QString(paramdesc.get("format")).isEmpty()) {
+ if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) != "geometry") {
params.setAttribute("type", "complex");
params.setAttribute("format", paramdesc.get("format"));
}
+ if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) == "geometry") {
+ params.setAttribute("type", "geometry");
+ //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"));
Mlt::Properties *metadata = repository->metadata(transition_type, name.toAscii().data());
//kDebug() << filtername;
if (metadata && metadata->is_valid()) {
+ Mlt::Properties param_props((mlt_properties) metadata->get_data("parameters"));
+ for (int j = 0; param_props.is_valid() && j < param_props.count();j++) {
+ 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 (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);
+ }
ret.appendChild(ktrans);
if (metadata->get("title") && metadata->get("identifier")) {
mlt_properties_dir_list(entries.get_properties(), path.toAscii().data(), "*.*", 1);
kDebug() << path << entries.count();
QString imagefiles;
+ QStringList imagelist;
for (int i = 0;i < entries.count();i++) {
//if (!imagefiles.isEmpty()) // add empty entry too
imagefiles.append(",");
imagefiles.append(entries.get(i));
+ imagelist << entries.get(i);
}
paramList.append(quickParameterFill(ret, "Softness", "softness", "double", "0", "0", "100", "", "100"));
paramList.append(quickParameterFill(ret, "Invert", "invert", "bool", "0", "0", "1"));
paramList.append(quickParameterFill(ret, "ImageFile", "resource", "list", "", "", "", imagefiles));
-
+ //thumbnailer.prepareThumbnailsCall(imagelist);
} else if (name == "composite") {
- paramList.append(quickParameterFill(ret, "Geometry", "geometry", "geometry", "0%,0%:100%x100%", "0%,0%:100%x100%", "0%,0%:100%x100%"));
+ paramList.append(quickParameterFill(ret, "Geometry", "geometry", "geometry", "0;0;100;100;100", "0;0;100;100;100", "0;0;100;100;100"));
tname.appendChild(ret.createTextNode("Composite"));
QDomDocument ret1;
paramList.append(quickParameterFill(ret, "Fix Shear Z", "fix_shear_z", "double", "0", "0", "360"));
paramList.append(quickParameterFill(ret, "Mirror", "mirror_off", "bool", "0", "0", "1"));
paramList.append(quickParameterFill(ret, "Repeat", "repeat_off", "bool", "0", "0", "1"));
- paramList.append(quickParameterFill(ret, "Geometry", "geometry", "geometry", "0%,0%:100%x100%", "0,0:100%x100%", "0,0:100%x100%"));
+ paramList.append(quickParameterFill(ret, "Geometry", "geometry", "geometry", "0;0;100;100;100", "0;0;100;100;100", "0;0;100;100;100"));
+ tname.appendChild(ret.createTextNode("Composite"));
} else if (name == "region") {
tname.appendChild(ret.createTextNode("Region"));
}
*/
}
}
-QDomElement initEffects::quickParameterFill(QDomDocument & doc, QString name, QString tag, QString type, QString def, QString min, QString max, QString list, QString factor) {
+QDomElement initEffects::quickParameterFill(QDomDocument & doc, QString name, QString tag, QString type, QString def, QString min, QString max, QString list, QString factor, QString namedesc, QString format) {
QDomElement parameter = doc.createElement("parameter");
parameter.setAttribute("tag", tag);
parameter.setAttribute("default", def);
parameter.setAttribute("paramlist", list);
if (!factor.isEmpty())
parameter.setAttribute("factor", factor);
+ if (!namedesc.isEmpty())
+ parameter.setAttribute("namedesc", namedesc);
+ if (!format.isEmpty())
+ parameter.setAttribute("format", format);
QDomElement pname = doc.createElement("name");
pname.appendChild(doc.createTextNode(name));
parameter.appendChild(pname);