#include "ui_boolval_ui.h"
#include "ui_wipeval_ui.h"
#include "ui_urlval_ui.h"
+#include "ui_keywordval_ui.h"
+#include "ui_fontval_ui.h"
#include "complexparameter.h"
#include "geometryval.h"
#include "positionedit.h"
#include "doubleparameterwidget.h"
#include "cornerswidget.h"
#include "beziercurve/beziersplinewidget.h"
-#ifdef QJSON
+#ifdef USE_QJSON
#include "rotoscoping/rotowidget.h"
#endif
{
};
+class Keywordval: public QWidget, public Ui::Keywordval_UI
+{
+};
+
+class Fontval: public QWidget, public Ui::Fontval_UI
+{
+};
+
QMap<QString, QImage> EffectStackEdit::iconCache;
EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
}
}
-void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool isEffect)
+void EffectStackEdit::transferParamDesc(const QDomElement &d, ItemInfo info, bool isEffect)
{
clearAllItems();
if (m_keyframeEditor) delete m_keyframeEditor;
}
}
#endif
- QDomElement e = m_params.toElement();
- int minFrame = e.attribute("start").toInt();
- int maxFrame = e.attribute("end").toInt();
+ int minFrame = d.attribute("start").toInt();
+ int maxFrame = d.attribute("end").toInt();
// In transitions, maxFrame is in fact one frame after the end of transition
if (maxFrame > 0) maxFrame --;
QString comment;
if (!commentElem.isNull())
comment = i18n(commentElem.text().toUtf8().data());
- QWidget * toFillin = new QWidget(m_baseWidget);
QString value = pa.attribute("value").isNull() ?
pa.attribute("default") : pa.attribute("value");
connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
} else if (type == "list") {
Listval *lsval = new Listval;
+ QWidget * toFillin = new QWidget(m_baseWidget);
lsval->setupUi(toFillin);
+ m_vbox->addWidget(toFillin);
QStringList listitems = pa.attribute("paramlist").split(';');
if (listitems.count() == 1) {
// probably custom effect created before change to ';' as separator
- listitems = pa.attribute("paramlist").split(",");
+ listitems = pa.attribute("paramlist").split(',');
}
QDomElement list = pa.firstChildElement("paramlistdisplay");
QStringList listitemsdisplay;
m_uiItems.append(lsval);
} else if (type == "bool") {
Boolval *bval = new Boolval;
+ QWidget * toFillin = new QWidget(m_baseWidget);
bval->setupUi(toFillin);
+ m_vbox->addWidget(toFillin);
bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
bval->name->setText(paramName);
bval->labelComment->setText(comment);
KeyframeEdit *geo;
if (pa.attribute("widget") == "corners") {
// we want a corners-keyframe-widget
- CornersWidget *corners = new CornersWidget(m_monitor, pa, m_in, m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt(), this);
+ CornersWidget *corners = new CornersWidget(m_monitor, pa, m_in, m_out, m_timecode, d.attribute("active_keyframe", "-1").toInt(), this);
corners->slotShowScene(!disable);
connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int)));
geo = static_cast<KeyframeEdit *>(corners);
} else {
- geo = new KeyframeEdit(pa, m_in, m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt());
+ geo = new KeyframeEdit(pa, m_in, m_out, m_timecode, d.attribute("active_keyframe", "-1").toInt());
}
m_vbox->addWidget(geo);
m_valueItems[paramName+"keyframe"] = geo;
m_keyframeEditor->addParameter(pa);
}
} else if (type == "color") {
- if (value.startsWith('#'))
- value = value.replace('#', "0x");
- bool ok;
- ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
+ ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, this);
+ choosecolor->setAlphaChannelEnabled(pa.attribute("alpha") == "1");
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
KisCurveWidget *curve = new KisCurveWidget(this);
curve->setMaxPoints(pa.attribute("max").toInt());
QList<QPointF> points;
- int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
+ int number;
+ if (d.attribute("version").toDouble() > 0.2) {
+ number = EffectsList::parameter(d, pa.attribute("number")).toDouble() * 10;
+ } else {
+ number = EffectsList::parameter(d, pa.attribute("number")).toInt();
+ }
QString inName = pa.attribute("inpoints");
QString outName = pa.attribute("outpoints");
int start = pa.attribute("min").toInt();
in.replace("%i", QString::number(j));
QString out = outName;
out.replace("%i", QString::number(j));
- points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
+ points << QPointF(EffectsList::parameter(d, in).toDouble(), EffectsList::parameter(d, out).toDouble());
}
if (!points.isEmpty())
curve->setCurve(KisCubicCurve(points));
QString depends = pa.attribute("depends");
if (!depends.isEmpty())
- meetDependency(paramName, type, EffectsList::parameter(e, depends));
+ meetDependency(paramName, type, EffectsList::parameter(d, depends));
} else if (type == "bezier_spline") {
BezierSplineWidget *widget = new BezierSplineWidget(value, this);
stretch = false;
connect(widget, SIGNAL(modified()), this, SLOT(collectAllParameters()));
QString depends = pa.attribute("depends");
if (!depends.isEmpty())
- meetDependency(paramName, type, EffectsList::parameter(e, depends));
-#ifdef QJSON
+ meetDependency(paramName, type, EffectsList::parameter(d, depends));
+#ifdef USE_QJSON
} else if (type == "roto-spline") {
RotoWidget *roto = new RotoWidget(value, m_monitor, info, m_timecode, this);
roto->slotShowScene(!disable);
#endif
} else if (type == "wipe") {
Wipeval *wpval = new Wipeval;
+ QWidget * toFillin = new QWidget(m_baseWidget);
wpval->setupUi(toFillin);
+ m_vbox->addWidget(toFillin);
wipeInfo w = getWipeInfo(value);
switch (w.start) {
case UP:
m_uiItems.append(wpval);
} else if (type == "url") {
Urlval *cval = new Urlval;
+ QWidget * toFillin = new QWidget(m_baseWidget);
cval->setupUi(toFillin);
+ m_vbox->addWidget(toFillin);
cval->label->setText(paramName);
cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
m_valueItems[paramName] = cval;
connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(collectAllParameters()));
connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(collectAllParameters()));
m_uiItems.append(cval);
- } else {
- delete toFillin;
- toFillin = NULL;
- }
-
- if (toFillin)
+ } else if (type == "keywords") {
+ Keywordval* kval = new Keywordval;
+ QWidget * toFillin = new QWidget(m_baseWidget);
+ kval->setupUi(toFillin);
+ m_vbox->addWidget(toFillin);
+ kval->label->setText(paramName);
+ kval->lineeditwidget->setText(value);
+ QDomElement klistelem = pa.firstChildElement("keywords");
+ QDomElement kdisplaylistelem = pa.firstChildElement("keywordsdisplay");
+ QStringList keywordlist;
+ QStringList keyworddisplaylist;
+ if (!klistelem.isNull()) {
+ keywordlist = klistelem.text().split(';');
+ keyworddisplaylist = i18n(kdisplaylistelem.text().toUtf8().data()).split(';');
+ }
+ if (keyworddisplaylist.count() != keywordlist.count()) {
+ keyworddisplaylist = keywordlist;
+ }
+ for (int i = 0; i < keywordlist.count(); i++) {
+ kval->comboboxwidget->addItem(keyworddisplaylist.at(i), keywordlist.at(i));
+ }
+ // Add disabled user prompt at index 0
+ kval->comboboxwidget->insertItem(0, i18n("<select a keyword>"), "");
+ kval->comboboxwidget->model()->setData( kval->comboboxwidget->model()->index(0,0), QVariant(Qt::NoItemFlags), Qt::UserRole -1);
+ kval->comboboxwidget->setCurrentIndex(0);
+ m_valueItems[paramName] = kval;
+ connect(kval->lineeditwidget, SIGNAL(editingFinished()) , this, SLOT(collectAllParameters()));
+ connect(kval->comboboxwidget, SIGNAL(activated (const QString&)), this, SLOT(collectAllParameters()));
+ m_uiItems.append(kval);
+ } else if (type == "fontfamily") {
+ Fontval* fval = new Fontval;
+ QWidget * toFillin = new QWidget(m_baseWidget);
+ fval->setupUi(toFillin);
m_vbox->addWidget(toFillin);
+ fval->name->setText(paramName);
+ fval->fontfamilywidget->setCurrentFont(QFont(value));
+ m_valueItems[paramName] = fval;
+ connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
+ m_uiItems.append(fval);
+ } else if (type == "filterjob") {
+ QPushButton *button = new QPushButton(paramName, m_baseWidget);
+ m_vbox->addWidget(button);
+ m_valueItems[paramName] = button;
+ connect(button, SIGNAL(pressed()), this, SLOT(slotStartFilterJobAction()));
+ }
}
if (stretch)
void EffectStackEdit::collectAllParameters()
{
if (m_valueItems.isEmpty() || m_params.isNull()) return;
- QLocale locale;
const QDomElement oldparam = m_params.cloneNode().toElement();
QDomElement newparam = oldparam.cloneNode().toElement();
QDomNodeList namenode = newparam.elementsByTagName("parameter");
+ QLocale locale;
for (int i = 0; i < namenode.count() ; i++) {
QDomNode pa = namenode.item(i);
setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
- setValue = choosecolor->getColor().name();
+ setValue = choosecolor->getColor();
} else if (type == "complex") {
ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
namenode.item(i) = complex->getParamDesc();
QString outName = pa.attributes().namedItem("outpoints").nodeValue();
int off = pa.attributes().namedItem("min").nodeValue().toInt();
int end = pa.attributes().namedItem("max").nodeValue().toInt();
- EffectsList::setParameter(newparam, number, QString::number(points.count()));
+ if (oldparam.attribute("version").toDouble() > 0.2) {
+ EffectsList::setParameter(newparam, number, locale.toString(points.count() / 10.));
+ } else {
+ EffectsList::setParameter(newparam, number, QString::number(points.count()));
+ }
for (int j = 0; (j < points.count() && j + off <= end); j++) {
QString in = inName;
in.replace("%i", QString::number(j + off));
QString depends = pa.attributes().namedItem("depends").nodeValue();
if (!depends.isEmpty())
meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
-#ifdef QJSON
+#ifdef USE_QJSON
} else if (type == "roto-spline") {
RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems.value(paramName));
setValue = widget->getSpline();
} else if (type == "url") {
KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
setValue = req->url().path();
+ } else if (type == "keywords"){
+ QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
+ QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
+ if(combo->currentIndex())
+ {
+ QString comboval = combo->itemData(combo->currentIndex()).toString();
+ line->insert(comboval);
+ combo->setCurrentIndex(0);
+ }
+ setValue = line->text();
+ } else if (type == "fontfamily") {
+ QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
+ setValue = fontfamily->currentFont().family();
}
if (!setValue.isNull())
{
emit syncEffectsPos(pos);
}
+
+void EffectStackEdit::slotStartFilterJobAction()
+{
+ QDomNodeList namenode = m_params.elementsByTagName("parameter");
+ for (int i = 0; i < namenode.count() ; i++) {
+ QDomElement pa = namenode.item(i).toElement();
+ QString type = pa.attribute("type");
+ if (type == "filterjob") {
+ emit startFilterJob(pa.attribute("filtertag"), pa.attribute("filterparams"), pa.attribute("finalfilter"), pa.attribute("consumer"), pa.attribute("consumerparams"), pa.attribute("wantedproperties"));
+ kDebug()<<" - - -PROPS:\n"<<pa.attribute("filtertag")<<"-"<< pa.attribute("filterparams")<<"-"<< pa.attribute("consumer")<<"-"<< pa.attribute("consumerparams")<<"-"<< pa.attribute("wantedproperties");
+ break;
+ }
+ }
+}
+