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