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