]> git.sesse.net Git - kdenlive/blob - src/effectstackedit.cpp
- only pick color with left mouse button
[kdenlive] / src / effectstackedit.cpp
1 /***************************************************************************
2                           effecstackview.cpp  -  description
3                              -------------------
4     begin                : Feb 15 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #include "effectstackedit.h"
19 #include "ui_constval_ui.h"
20 #include "ui_listval_ui.h"
21 #include "ui_boolval_ui.h"
22 #include "ui_wipeval_ui.h"
23 #include "ui_urlval_ui.h"
24 #include "complexparameter.h"
25 #include "geometryval.h"
26 #include "positionedit.h"
27 #include "projectlist.h"
28 #include "effectslist.h"
29 #include "kdenlivesettings.h"
30 #include "profilesdialog.h"
31 #include "kis_curve_widget.h"
32 #include "kis_cubic_curve.h"
33 #include "choosecolorwidget.h"
34
35 #include <KDebug>
36 #include <KLocale>
37 #include <KFileDialog>
38
39 #include <QVBoxLayout>
40 #include <QSlider>
41 #include <QLabel>
42 #include <QPushButton>
43 #include <QCheckBox>
44 #include <QScrollArea>
45
46
47 class Boolval: public QWidget, public Ui::Boolval_UI
48 {
49 };
50
51 class Constval: public QWidget, public Ui::Constval_UI
52 {
53 };
54
55 class Listval: public QWidget, public Ui::Listval_UI
56 {
57 };
58
59 class Wipeval: public QWidget, public Ui::Wipeval_UI
60 {
61 };
62
63 class Urlval: public QWidget, public Ui::Urlval_UI
64 {
65 };
66
67 QMap<QString, QImage> EffectStackEdit::iconCache;
68
69 EffectStackEdit::EffectStackEdit(QWidget *parent) :
70         QScrollArea(parent),
71         m_in(0),
72         m_out(0),
73         m_frameSize(QPoint()),
74         m_keyframeEditor(NULL)
75 {
76     m_baseWidget = new QWidget(this);
77     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
78     setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
79     setFrameStyle(QFrame::NoFrame);
80     setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
81
82     setWidget(m_baseWidget);
83     setWidgetResizable(true);
84     m_vbox = new QVBoxLayout(m_baseWidget);
85     m_vbox->setContentsMargins(0, 0, 0, 0);
86     m_vbox->setSpacing(0);
87     //wid->show();
88 }
89
90 EffectStackEdit::~EffectStackEdit()
91 {
92     iconCache.clear();
93     delete m_baseWidget;
94 }
95
96 void EffectStackEdit::setFrameSize(QPoint p)
97 {
98     m_frameSize = p;
99     QDomNodeList namenode = m_params.elementsByTagName("parameter");
100     for (int i = 0; i < namenode.count() ; i++) {
101         QDomNode pa = namenode.item(i);
102         QDomNode na = pa.firstChildElement("name");
103         QString type = pa.attributes().namedItem("type").nodeValue();
104         QString paramName = i18n(na.toElement().text().toUtf8().data());
105
106         if (type == "geometry") {
107             Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
108             geom->setFrameSize(m_frameSize);
109             break;
110         }
111     }
112 }
113
114 void EffectStackEdit::updateTimecodeFormat()
115 {
116     if (m_keyframeEditor)
117         m_keyframeEditor->updateTimecodeFormat();
118     QDomNodeList namenode = m_params.elementsByTagName("parameter");
119     for (int i = 0; i < namenode.count() ; i++) {
120         QDomNode pa = namenode.item(i);
121         QDomNode na = pa.firstChildElement("name");
122         QString type = pa.attributes().namedItem("type").nodeValue();
123         QString paramName = i18n(na.toElement().text().toUtf8().data());
124
125         if (type == "geometry") {
126             Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
127             geom->updateTimecodeFormat();
128             break;
129         }
130         if (type == "position") {
131             PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
132             posi->updateTimecodeFormat();
133             break;
134         }
135     }
136 }
137
138 void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
139 {
140     m_profile = profile;
141     m_timecode = t;
142 }
143
144 void EffectStackEdit::updateParameter(const QString &name, const QString &value)
145 {
146     m_params.setAttribute(name, value);
147 }
148
149 void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, int out)
150 {
151     clearAllItems();
152     if (m_keyframeEditor) delete m_keyframeEditor;
153     m_keyframeEditor = NULL;
154     m_params = d;
155     m_in = in;
156     m_out = out;
157     if (m_params.isNull()) {
158         kDebug() << "// EMPTY EFFECT STACK";
159         return;
160     }
161
162     /*QDomDocument doc;
163     doc.appendChild(doc.importNode(m_params, true));
164     kDebug() << "IMPORTED TRANS: " << doc.toString();*/
165
166     QDomNodeList namenode = m_params.elementsByTagName("parameter");
167     QDomElement e = m_params.toElement();
168     const int minFrame = e.attribute("start").toInt();
169     const int maxFrame = e.attribute("end").toInt();
170
171
172     for (int i = 0; i < namenode.count() ; i++) {
173         QDomElement pa = namenode.item(i).toElement();
174         QDomNode na = pa.firstChildElement("name");
175         QString type = pa.attribute("type");
176         QString paramName = i18n(na.toElement().text().toUtf8().data());
177         QWidget * toFillin = new QWidget(m_baseWidget);
178         QString value = pa.attribute("value").isNull() ?
179                         pa.attribute("default") : pa.attribute("value");
180
181         /** Currently supported parameter types are:
182             * constant (=double): a slider with an integer value (use the "factor" attribute to divide the value so that you can get a double
183             * list: a combobox containing a list of values to choose
184             * bool: a checkbox
185             * complex: designed for keyframe parameters, but old and not finished, do not use
186             * geometry: a rectangle that can be moved & resized, with possible keyframes, used in composite transition
187             * keyframe: a list widget with a list of entries (position and value)
188             * color: a color chooser button
189             * position: a slider representing the position of a frame in the current clip
190             * curve: a single curve representing multiple points
191             * wipe: a widget designed for the wipe transition, allowing to choose a position (left, right, top,...)
192         */
193
194         if (type == "double" || type == "constant") {
195             int min;
196             int max;
197             if (pa.attribute("min").startsWith('%'))
198                 min = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
199             else
200                 min = pa.attribute("min").toInt();
201             if (pa.attribute("max").startsWith('%'))
202                 max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
203             else
204                 max = pa.attribute("max").toInt();
205             createSliderItem(paramName, (int)(value.toDouble() + 0.5) , min, max, pa.attribute("suffix", QString()));
206             delete toFillin;
207             toFillin = NULL;
208         } else if (type == "list") {
209             Listval *lsval = new Listval;
210             lsval->setupUi(toFillin);
211             QStringList listitems = pa.attribute("paramlist").split(',');
212             QStringList listitemsdisplay = pa.attribute("paramlistdisplay").split(',');
213             if (listitemsdisplay.count() != listitems.count()) listitemsdisplay = listitems;
214             //lsval->list->addItems(listitems);
215             lsval->list->setIconSize(QSize(30, 30));
216             for (int i = 0; i < listitems.count(); i++) {
217                 lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
218                 QString entry = listitems.at(i);
219                 if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
220                     if (!EffectStackEdit::iconCache.contains(entry)) {
221                         QImage pix(entry);
222                         EffectStackEdit::iconCache[entry] = pix.scaled(30, 30);
223                     }
224                     lsval->list->setItemIcon(i, QPixmap::fromImage(iconCache[entry]));
225                 }
226             }
227             if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
228             lsval->title->setTitle(paramName);
229             m_valueItems[paramName] = lsval;
230             connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(collectAllParameters()));
231             m_uiItems.append(lsval);
232         } else if (type == "bool") {
233             Boolval *bval = new Boolval;
234             bval->setupUi(toFillin);
235             bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
236             bval->checkBox->setText(paramName);
237             m_valueItems[paramName] = bval;
238             connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters()));
239             m_uiItems.append(bval);
240         } else if (type == "complex") {
241             /*QStringList names=nodeAtts.namedItem("name").nodeValue().split(';');
242             QStringList max=nodeAtts.namedItem("max").nodeValue().split(';');
243             QStringList min=nodeAtts.namedItem("min").nodeValue().split(';');
244             QStringList val=value.split(';');
245             kDebug() << "in complex"<<names.size() << " " << max.size() << " " << min.size() << " " << val.size()  ;
246             if ( (names.size() == max.size() ) &&
247                  (names.size()== min.size()) &&
248                  (names.size()== val.size()) )
249             {
250              for (int i=0;i< names.size();i++){
251               createSliderItem(names[i],val[i].toInt(),min[i].toInt(),max[i].toInt());
252              };
253             }*/
254             ComplexParameter *pl = new ComplexParameter;
255             pl->setupParam(d, pa.attribute("name"), 0, 100);
256             m_vbox->addWidget(pl);
257             m_valueItems[paramName+"complex"] = pl;
258             connect(pl, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
259         } else if (type == "geometry") {
260             Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, pos);
261             if (minFrame == maxFrame)
262                 geo->setupParam(pa, m_in, m_out);
263             else
264                 geo->setupParam(pa, minFrame, maxFrame);
265             m_vbox->addWidget(geo);
266             m_valueItems[paramName+"geometry"] = geo;
267             connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
268             connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
269         } else if (type == "keyframe" || type == "simplekeyframe") {
270             // keyframe editor widget
271             kDebug() << "min: " << m_in << ", MAX: " << m_out;
272             if (m_keyframeEditor == NULL) {
273                 KeyframeEdit *geo = new KeyframeEdit(pa, m_in, m_in + m_out, pa.attribute("min").toInt(), pa.attribute("max").toInt(), m_timecode, e.attribute("active_keyframe", "-1").toInt());
274                 m_vbox->addWidget(geo);
275                 m_valueItems[paramName+"keyframe"] = geo;
276                 m_keyframeEditor = geo;
277                 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
278                 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
279             } else {
280                 // we already have a keyframe editor, so just add another column for the new param
281                 m_keyframeEditor->addParameter(pa);
282             }
283         } else if (type == "color") {
284             if (value.startsWith('#'))
285                 value = value.replace('#', "0x");
286             bool ok;
287             ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
288             m_vbox->addWidget(choosecolor);
289             m_valueItems[paramName] = choosecolor;
290             connect(choosecolor, SIGNAL(modified()) , this, SLOT(collectAllParameters()));
291         } else if (type == "position") {
292             int pos = value.toInt();
293             if (d.attribute("id") == "fadein" || d.attribute("id") == "fade_from_black") {
294                 pos = pos - m_in;
295             } else if (d.attribute("id") == "fadeout" || d.attribute("id") == "fade_to_black") {
296                 // fadeout position starts from clip end
297                 pos = m_out - (pos - m_in);
298             }
299             PositionEdit *posedit = new PositionEdit(paramName, pos, 1, m_out, m_timecode);
300             m_vbox->addWidget(posedit);
301             m_valueItems[paramName+"position"] = posedit;
302             connect(posedit, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
303         } else if (type == "curve") {
304             KisCurveWidget *curve = new KisCurveWidget(this);
305             curve->setMaxPoints(pa.attribute("max").toInt());
306             QList<QPointF> points;
307             int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
308             QString inName = pa.attribute("inpoints");
309             QString outName = pa.attribute("outpoints");
310             int start = pa.attribute("min").toInt();
311             for (int j = start; j <= number; j++) {
312                 QString in = inName;
313                 in.replace("%i", QString::number(j));
314                 QString out = outName;
315                 out.replace("%i", QString::number(j));
316                 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
317             }
318             if (!points.isEmpty())
319                 curve->setCurve(KisCubicCurve(points));
320             QSpinBox *spinin = new QSpinBox();
321             spinin->setRange(0, 1000);
322             QSpinBox *spinout = new QSpinBox();
323             spinout->setRange(0, 1000);
324             curve->setupInOutControls(spinin, spinout, 0, 1000);
325             m_vbox->addWidget(curve);
326             m_vbox->addWidget(spinin);
327             m_vbox->addWidget(spinout);
328             connect(curve, SIGNAL(modified()), this, SLOT(collectAllParameters()));
329             m_valueItems[paramName] = curve;
330         } else if (type == "wipe") {
331             Wipeval *wpval = new Wipeval;
332             wpval->setupUi(toFillin);
333             wipeInfo w = getWipeInfo(value);
334             switch (w.start) {
335             case UP:
336                 wpval->start_up->setChecked(true);
337                 break;
338             case DOWN:
339                 wpval->start_down->setChecked(true);
340                 break;
341             case RIGHT:
342                 wpval->start_right->setChecked(true);
343                 break;
344             case LEFT:
345                 wpval->start_left->setChecked(true);
346                 break;
347             default:
348                 wpval->start_center->setChecked(true);
349                 break;
350             }
351             switch (w.end) {
352             case UP:
353                 wpval->end_up->setChecked(true);
354                 break;
355             case DOWN:
356                 wpval->end_down->setChecked(true);
357                 break;
358             case RIGHT:
359                 wpval->end_right->setChecked(true);
360                 break;
361             case LEFT:
362                 wpval->end_left->setChecked(true);
363                 break;
364             default:
365                 wpval->end_center->setChecked(true);
366                 break;
367             }
368             wpval->start_transp->setValue(w.startTransparency);
369             wpval->end_transp->setValue(w.endTransparency);
370             m_valueItems[paramName] = wpval;
371             connect(wpval->end_up, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
372             connect(wpval->end_down, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
373             connect(wpval->end_left, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
374             connect(wpval->end_right, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
375             connect(wpval->end_center, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
376             connect(wpval->start_up, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
377             connect(wpval->start_down, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
378             connect(wpval->start_left, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
379             connect(wpval->start_right, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
380             connect(wpval->start_center, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
381             connect(wpval->start_transp, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
382             connect(wpval->end_transp, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
383             //wpval->title->setTitle(na.toElement().text());
384             m_uiItems.append(wpval);
385         } else if (type == "url") {
386             Urlval *cval = new Urlval;
387             cval->setupUi(toFillin);
388             cval->label->setText(paramName);
389             cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
390             m_valueItems[paramName] = cval;
391             cval->urlwidget->setUrl(KUrl(value));
392             connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(collectAllParameters()));
393             connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(collectAllParameters()));
394             m_uiItems.append(cval);
395         } else {
396             delete toFillin;
397             toFillin = NULL;
398         }
399
400         if (toFillin)
401             m_vbox->addWidget(toFillin);
402     }
403     m_vbox->addStretch();
404 }
405
406 wipeInfo EffectStackEdit::getWipeInfo(QString value)
407 {
408     wipeInfo info;
409     QString start = value.section(';', 0, 0);
410     QString end = value.section(';', 1, 1).section('=', 1, 1);
411
412     if (start.startsWith("-100%,0"))
413         info.start = LEFT;
414     else if (start.startsWith("100%,0"))
415         info.start = RIGHT;
416     else if (start.startsWith("0%,100%"))
417         info.start = DOWN;
418     else if (start.startsWith("0%,-100%"))
419         info.start = UP;
420     else
421         info.start = CENTER;
422
423     if (start.count(':') == 2)
424         info.startTransparency = start.section(':', -1).toInt();
425     else
426         info.startTransparency = 100;
427
428     if (end.startsWith("-100%,0"))
429         info.end = LEFT;
430     else if (end.startsWith("100%,0"))
431         info.end = RIGHT;
432     else if (end.startsWith("0%,100%"))
433         info.end = DOWN;
434     else if (end.startsWith("0%,-100%"))
435         info.end = UP;
436     else
437         info.end = CENTER;
438
439     if (end.count(':') == 2)
440         info.endTransparency = end.section(':', -1).toInt();
441     else
442         info.endTransparency = 100;
443
444     return info;
445 }
446
447 QString EffectStackEdit::getWipeString(wipeInfo info)
448 {
449
450     QString start;
451     QString end;
452     switch (info.start) {
453     case LEFT:
454         start = "-100%,0%:100%x100%";
455         break;
456     case RIGHT:
457         start = "100%,0%:100%x100%";
458         break;
459     case DOWN:
460         start = "0%,100%:100%x100%";
461         break;
462     case UP:
463         start = "0%,-100%:100%x100%";
464         break;
465     default:
466         start = "0%,0%:100%x100%";
467         break;
468     }
469     start.append(':' + QString::number(info.startTransparency));
470
471     switch (info.end) {
472     case LEFT:
473         end = "-100%,0%:100%x100%";
474         break;
475     case RIGHT:
476         end = "100%,0%:100%x100%";
477         break;
478     case DOWN:
479         end = "0%,100%:100%x100%";
480         break;
481     case UP:
482         end = "0%,-100%:100%x100%";
483         break;
484     default:
485         end = "0%,0%:100%x100%";
486         break;
487     }
488     end.append(':' + QString::number(info.endTransparency));
489     return QString(start + ";-1=" + end);
490 }
491
492 void EffectStackEdit::collectAllParameters()
493 {
494     if (m_valueItems.isEmpty() || m_params.isNull()) return;
495     const QDomElement oldparam = m_params.cloneNode().toElement();
496     QDomElement newparam = oldparam.cloneNode().toElement();
497     QDomNodeList namenode = newparam.elementsByTagName("parameter");
498
499     for (int i = 0; i < namenode.count() ; i++) {
500         QDomNode pa = namenode.item(i);
501         QDomNode na = pa.firstChildElement("name");
502         QString type = pa.attributes().namedItem("type").nodeValue();
503         QString paramName = i18n(na.toElement().text().toUtf8().data());
504         if (type == "complex")
505             paramName.append("complex");
506         else if (type == "position")
507             paramName.append("position");
508         else if (type == "geometry")
509             paramName.append("geometry");
510         else if (type == "keyframe")
511             paramName.append("keyframe");
512         if (type != "simplekeyframe" && !m_valueItems.contains(paramName)) {
513             kDebug() << "// Param: " << paramName << " NOT FOUND";
514             continue;
515         }
516
517         QString setValue;
518         if (type == "double" || type == "constant") {
519             QSlider* slider = ((Constval*)m_valueItems.value(paramName))->horizontalSlider;
520             setValue = QString::number(slider->value());
521         } else if (type == "list") {
522             KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
523             setValue = box->itemData(box->currentIndex()).toString();
524         } else if (type == "bool") {
525             QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
526             setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
527         } else if (type == "color") {
528             ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
529             setValue = choosecolor->getColor().name();
530         } else if (type == "complex") {
531             ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
532             namenode.item(i) = complex->getParamDesc();
533         } else if (type == "geometry") {
534             Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
535             namenode.item(i).toElement().setAttribute("value", geom->getValue());
536         } else if (type == "position") {
537             PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
538             int pos = pedit->getPosition();
539             setValue = QString::number(pos);
540             if (newparam.attribute("id") == "fadein" || newparam.attribute("id") == "fade_from_black") {
541                 // Make sure duration is not longer than clip
542                 /*if (pos > m_out) {
543                     pos = m_out;
544                     pedit->setPosition(pos);
545                 }*/
546                 EffectsList::setParameter(newparam, "in", QString::number(m_in));
547                 EffectsList::setParameter(newparam, "out", QString::number(m_in + pos));
548                 setValue.clear();
549             } else if (newparam.attribute("id") == "fadeout" || newparam.attribute("id") == "fade_to_black") {
550                 // Make sure duration is not longer than clip
551                 /*if (pos > m_out) {
552                     pos = m_out;
553                     pedit->setPosition(pos);
554                 }*/
555                 EffectsList::setParameter(newparam, "in", QString::number(m_out + m_in - pos));
556                 EffectsList::setParameter(newparam, "out", QString::number(m_out + m_in));
557                 setValue.clear();
558             }
559         } else if (type == "curve") {
560             KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
561             QList<QPointF> points = curve->curve().points();
562             QString number = pa.attributes().namedItem("number").nodeValue();
563             QString inName = pa.attributes().namedItem("inpoints").nodeValue();
564             QString outName = pa.attributes().namedItem("outpoints").nodeValue();
565             int off = pa.attributes().namedItem("min").nodeValue().toInt();
566             int end = pa.attributes().namedItem("max").nodeValue().toInt();
567             EffectsList::setParameter(newparam, number, QString::number(points.count()));
568             for (int j = 0; (j < points.count() && j + off <= end); j++) {
569                 QString in = inName;
570                 in.replace("%i", QString::number(j + off));
571                 QString out = outName;
572                 out.replace("%i", QString::number(j + off));
573                 EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
574                 EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
575             }
576         } else if (type == "wipe") {
577             Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
578             wipeInfo info;
579             if (wp->start_left->isChecked())
580                 info.start = LEFT;
581             else if (wp->start_right->isChecked())
582                 info.start = RIGHT;
583             else if (wp->start_up->isChecked())
584                 info.start = UP;
585             else if (wp->start_down->isChecked())
586                 info.start = DOWN;
587             else if (wp->start_center->isChecked())
588                 info.start = CENTER;
589             else
590                 info.start = LEFT;
591             info.startTransparency = wp->start_transp->value();
592
593             if (wp->end_left->isChecked())
594                 info.end = LEFT;
595             else if (wp->end_right->isChecked())
596                 info.end = RIGHT;
597             else if (wp->end_up->isChecked())
598                 info.end = UP;
599             else if (wp->end_down->isChecked())
600                 info.end = DOWN;
601             else if (wp->end_center->isChecked())
602                 info.end = CENTER;
603             else
604                 info.end = RIGHT;
605             info.endTransparency = wp->end_transp->value();
606
607             setValue = getWipeString(info);
608         } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
609             QString realName = i18n(na.toElement().text().toUtf8().data());
610             QString val = m_keyframeEditor->getValue(realName);
611             kDebug() << "SET VALUE: " << val;
612             namenode.item(i).toElement().setAttribute("keyframes", val);
613         } else if (type == "url") {
614             KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
615             setValue = req->url().path();
616         }
617
618         if (!setValue.isNull())
619             pa.attributes().namedItem("value").setNodeValue(setValue);
620
621     }
622     emit parameterChanged(oldparam, newparam);
623 }
624
625 void EffectStackEdit::createSliderItem(const QString& name, int val , int min, int max, const QString suffix)
626 {
627     QWidget* toFillin = new QWidget(m_baseWidget);
628     Constval *ctval = new Constval;
629     ctval->setupUi(toFillin);
630     ctval->horizontalSlider->setMinimum(min);
631     ctval->horizontalSlider->setMaximum(max);
632     if (!suffix.isEmpty()) ctval->spinBox->setSuffix(suffix);
633     ctval->spinBox->setMinimum(min);
634     ctval->spinBox->setMaximum(max);
635     ctval->horizontalSlider->setPageStep((int)(max - min) / 10);
636     ctval->horizontalSlider->setValue(val);
637     ctval->label->setText(name);
638     m_valueItems[name] = ctval;
639     m_uiItems.append(ctval);
640     connect(ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT(collectAllParameters()));
641     m_vbox->addWidget(toFillin);
642 }
643
644 void EffectStackEdit::slotSliderMoved(int)
645 {
646     collectAllParameters();
647 }
648
649 void EffectStackEdit::clearAllItems()
650 {
651     blockSignals(true);
652     m_valueItems.clear();
653     m_uiItems.clear();
654     /*while (!m_items.isEmpty()) {
655         QWidget *die = m_items.takeFirst();
656         die->disconnect();
657         delete die;
658     }*/
659     //qDeleteAll(m_uiItems);
660     QLayoutItem *child;
661     while ((child = m_vbox->takeAt(0)) != 0) {
662         QWidget *wid = child->widget();
663         delete child;
664         if (wid) delete wid;
665     }
666     m_keyframeEditor = NULL;
667     blockSignals(false);
668 }