]> git.sesse.net Git - kdenlive/blob - src/effectstack/collapsibleeffect.cpp
Implement reset effect in new effect stack
[kdenlive] / src / effectstack / collapsibleeffect.cpp
1 /***************************************************************************
2  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #include "collapsibleeffect.h"
22
23 #include "ui_listval_ui.h"
24 #include "ui_boolval_ui.h"
25 #include "ui_wipeval_ui.h"
26 #include "ui_urlval_ui.h"
27 #include "ui_keywordval_ui.h"
28 #include "ui_fontval_ui.h"
29 #include "complexparameter.h"
30 #include "geometryval.h"
31 #include "positionedit.h"
32 #include "projectlist.h"
33 #include "effectslist.h"
34 #include "kdenlivesettings.h"
35 #include "profilesdialog.h"
36 #include "kis_curve_widget.h"
37 #include "kis_cubic_curve.h"
38 #include "choosecolorwidget.h"
39 #include "geometrywidget.h"
40 #include "colortools.h"
41 #include "doubleparameterwidget.h"
42 #include "cornerswidget.h"
43 #include "dragvalue.h"
44 #include "beziercurve/beziersplinewidget.h"
45 #ifdef USE_QJSON
46 #include "rotoscoping/rotowidget.h"
47 #endif
48
49 #include <QInputDialog>
50 #include <QDialog>
51 #include <QMenu>
52 #include <QVBoxLayout>
53 #include <KDebug>
54 #include <KGlobalSettings>
55 #include <KLocale>
56 #include <KMessageBox>
57 #include <KStandardDirs>
58 #include <KFileDialog>
59 #include <KUrlRequester>
60
61 class Boolval: public QWidget, public Ui::Boolval_UI
62 {
63 };
64
65 class Listval: public QWidget, public Ui::Listval_UI
66 {
67 };
68
69 class Wipeval: public QWidget, public Ui::Wipeval_UI
70 {
71 };
72
73 class Urlval: public QWidget, public Ui::Urlval_UI
74 {
75 };
76
77 class Keywordval: public QWidget, public Ui::Keywordval_UI
78 {
79 };
80
81 class Fontval: public QWidget, public Ui::Fontval_UI
82 {
83 };
84
85 QMap<QString, QImage> CollapsibleEffect::iconCache;
86
87 void clearLayout(QLayout *layout)
88 {
89     QLayoutItem *item;
90     while((item = layout->takeAt(0))) {
91         if (item->layout()) {
92             clearLayout(item->layout());
93             delete item->layout();
94         }
95         if (item->widget()) {
96             delete item->widget();
97         }
98         delete item;
99     }
100 }
101
102 MySpinBox::MySpinBox(QWidget * parent):
103     QSpinBox(parent)
104 {
105     setFocusPolicy(Qt::StrongFocus);
106 }
107
108 void MySpinBox::focusInEvent(QFocusEvent*)
109 {
110      setFocusPolicy(Qt::WheelFocus);
111 }
112
113 void MySpinBox::focusOutEvent(QFocusEvent*)
114 {
115      setFocusPolicy(Qt::StrongFocus);
116 }
117
118 CollapsibleEffect::CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, int ix, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent) :
119         QWidget(parent),
120         m_paramWidget(NULL),
121         m_effect(effect),
122         m_original_effect(original_effect),
123         m_lastEffect(lastEffect),
124         m_active(false)
125 {
126     //setMouseTracking(true);
127     setupUi(this);
128     frame->setBackgroundRole(QPalette::Midlight);
129     frame->setAutoFillBackground(true);
130     setFont(KGlobalSettings::smallestReadableFont());
131     QDomElement namenode = m_effect.firstChildElement("name");
132     if (namenode.isNull()) return;
133     QString type = m_effect.attribute("type", QString());
134     KIcon icon;
135     if (type == "audio") icon = KIcon("kdenlive-show-audio");
136     else if (m_effect.attribute("tag") == "region") icon = KIcon("kdenlive-mask-effect");
137     else if (type == "custom") icon = KIcon("kdenlive-custom-effect");
138     else icon = KIcon("kdenlive-show-video");
139    
140     buttonUp->setIcon(KIcon("go-up"));
141     buttonUp->setToolTip(i18n("Move effect up"));
142     if (!lastEffect) {
143         buttonDown->setIcon(KIcon("go-down"));
144         buttonDown->setToolTip(i18n("Move effect down"));
145     }
146     buttonDel->setIcon(KIcon("edit-delete"));
147     buttonDel->setToolTip(i18n("Delete effect"));
148
149     buttonUp->setVisible(false);
150     buttonDown->setVisible(false);
151     buttonDel->setVisible(false);
152     
153     /*buttonReset->setIcon(KIcon("view-refresh"));
154     buttonReset->setToolTip(i18n("Reset effect"));*/
155     //checkAll->setToolTip(i18n("Enable/Disable all effects"));
156     //buttonShowComments->setIcon(KIcon("help-about"));
157     //buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
158             
159     title->setText(i18n(namenode.text().toUtf8().data()));
160     title->setIcon(icon);
161     QMenu *menu = new QMenu;
162     menu->addAction(KIcon("view-refresh"), i18n("Reset effect"), this, SLOT(slotResetEffect()));
163     menu->addAction(KIcon("document-save"), i18n("Save effect"), this, SLOT(slotSaveEffect()));
164     title->setMenu(menu);
165     
166     if (m_effect.attribute("disable") == "1") {
167         enabledBox->setCheckState(Qt::Unchecked);
168         title->setEnabled(false);
169     }
170     else {
171         enabledBox->setCheckState(Qt::Checked);
172     }
173
174     connect(collapseButton, SIGNAL(clicked()), this, SLOT(slotSwitch()));
175     connect(enabledBox, SIGNAL(toggled(bool)), this, SLOT(slotEnable(bool)));
176     connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotEffectUp()));
177     connect(buttonDown, SIGNAL(clicked()), this, SLOT(slotEffectDown()));
178     connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteEffect()));
179
180     setupWidget(info, ix, metaInfo);
181     Q_FOREACH( QSpinBox * sp, findChildren<QSpinBox*>() ) {
182         sp->installEventFilter( this );
183         sp->setFocusPolicy( Qt::StrongFocus );
184     }
185     Q_FOREACH( KComboBox * cb, findChildren<KComboBox*>() ) {
186         cb->installEventFilter( this );
187         cb->setFocusPolicy( Qt::StrongFocus );
188     }
189     Q_FOREACH( QProgressBar * cb, findChildren<QProgressBar*>() ) {
190         cb->installEventFilter( this );
191         cb->setFocusPolicy( Qt::StrongFocus );
192     }
193     
194 }
195
196 CollapsibleEffect::~CollapsibleEffect()
197 {
198     if (m_paramWidget) delete m_paramWidget;
199 }
200
201 bool CollapsibleEffect::eventFilter( QObject * o, QEvent * e ) 
202 {
203     if(e->type() == QEvent::Wheel) {
204         if (qobject_cast<QAbstractSpinBox*>(o)) {
205             if(qobject_cast<QAbstractSpinBox*>(o)->focusPolicy() == Qt::WheelFocus)
206             {
207                 e->accept();
208                 return false;
209             }
210             else
211             {
212                 e->ignore();
213                 return true;
214             }
215         }
216         if (qobject_cast<KComboBox*>(o)) {
217             if(qobject_cast<KComboBox*>(o)->focusPolicy() == Qt::WheelFocus)
218             {
219                 e->accept();
220                 return false;
221             }
222             else
223             {
224                 e->ignore();
225                 return true;
226             }
227         }
228         if (qobject_cast<QProgressBar*>(o)) {
229             if(qobject_cast<QProgressBar*>(o)->focusPolicy() == Qt::WheelFocus)
230             {
231                 e->accept();
232                 return false;
233             }
234             else
235             {
236                 e->ignore();
237                 return true;
238             }
239         }
240     }
241     return QWidget::eventFilter(o, e);
242 }
243
244
245 void CollapsibleEffect::setActive(bool activate)
246 {
247     m_active = activate;
248     frame->setBackgroundRole(m_active ? QPalette::Mid : QPalette::Midlight);
249     frame->setAutoFillBackground(activate);
250 }
251
252 void CollapsibleEffect::mouseDoubleClickEvent ( QMouseEvent * event )
253 {
254     if (frame->underMouse() && collapseButton->isEnabled()) slotSwitch();
255     QWidget::mouseDoubleClickEvent(event);
256 }
257
258 void CollapsibleEffect::mousePressEvent ( QMouseEvent *event )
259 {
260     if (!m_active) emit activateEffect(m_paramWidget->index());
261     QWidget::mousePressEvent(event);
262 }
263
264 void CollapsibleEffect::enterEvent ( QEvent * event )
265 {
266     if (m_paramWidget->index() > 0) buttonUp->setVisible(true);
267     if (!m_lastEffect) buttonDown->setVisible(true);
268     buttonDel->setVisible(true);
269     if (!m_active) frame->setBackgroundRole(QPalette::Midlight);
270     frame->setAutoFillBackground(true);
271     QWidget::enterEvent(event);
272 }
273
274 void CollapsibleEffect::leaveEvent ( QEvent * event )
275 {
276     buttonUp->setVisible(false);
277     buttonDown->setVisible(false);
278     buttonDel->setVisible(false);
279     if (!m_active) frame->setAutoFillBackground(false);
280     QWidget::leaveEvent(event);
281 }
282
283 void CollapsibleEffect::slotEnable(bool enable)
284 {
285     title->setEnabled(enable);
286     m_effect.setAttribute("disable", enable ? 0 : 1);
287     if (enable || KdenliveSettings::disable_effect_parameters()) {
288         widgetFrame->setEnabled(enable);
289     }
290     emit effectStateChanged(!enable, m_paramWidget->index());
291 }
292
293 void CollapsibleEffect::slotDeleteEffect()
294 {
295     emit deleteEffect(m_effect, m_paramWidget->index());
296 }
297
298 void CollapsibleEffect::slotEffectUp()
299 {
300     emit changeEffectPosition(m_paramWidget->index(), true);
301 }
302
303 void CollapsibleEffect::slotEffectDown()
304 {
305     emit changeEffectPosition(m_paramWidget->index(), false);
306 }
307
308 void CollapsibleEffect::slotSaveEffect()
309 {
310     QString name = QInputDialog::getText(this, i18n("Save Effect"), i18n("Name for saved effect: "));
311     if (name.isEmpty()) return;
312     QString path = KStandardDirs::locateLocal("appdata", "effects/", true);
313     path = path + name + ".xml";
314     if (QFile::exists(path)) if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", path)) == KMessageBox::No) return;
315
316     QDomDocument doc;
317     QDomElement effect = m_effect.cloneNode().toElement();
318     doc.appendChild(doc.importNode(effect, true));
319     effect = doc.firstChild().toElement();
320     effect.removeAttribute("kdenlive_ix");
321     effect.setAttribute("id", name);
322     effect.setAttribute("type", "custom");
323     QDomElement effectname = effect.firstChildElement("name");
324     effect.removeChild(effectname);
325     effectname = doc.createElement("name");
326     QDomText nametext = doc.createTextNode(name);
327     effectname.appendChild(nametext);
328     effect.insertBefore(effectname, QDomNode());
329     QDomElement effectprops = effect.firstChildElement("properties");
330     effectprops.setAttribute("id", name);
331     effectprops.setAttribute("type", "custom");
332
333     QFile file(path);
334     if (file.open(QFile::WriteOnly | QFile::Truncate)) {
335         QTextStream out(&file);
336         out << doc.toString();
337     }
338     file.close();
339     emit reloadEffects();
340 }
341
342 void CollapsibleEffect::slotResetEffect()
343 {
344     emit resetEffect(m_paramWidget->index());
345 }
346
347 void CollapsibleEffect::slotSwitch()
348 {
349     bool enable = !widgetFrame->isVisible();
350     slotShow(enable);
351 }
352
353 void CollapsibleEffect::slotShow(bool show)
354 {
355     widgetFrame->setVisible(show);
356     if (show) {
357         collapseButton->setArrowType(Qt::DownArrow);
358         m_original_effect.removeAttribute("k_collapsed");
359     }
360     else {
361         collapseButton->setArrowType(Qt::RightArrow);
362         m_original_effect.setAttribute("k_collapsed", 1);
363     }
364 }
365
366 void CollapsibleEffect::updateWidget(ItemInfo info, int index, QDomElement effect, EffectMetaInfo *metaInfo)
367 {
368     if (m_paramWidget) {
369         // cleanup
370         delete m_paramWidget;
371         m_paramWidget = NULL;
372     }
373     m_effect = effect;
374     setupWidget(info, index, metaInfo);
375 }
376
377 void CollapsibleEffect::setupWidget(ItemInfo info, int index, EffectMetaInfo *metaInfo)
378 {
379     if (m_effect.isNull()) {
380 //         kDebug() << "// EMPTY EFFECT STACK";
381         return;
382     }
383
384     if (m_effect.attribute("tag") == "region") {
385         QVBoxLayout *vbox = new QVBoxLayout(widgetFrame);
386         vbox->setContentsMargins(0, 0, 0, 0);
387         vbox->setSpacing(2);
388         QDomNodeList effects =  m_effect.elementsByTagName("effect");
389         QDomNodeList origin_effects =  m_original_effect.elementsByTagName("effect");
390         QWidget *container = new QWidget(widgetFrame);
391         vbox->addWidget(container);
392         m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, index, container);
393         for (int i = 0; i < effects.count(); i++) {
394             CollapsibleEffect *coll = new CollapsibleEffect(effects.at(i).toElement(), origin_effects.at(i).toElement(), info, i, metaInfo, container);
395             m_subParamWidgets.append(coll);
396             //container = new QWidget(widgetFrame);
397             vbox->addWidget(coll);
398             //p = new ParameterContainer(effects.at(i).toElement(), info, isEffect, container);
399         }
400         
401     }
402     else {
403         m_paramWidget = new ParameterContainer(m_effect, info, metaInfo, index, widgetFrame);
404         if (m_effect.firstChildElement("parameter").isNull()) {
405             // Effect has no parameter, don't allow expand
406             collapseButton->setEnabled(false);
407             widgetFrame->setVisible(false);            
408         }
409     }
410     if (collapseButton->isEnabled()) slotShow(!m_effect.hasAttribute("k_collapsed"));
411     connect (m_paramWidget, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)));
412     
413     connect(m_paramWidget, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)), this, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)));
414     
415     connect (this, SIGNAL(syncEffectsPos(int)), m_paramWidget, SIGNAL(syncEffectsPos(int)));
416     connect (this, SIGNAL(effectStateChanged(bool)), m_paramWidget, SIGNAL(effectStateChanged(bool)));
417     connect (m_paramWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
418     connect (m_paramWidget, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int)));
419     
420     
421 }
422
423 void CollapsibleEffect::updateTimecodeFormat()
424 {
425     m_paramWidget->updateTimecodeFormat();
426     if (!m_subParamWidgets.isEmpty()) {
427         // we have a group
428         for (int i = 0; i < m_subParamWidgets.count(); i++)
429             m_subParamWidgets.at(i)->updateTimecodeFormat();
430     }
431 }
432
433 void CollapsibleEffect::slotSyncEffectsPos(int pos)
434 {
435     emit syncEffectsPos(pos);
436 }
437
438
439
440 ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, int index, QWidget * parent) :
441         m_index(index),
442         m_keyframeEditor(NULL),
443         m_geometryWidget(NULL),
444         m_metaInfo(metaInfo),
445         m_effect(effect)
446 {
447     m_in = info.cropStart.frames(KdenliveSettings::project_fps());
448     m_out = (info.cropStart + info.cropDuration).frames(KdenliveSettings::project_fps()) - 1;
449
450     QDomNodeList namenode = effect.childNodes(); //elementsByTagName("parameter");
451     
452     QDomElement e = effect.toElement();
453     int minFrame = e.attribute("start").toInt();
454     int maxFrame = e.attribute("end").toInt();
455     // In transitions, maxFrame is in fact one frame after the end of transition
456     if (maxFrame > 0) maxFrame --;
457
458     bool disable = effect.attribute("disable") == "1" && KdenliveSettings::disable_effect_parameters();
459     parent->setEnabled(!disable);
460
461     bool stretch = true;
462     m_vbox = new QVBoxLayout(parent);
463     m_vbox->setContentsMargins(0, 0, 0, 0);
464     m_vbox->setSpacing(2);
465
466     for (int i = 0; i < namenode.count() ; i++) {
467         QDomElement pa = namenode.item(i).toElement();
468         if (pa.tagName() != "parameter") continue;
469         QDomElement na = pa.firstChildElement("name");
470         QDomElement commentElem = pa.firstChildElement("comment");
471         QString type = pa.attribute("type");
472         QString paramName = na.isNull() ? pa.attribute("name") : i18n(na.text().toUtf8().data());
473         QString comment;
474         if (!commentElem.isNull())
475             comment = i18n(commentElem.text().toUtf8().data());
476         QWidget * toFillin = new QWidget(parent);
477         QString value = pa.attribute("value").isNull() ?
478                         pa.attribute("default") : pa.attribute("value");
479
480
481         /** See effects/README for info on the different types */
482
483         if (type == "double" || type == "constant") {
484             double min;
485             double max;
486             if (pa.attribute("min").contains('%'))
487                 min = ProfilesDialog::getStringEval(m_metaInfo->profile, pa.attribute("min"), m_metaInfo->frameSize);
488             else
489                 min = pa.attribute("min").toDouble();
490             if (pa.attribute("max").contains('%'))
491                 max = ProfilesDialog::getStringEval(m_metaInfo->profile, pa.attribute("max"), m_metaInfo->frameSize);
492             else
493                 max = pa.attribute("max").toDouble();
494
495             DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, value.toDouble(), min, max,
496                     pa.attribute("default").toDouble(), comment, -1, pa.attribute("suffix"), pa.attribute("decimals").toInt(), parent);
497             doubleparam->setFocusPolicy(Qt::StrongFocus);
498             m_vbox->addWidget(doubleparam);
499             m_valueItems[paramName] = doubleparam;
500             connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotCollectAllParameters()));
501             connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
502         } else if (type == "list") {
503             Listval *lsval = new Listval;
504             lsval->setupUi(toFillin);
505             lsval->list->setFocusPolicy(Qt::StrongFocus);
506             QStringList listitems = pa.attribute("paramlist").split(';');
507             if (listitems.count() == 1) {
508                 // probably custom effect created before change to ';' as separator
509                 listitems = pa.attribute("paramlist").split(",");
510             }
511             QDomElement list = pa.firstChildElement("paramlistdisplay");
512             QStringList listitemsdisplay;
513             if (!list.isNull()) {
514                 listitemsdisplay = i18n(list.text().toUtf8().data()).split(',');
515             } else {
516                 listitemsdisplay = i18n(pa.attribute("paramlistdisplay").toUtf8().data()).split(',');
517             }
518             if (listitemsdisplay.count() != listitems.count())
519                 listitemsdisplay = listitems;
520             lsval->list->setIconSize(QSize(30, 30));
521             for (int i = 0; i < listitems.count(); i++) {
522                 lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
523                 QString entry = listitems.at(i);
524                 if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
525                     if (!CollapsibleEffect::iconCache.contains(entry)) {
526                         QImage pix(entry);
527                         CollapsibleEffect::iconCache[entry] = pix.scaled(30, 30);
528                     }
529                     lsval->list->setItemIcon(i, QPixmap::fromImage(CollapsibleEffect::iconCache[entry]));
530                 }
531             }
532             if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
533             lsval->name->setText(paramName);
534             lsval->labelComment->setText(comment);
535             lsval->widgetComment->setHidden(true);
536             m_valueItems[paramName] = lsval;
537             connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(slotCollectAllParameters()));
538             if (!comment.isEmpty())
539                 connect(this, SIGNAL(showComments(bool)), lsval->widgetComment, SLOT(setVisible(bool)));
540             m_uiItems.append(lsval);
541         } else if (type == "bool") {
542             Boolval *bval = new Boolval;
543             bval->setupUi(toFillin);
544             bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
545             bval->name->setText(paramName);
546             bval->labelComment->setText(comment);
547             bval->widgetComment->setHidden(true);
548             m_valueItems[paramName] = bval;
549             connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(slotCollectAllParameters()));
550             if (!comment.isEmpty())
551                 connect(this, SIGNAL(showComments(bool)), bval->widgetComment, SLOT(setVisible(bool)));
552             m_uiItems.append(bval);
553         } else if (type == "complex") {
554             ComplexParameter *pl = new ComplexParameter;
555             pl->setupParam(effect, pa.attribute("name"), 0, 100);
556             m_vbox->addWidget(pl);
557             m_valueItems[paramName+"complex"] = pl;
558             connect(pl, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
559         } else if (type == "geometry") {
560             if (KdenliveSettings::on_monitor_effects()) {
561                 m_geometryWidget = new GeometryWidget(m_metaInfo->monitor, m_metaInfo->timecode, 0, true, effect.hasAttribute("showrotation"), parent);
562                 m_geometryWidget->setFrameSize(m_metaInfo->frameSize);
563                 m_geometryWidget->slotShowScene(!disable);
564                 // connect this before setupParam to make sure the monitor scene shows up at startup
565                 connect(m_geometryWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
566                 connect(m_geometryWidget, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
567                 if (minFrame == maxFrame)
568                     m_geometryWidget->setupParam(pa, m_in, m_out);
569                 else
570                     m_geometryWidget->setupParam(pa, minFrame, maxFrame);
571                 m_vbox->addWidget(m_geometryWidget);
572                 m_valueItems[paramName+"geometry"] = m_geometryWidget;
573                 connect(m_geometryWidget, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
574                 connect(this, SIGNAL(syncEffectsPos(int)), m_geometryWidget, SLOT(slotSyncPosition(int)));
575                 connect(this, SIGNAL(effectStateChanged(bool)), m_geometryWidget, SLOT(slotShowScene(bool)));
576             } else {
577                 Geometryval *geo = new Geometryval(m_metaInfo->profile, m_metaInfo->timecode, m_metaInfo->frameSize, 0);
578                 if (minFrame == maxFrame)
579                     geo->setupParam(pa, m_in, m_out);
580                 else
581                     geo->setupParam(pa, minFrame, maxFrame);
582                 m_vbox->addWidget(geo);
583                 m_valueItems[paramName+"geometry"] = geo;
584                 connect(geo, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
585                 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
586                 connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
587             }
588         } else if (type == "addedgeometry") {
589             // this is a parameter that should be linked to the geometry widget, for example rotation, shear, ...
590             if (m_geometryWidget) m_geometryWidget->addParameter(pa);
591         } else if (type == "keyframe" || type == "simplekeyframe") {
592             // keyframe editor widget
593             if (m_keyframeEditor == NULL) {
594                 KeyframeEdit *geo;
595                 if (pa.attribute("widget") == "corners") {
596                     // we want a corners-keyframe-widget
597                     CornersWidget *corners = new CornersWidget(m_metaInfo->monitor, pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt(), parent);
598                     corners->slotShowScene(!disable);
599                     connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
600                     connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
601                     connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int)));
602                     geo = static_cast<KeyframeEdit *>(corners);
603                 } else {
604                     geo = new KeyframeEdit(pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt());
605                 }
606                 m_vbox->addWidget(geo);
607                 m_valueItems[paramName+"keyframe"] = geo;
608                 m_keyframeEditor = geo;
609                 connect(geo, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
610                 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
611                 connect(this, SIGNAL(showComments(bool)), geo, SIGNAL(showComments(bool)));
612             } else {
613                 // we already have a keyframe editor, so just add another column for the new param
614                 m_keyframeEditor->addParameter(pa);
615             }
616         } else if (type == "color") {
617             if (value.startsWith('#'))
618                 value = value.replace('#', "0x");
619             ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, parent);
620             m_vbox->addWidget(choosecolor);
621             m_valueItems[paramName] = choosecolor;
622             connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
623             connect(choosecolor, SIGNAL(modified()) , this, SLOT(slotCollectAllParameters()));
624         } else if (type == "position") {
625             int pos = value.toInt();
626             if (effect.attribute("id") == "fadein" || effect.attribute("id") == "fade_from_black") {
627                 pos = pos - m_in;
628             } else if (effect.attribute("id") == "fadeout" || effect.attribute("id") == "fade_to_black") {
629                 // fadeout position starts from clip end
630                 pos = m_out - pos;
631             }
632             PositionEdit *posedit = new PositionEdit(paramName, pos, 0, m_out - m_in, m_metaInfo->timecode);
633             m_vbox->addWidget(posedit);
634             m_valueItems[paramName+"position"] = posedit;
635             connect(posedit, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
636         } else if (type == "curve") {
637             KisCurveWidget *curve = new KisCurveWidget(parent);
638             curve->setMaxPoints(pa.attribute("max").toInt());
639             QList<QPointF> points;
640             int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
641             QString inName = pa.attribute("inpoints");
642             QString outName = pa.attribute("outpoints");
643             int start = pa.attribute("min").toInt();
644             for (int j = start; j <= number; j++) {
645                 QString in = inName;
646                 in.replace("%i", QString::number(j));
647                 QString out = outName;
648                 out.replace("%i", QString::number(j));
649                 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
650             }
651             if (!points.isEmpty())
652                 curve->setCurve(KisCubicCurve(points));
653             MySpinBox *spinin = new MySpinBox();
654             spinin->setRange(0, 1000);
655             MySpinBox *spinout = new MySpinBox();
656             spinout->setRange(0, 1000);
657             curve->setupInOutControls(spinin, spinout, 0, 1000);
658             m_vbox->addWidget(curve);
659             m_vbox->addWidget(spinin);
660             m_vbox->addWidget(spinout);
661
662             connect(curve, SIGNAL(modified()), this, SLOT(slotCollectAllParameters()));
663             m_valueItems[paramName] = curve;
664
665             QString depends = pa.attribute("depends");
666             if (!depends.isEmpty())
667                 meetDependency(paramName, type, EffectsList::parameter(e, depends));
668         } else if (type == "bezier_spline") {
669             BezierSplineWidget *widget = new BezierSplineWidget(value, parent);
670             stretch = false;
671             m_vbox->addWidget(widget);
672             m_valueItems[paramName] = widget;
673             connect(widget, SIGNAL(modified()), this, SLOT(slotCollectAllParameters()));
674             QString depends = pa.attribute("depends");
675             if (!depends.isEmpty())
676                 meetDependency(paramName, type, EffectsList::parameter(e, depends));
677 #ifdef USE_QJSON
678         } else if (type == "roto-spline") {
679             RotoWidget *roto = new RotoWidget(value, m_metaInfo->monitor, info, m_metaInfo->timecode, parent);
680             roto->slotShowScene(!disable);
681             connect(roto, SIGNAL(valueChanged()), this, SLOT(slotCollectAllParameters()));
682             connect(roto, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
683             connect(roto, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
684             connect(this, SIGNAL(syncEffectsPos(int)), roto, SLOT(slotSyncPosition(int)));
685             connect(this, SIGNAL(effectStateChanged(bool)), roto, SLOT(slotShowScene(bool)));
686             m_vbox->addWidget(roto);
687             m_valueItems[paramName] = roto;
688 #endif
689         } else if (type == "wipe") {
690             Wipeval *wpval = new Wipeval;
691             wpval->setupUi(toFillin);
692             wipeInfo w = getWipeInfo(value);
693             switch (w.start) {
694             case UP:
695                 wpval->start_up->setChecked(true);
696                 break;
697             case DOWN:
698                 wpval->start_down->setChecked(true);
699                 break;
700             case RIGHT:
701                 wpval->start_right->setChecked(true);
702                 break;
703             case LEFT:
704                 wpval->start_left->setChecked(true);
705                 break;
706             default:
707                 wpval->start_center->setChecked(true);
708                 break;
709             }
710             switch (w.end) {
711             case UP:
712                 wpval->end_up->setChecked(true);
713                 break;
714             case DOWN:
715                 wpval->end_down->setChecked(true);
716                 break;
717             case RIGHT:
718                 wpval->end_right->setChecked(true);
719                 break;
720             case LEFT:
721                 wpval->end_left->setChecked(true);
722                 break;
723             default:
724                 wpval->end_center->setChecked(true);
725                 break;
726             }
727             wpval->start_transp->setValue(w.startTransparency);
728             wpval->end_transp->setValue(w.endTransparency);
729             m_valueItems[paramName] = wpval;
730             connect(wpval->end_up, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
731             connect(wpval->end_down, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
732             connect(wpval->end_left, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
733             connect(wpval->end_right, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
734             connect(wpval->end_center, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
735             connect(wpval->start_up, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
736             connect(wpval->start_down, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
737             connect(wpval->start_left, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
738             connect(wpval->start_right, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
739             connect(wpval->start_center, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
740             connect(wpval->start_transp, SIGNAL(valueChanged(int)), this, SLOT(slotCollectAllParameters()));
741             connect(wpval->end_transp, SIGNAL(valueChanged(int)), this, SLOT(slotCollectAllParameters()));
742             //wpval->title->setTitle(na.toElement().text());
743             m_uiItems.append(wpval);
744         } else if (type == "url") {
745             Urlval *cval = new Urlval;
746             cval->setupUi(toFillin);
747             cval->label->setText(paramName);
748             cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
749             m_valueItems[paramName] = cval;
750             cval->urlwidget->setUrl(KUrl(value));
751             connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(slotCollectAllParameters()));
752             connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(slotCollectAllParameters()));
753             m_uiItems.append(cval);
754         } else if (type == "keywords") {
755             Keywordval* kval = new Keywordval;
756             kval->setupUi(toFillin);
757             kval->label->setText(paramName);
758             kval->lineeditwidget->setText(value);
759             QDomElement klistelem = pa.firstChildElement("keywords");
760             QDomElement kdisplaylistelem = pa.firstChildElement("keywordsdisplay");
761             QStringList keywordlist;
762             QStringList keyworddisplaylist;
763             if (!klistelem.isNull()) {
764                 keywordlist = klistelem.text().split(';');
765                 keyworddisplaylist = i18n(kdisplaylistelem.text().toUtf8().data()).split(';');
766             }
767             if (keyworddisplaylist.count() != keywordlist.count()) {
768                 keyworddisplaylist = keywordlist;
769             }
770             for (int i = 0; i < keywordlist.count(); i++) {
771                 kval->comboboxwidget->addItem(keyworddisplaylist.at(i), keywordlist.at(i));
772             }
773             // Add disabled user prompt at index 0
774             kval->comboboxwidget->insertItem(0, i18n("<select a keyword>"), "");
775             kval->comboboxwidget->model()->setData( kval->comboboxwidget->model()->index(0,0), QVariant(Qt::NoItemFlags), Qt::UserRole -1);
776             kval->comboboxwidget->setCurrentIndex(0);
777             m_valueItems[paramName] = kval;
778             connect(kval->lineeditwidget, SIGNAL(editingFinished()) , this, SLOT(collectAllParameters()));
779             connect(kval->comboboxwidget, SIGNAL(activated (const QString&)), this, SLOT(collectAllParameters()));
780             m_uiItems.append(kval);
781         } else if (type == "fontfamily") {
782             Fontval* fval = new Fontval;
783             fval->setupUi(toFillin);
784             fval->name->setText(paramName);
785             fval->fontfamilywidget->setCurrentFont(QFont(value));
786             m_valueItems[paramName] = fval;
787             connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
788             m_uiItems.append(fval);
789         } else if (type == "filterjob") {
790             QVBoxLayout *l= new QVBoxLayout(toFillin);
791             QPushButton *button = new QPushButton(paramName, toFillin);
792             l->addWidget(button);
793             m_valueItems[paramName] = button;
794             connect(button, SIGNAL(pressed()), this, SLOT(slotStartFilterJobAction()));   
795         } else {
796             delete toFillin;
797             toFillin = NULL;
798         }
799
800         if (toFillin)
801             m_vbox->addWidget(toFillin);
802     }
803
804     if (stretch)
805         m_vbox->addStretch();
806
807     if (m_keyframeEditor)
808         m_keyframeEditor->checkVisibleParam();
809
810     // Make sure all doubleparam spinboxes have the same width, looks much better
811     QList<DoubleParameterWidget *> allWidgets = findChildren<DoubleParameterWidget *>();
812     int minSize = 0;
813     for (int i = 0; i < allWidgets.count(); i++) {
814         if (minSize < allWidgets.at(i)->spinSize()) minSize = allWidgets.at(i)->spinSize();
815     }
816     for (int i = 0; i < allWidgets.count(); i++) {
817         allWidgets.at(i)->setSpinSize(minSize);
818     }
819 }
820
821 ParameterContainer::~ParameterContainer()
822 {
823     clearLayout(m_vbox);
824     delete m_vbox;
825 }
826
827 void ParameterContainer::meetDependency(const QString& name, QString type, QString value)
828 {
829     if (type == "curve") {
830         KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
831         if (curve) {
832             int color = value.toInt();
833             curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)(color == 3 ? 4 : color), 0.8)));
834         }
835     } else if (type == "bezier_spline") {
836         BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems[name];
837         if (widget) {
838             widget->setMode((BezierSplineWidget::CurveModes)((int)(value.toDouble() * 10)));
839         }
840     }
841 }
842
843 wipeInfo ParameterContainer::getWipeInfo(QString value)
844 {
845     wipeInfo info;
846     // Convert old geometry values that used a comma as separator
847     if (value.contains(',')) value.replace(',','/');
848     QString start = value.section(';', 0, 0);
849     QString end = value.section(';', 1, 1).section('=', 1, 1);
850     if (start.startsWith("-100%/0"))
851         info.start = LEFT;
852     else if (start.startsWith("100%/0"))
853         info.start = RIGHT;
854     else if (start.startsWith("0%/100%"))
855         info.start = DOWN;
856     else if (start.startsWith("0%/-100%"))
857         info.start = UP;
858     else
859         info.start = CENTER;
860
861     if (start.count(':') == 2)
862         info.startTransparency = start.section(':', -1).toInt();
863     else
864         info.startTransparency = 100;
865
866     if (end.startsWith("-100%/0"))
867         info.end = LEFT;
868     else if (end.startsWith("100%/0"))
869         info.end = RIGHT;
870     else if (end.startsWith("0%/100%"))
871         info.end = DOWN;
872     else if (end.startsWith("0%/-100%"))
873         info.end = UP;
874     else
875         info.end = CENTER;
876
877     if (end.count(':') == 2)
878         info.endTransparency = end.section(':', -1).toInt();
879     else
880         info.endTransparency = 100;
881
882     return info;
883 }
884
885 void ParameterContainer::updateTimecodeFormat()
886 {
887     if (m_keyframeEditor)
888         m_keyframeEditor->updateTimecodeFormat();
889
890     QDomNodeList namenode = m_effect.elementsByTagName("parameter");
891     for (int i = 0; i < namenode.count() ; i++) {
892         QDomNode pa = namenode.item(i);
893         QDomElement na = pa.firstChildElement("name");
894         QString type = pa.attributes().namedItem("type").nodeValue();
895         QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
896
897         if (type == "geometry") {
898             if (KdenliveSettings::on_monitor_effects()) {
899                 if (m_geometryWidget) m_geometryWidget->updateTimecodeFormat();
900             } else {
901                 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
902                 geom->updateTimecodeFormat();
903             }
904             break;
905         } else if (type == "position") {
906             PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
907             posi->updateTimecodeFormat();
908             break;
909 #ifdef USE_QJSON
910         } else if (type == "roto-spline") {
911             RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems[paramName]);
912             widget->updateTimecodeFormat();
913 #endif
914         }
915     }
916 }
917
918 void ParameterContainer::slotCollectAllParameters()
919 {
920     if (m_valueItems.isEmpty() || m_effect.isNull()) return;
921     QLocale locale;
922     locale.setNumberOptions(QLocale::OmitGroupSeparator);
923     const QDomElement oldparam = m_effect.cloneNode().toElement();
924     //QDomElement newparam = oldparam.cloneNode().toElement();
925     QDomNodeList namenode = m_effect.elementsByTagName("parameter");
926
927     for (int i = 0; i < namenode.count() ; i++) {
928         QDomNode pa = namenode.item(i);
929         QDomElement na = pa.firstChildElement("name");
930         QString type = pa.attributes().namedItem("type").nodeValue();
931         QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
932         if (type == "complex")
933             paramName.append("complex");
934         else if (type == "position")
935             paramName.append("position");
936         else if (type == "geometry")
937             paramName.append("geometry");
938         else if (type == "keyframe")
939             paramName.append("keyframe");
940         if (type != "simplekeyframe" && type != "fixed" && type != "addedgeometry" && !m_valueItems.contains(paramName)) {
941             kDebug() << "// Param: " << paramName << " NOT FOUND";
942             continue;
943         }
944
945         QString setValue;
946         if (type == "double" || type == "constant") {
947             DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
948             setValue = locale.toString(doubleparam->getValue());
949         } else if (type == "list") {
950             KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
951             setValue = box->itemData(box->currentIndex()).toString();
952         } else if (type == "bool") {
953             QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
954             setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
955         } else if (type == "color") {
956             ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
957             setValue = choosecolor->getColor();
958         } else if (type == "complex") {
959             ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
960             namenode.item(i) = complex->getParamDesc();
961         } else if (type == "geometry") {
962             if (KdenliveSettings::on_monitor_effects()) {
963                 if (m_geometryWidget) namenode.item(i).toElement().setAttribute("value", m_geometryWidget->getValue());
964             } else {
965                 Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
966                 namenode.item(i).toElement().setAttribute("value", geom->getValue());
967             }
968         } else if (type == "addedgeometry") {
969             namenode.item(i).toElement().setAttribute("value", m_geometryWidget->getExtraValue(namenode.item(i).toElement().attribute("name")));
970         } else if (type == "position") {
971             PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
972             int pos = pedit->getPosition();
973             setValue = QString::number(pos);
974             if (m_effect.attribute("id") == "fadein" || m_effect.attribute("id") == "fade_from_black") {
975                 // Make sure duration is not longer than clip
976                 /*if (pos > m_out) {
977                     pos = m_out;
978                     pedit->setPosition(pos);
979                 }*/
980                 EffectsList::setParameter(m_effect, "in", QString::number(m_in));
981                 EffectsList::setParameter(m_effect, "out", QString::number(m_in + pos));
982                 setValue.clear();
983             } else if (m_effect.attribute("id") == "fadeout" || m_effect.attribute("id") == "fade_to_black") {
984                 // Make sure duration is not longer than clip
985                 /*if (pos > m_out) {
986                     pos = m_out;
987                     pedit->setPosition(pos);
988                 }*/
989                 EffectsList::setParameter(m_effect, "in", QString::number(m_out - pos));
990                 EffectsList::setParameter(m_effect, "out", QString::number(m_out));
991                 setValue.clear();
992             }
993         } else if (type == "curve") {
994             KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
995             QList<QPointF> points = curve->curve().points();
996             QString number = pa.attributes().namedItem("number").nodeValue();
997             QString inName = pa.attributes().namedItem("inpoints").nodeValue();
998             QString outName = pa.attributes().namedItem("outpoints").nodeValue();
999             int off = pa.attributes().namedItem("min").nodeValue().toInt();
1000             int end = pa.attributes().namedItem("max").nodeValue().toInt();
1001             EffectsList::setParameter(m_effect, number, QString::number(points.count()));
1002             for (int j = 0; (j < points.count() && j + off <= end); j++) {
1003                 QString in = inName;
1004                 in.replace("%i", QString::number(j + off));
1005                 QString out = outName;
1006                 out.replace("%i", QString::number(j + off));
1007                 EffectsList::setParameter(m_effect, in, locale.toString(points.at(j).x()));
1008                 EffectsList::setParameter(m_effect, out, locale.toString(points.at(j).y()));
1009             }
1010             QString depends = pa.attributes().namedItem("depends").nodeValue();
1011             if (!depends.isEmpty())
1012                 meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
1013         } else if (type == "bezier_spline") {
1014             BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems.value(paramName);
1015             setValue = widget->spline();
1016             QString depends = pa.attributes().namedItem("depends").nodeValue();
1017             if (!depends.isEmpty())
1018                 meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
1019 #ifdef USE_QJSON
1020         } else if (type == "roto-spline") {
1021             RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems.value(paramName));
1022             setValue = widget->getSpline();
1023 #endif
1024         } else if (type == "wipe") {
1025             Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
1026             wipeInfo info;
1027             if (wp->start_left->isChecked())
1028                 info.start = LEFT;
1029             else if (wp->start_right->isChecked())
1030                 info.start = RIGHT;
1031             else if (wp->start_up->isChecked())
1032                 info.start = UP;
1033             else if (wp->start_down->isChecked())
1034                 info.start = DOWN;
1035             else if (wp->start_center->isChecked())
1036                 info.start = CENTER;
1037             else
1038                 info.start = LEFT;
1039             info.startTransparency = wp->start_transp->value();
1040
1041             if (wp->end_left->isChecked())
1042                 info.end = LEFT;
1043             else if (wp->end_right->isChecked())
1044                 info.end = RIGHT;
1045             else if (wp->end_up->isChecked())
1046                 info.end = UP;
1047             else if (wp->end_down->isChecked())
1048                 info.end = DOWN;
1049             else if (wp->end_center->isChecked())
1050                 info.end = CENTER;
1051             else
1052                 info.end = RIGHT;
1053             info.endTransparency = wp->end_transp->value();
1054
1055             setValue = getWipeString(info);
1056         } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
1057             QDomElement elem = pa.toElement();
1058             QString realName = i18n(na.toElement().text().toUtf8().data());
1059             QString val = m_keyframeEditor->getValue(realName);
1060             elem.setAttribute("keyframes", val);
1061
1062             if (m_keyframeEditor->isVisibleParam(realName))
1063                 elem.setAttribute("intimeline", "1");
1064             else if (elem.hasAttribute("intimeline"))
1065                 elem.removeAttribute("intimeline");
1066         } else if (type == "url") {
1067             KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
1068             setValue = req->url().path();
1069         } else if (type == "keywords"){
1070             QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
1071             QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
1072             if(combo->currentIndex())
1073             {
1074                 QString comboval = combo->itemData(combo->currentIndex()).toString();
1075                 line->insert(comboval);
1076                 combo->setCurrentIndex(0);
1077             }
1078             setValue = line->text();
1079         } else if (type == "fontfamily") {
1080             QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
1081             setValue = fontfamily->currentFont().family();
1082         }
1083         if (!setValue.isNull())
1084             pa.attributes().namedItem("value").setNodeValue(setValue);
1085
1086     }
1087     emit parameterChanged(oldparam, m_effect, m_index);
1088 }
1089
1090 QString ParameterContainer::getWipeString(wipeInfo info)
1091 {
1092
1093     QString start;
1094     QString end;
1095     switch (info.start) {
1096     case LEFT:
1097         start = "-100%/0%:100%x100%";
1098         break;
1099     case RIGHT:
1100         start = "100%/0%:100%x100%";
1101         break;
1102     case DOWN:
1103         start = "0%/100%:100%x100%";
1104         break;
1105     case UP:
1106         start = "0%/-100%:100%x100%";
1107         break;
1108     default:
1109         start = "0%/0%:100%x100%";
1110         break;
1111     }
1112     start.append(':' + QString::number(info.startTransparency));
1113
1114     switch (info.end) {
1115     case LEFT:
1116         end = "-100%/0%:100%x100%";
1117         break;
1118     case RIGHT:
1119         end = "100%/0%:100%x100%";
1120         break;
1121     case DOWN:
1122         end = "0%/100%:100%x100%";
1123         break;
1124     case UP:
1125         end = "0%/-100%:100%x100%";
1126         break;
1127     default:
1128         end = "0%/0%:100%x100%";
1129         break;
1130     }
1131     end.append(':' + QString::number(info.endTransparency));
1132     return QString(start + ";-1=" + end);
1133 }
1134
1135 int ParameterContainer::index()
1136 {
1137     return m_index;
1138 }
1139
1140 void ParameterContainer::slotStartFilterJobAction()
1141 {
1142     QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1143     for (int i = 0; i < namenode.count() ; i++) {
1144         QDomElement pa = namenode.item(i).toElement();
1145         QString type = pa.attribute("type");
1146         if (type == "filterjob") {
1147             emit startFilterJob(pa.attribute("filtertag"), pa.attribute("filterparams"), pa.attribute("finalfilter"), pa.attribute("consumer"), pa.attribute("consumerparams"), pa.attribute("wantedproperties"));
1148             kDebug()<<" - - -PROPS:\n"<<pa.attribute("filtertag")<<"-"<< pa.attribute("filterparams")<<"-"<< pa.attribute("consumer")<<"-"<< pa.attribute("consumerparams")<<"-"<< pa.attribute("wantedproperties");
1149             break;
1150         }
1151     }
1152 }