]> git.sesse.net Git - kdenlive/blob - src/effectstackedit.cpp
0ba3aa1d1ead54fcbd6d17d549e06be646e6c2ed
[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 "ui_urlval_ui.h"
25 #include "complexparameter.h"
26 #include "geometryval.h"
27 #include "positionedit.h"
28 #include "projectlist.h"
29 #include "effectslist.h"
30 #include "kdenlivesettings.h"
31 #include "profilesdialog.h"
32 #include "kis_curve_widget.h"
33 #include "kis_cubic_curve.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 Colorval: public QWidget, public Ui::Colorval_UI
52 {
53 };
54
55 class Constval: public QWidget, public Ui::Constval_UI
56 {
57 };
58
59 class Listval: public QWidget, public Ui::Listval_UI
60 {
61 };
62
63 class Wipeval: public QWidget, public Ui::Wipeval_UI
64 {
65 };
66
67 class Urlval: public QWidget, public Ui::Urlval_UI
68 {
69 };
70
71 QMap<QString, QImage> EffectStackEdit::iconCache;
72
73 EffectStackEdit::EffectStackEdit(QWidget *parent) :
74         QScrollArea(parent),
75         m_in(0),
76         m_out(0),
77         m_frameSize(QPoint()),
78         m_keyframeEditor(NULL)
79 {
80     m_baseWidget = new QWidget(this);
81     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
82     setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
83     setFrameStyle(QFrame::NoFrame);
84     setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
85
86     setWidget(m_baseWidget);
87     setWidgetResizable(true);
88     m_vbox = new QVBoxLayout(m_baseWidget);
89     m_vbox->setContentsMargins(0, 0, 0, 0);
90     m_vbox->setSpacing(0);
91     //wid->show();
92 }
93
94 EffectStackEdit::~EffectStackEdit()
95 {
96     iconCache.clear();
97     delete m_baseWidget;
98 }
99
100 void EffectStackEdit::setFrameSize(QPoint p)
101 {
102     m_frameSize = p;
103     QDomNodeList namenode = m_params.elementsByTagName("parameter");
104     for (int i = 0; i < namenode.count() ; i++) {
105         QDomNode pa = namenode.item(i);
106         QDomNode na = pa.firstChildElement("name");
107         QString type = pa.attributes().namedItem("type").nodeValue();
108         QString paramName = i18n(na.toElement().text().toUtf8().data());
109
110         if (type == "geometry") {
111             Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
112             geom->setFrameSize(m_frameSize);
113             break;
114         }
115     }
116 }
117
118 void EffectStackEdit::updateTimecodeFormat()
119 {
120     QDomNodeList namenode = m_params.elementsByTagName("parameter");
121     for (int i = 0; i < namenode.count() ; i++) {
122         QDomNode pa = namenode.item(i);
123         QDomNode na = pa.firstChildElement("name");
124         QString type = pa.attributes().namedItem("type").nodeValue();
125         QString paramName = i18n(na.toElement().text().toUtf8().data());
126
127         if (type == "geometry") {
128             Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
129             geom->updateTimecodeFormat();
130             break;
131         }
132         if (type == "position") {
133             PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
134             posi->updateTimecodeFormat();
135             break;
136         }
137     }
138 }
139
140 void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
141 {
142     m_profile = profile;
143     m_timecode = t;
144 }
145
146 void EffectStackEdit::updateParameter(const QString &name, const QString &value)
147 {
148     m_params.setAttribute(name, value);
149 }
150
151 void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, int out)
152 {
153     clearAllItems();
154     if (m_keyframeEditor) delete m_keyframeEditor;
155     m_keyframeEditor = NULL;
156     m_params = d;
157     m_in = in;
158     m_out = out;
159     if (m_params.isNull()) {
160         kDebug() << "// EMPTY EFFECT STACK";
161         return;
162     }
163
164     /*QDomDocument doc;
165     doc.appendChild(doc.importNode(m_params, true));
166     kDebug() << "IMPORTED TRANS: " << doc.toString();*/
167
168     QDomNodeList namenode = m_params.elementsByTagName("parameter");
169     QDomElement e = m_params.toElement();
170     const int minFrame = e.attribute("start").toInt();
171     const int maxFrame = e.attribute("end").toInt();
172
173
174     for (int i = 0; i < namenode.count() ; i++) {
175         QDomElement pa = namenode.item(i).toElement();
176         QDomNode na = pa.firstChildElement("name");
177         QString type = pa.attribute("type");
178         QString paramName = i18n(na.toElement().text().toUtf8().data());
179         QWidget * toFillin = new QWidget(m_baseWidget);
180         QString value = pa.attribute("value").isNull() ?
181                         pa.attribute("default") : pa.attribute("value");
182
183         /** Currently supported parameter types are:
184             * constant (=double): a slider with an integer value (use the "factor" attribute to divide the value so that you can get a double
185             * list: a combobox containing a list of values to choose
186             * bool: a checkbox
187             * complex: designed for keyframe parameters, but old and not finished, do not use
188             * geometry: a rectangle that can be moved & resized, with possible keyframes, used in composite transition
189             * keyframe: a list widget with a list of entries (position and value)
190             * color: a color chooser button
191             * position: a slider representing the position of a frame in the current clip
192             * curve: a single curve representing multiple points
193             * wipe: a widget designed for the wipe transition, allowing to choose a position (left, right, top,...)
194         */
195
196         if (type == "double" || type == "constant") {
197             int min;
198             int max;
199             if (pa.attribute("min").startsWith('%')) {
200                 min = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
201             } else min = pa.attribute("min").toInt();
202             if (pa.attribute("max").startsWith('%')) {
203                 max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
204             } else 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) geo->setupParam(pa, m_in, m_out);
262             else geo->setupParam(pa, minFrame, maxFrame);
263             m_vbox->addWidget(geo);
264             m_valueItems[paramName+"geometry"] = geo;
265             connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
266             connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
267         } else if (type == "keyframe" || type == "simplekeyframe") {
268             // keyframe editor widget
269             kDebug() << "min: " << m_in << ", MAX: " << m_out;
270             if (m_keyframeEditor == NULL) {
271                 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());
272                 m_vbox->addWidget(geo);
273                 m_valueItems[paramName+"keyframe"] = geo;
274                 m_keyframeEditor = geo;
275                 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
276                 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
277             } else {
278                 // we already have a keyframe editor, so just add another column for the new param
279                 m_keyframeEditor->addParameter(pa);
280             }
281         } else if (type == "color") {
282             Colorval *cval = new Colorval;
283             cval->setupUi(toFillin);
284             bool ok;
285             if (value.startsWith('#')) value = value.replace('#', "0x");
286             cval->kcolorbutton->setColor(value.toUInt(&ok, 16));
287             //kDebug() << "color: " << value << ", " << value.toUInt(&ok, 16);
288             cval->label->setText(paramName);
289             m_valueItems[paramName] = cval;
290             connect(cval->kcolorbutton, SIGNAL(clicked()) , this, SLOT(collectAllParameters()));
291             m_uiItems.append(cval);
292         } else if (type == "position") {
293             int pos = value.toInt();
294             if (d.attribute("id") == "fadein" || d.attribute("id") == "fade_from_black") {
295                 pos = pos - m_in;
296             } else if (d.attribute("id") == "fadeout" || d.attribute("id") == "fade_to_black") {
297                 // fadeout position starts from clip end
298                 pos = m_out - (pos - m_in);
299             }
300             PositionEdit *posedit = new PositionEdit(paramName, pos, 1, m_out, m_timecode);
301             m_vbox->addWidget(posedit);
302             m_valueItems[paramName+"position"] = posedit;
303             connect(posedit, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
304         } else if (type == "curve") {
305             KisCurveWidget *curve = new KisCurveWidget(this);
306             curve->setMaxPoints(pa.attribute("max").toInt());
307             QList<QPointF> points;
308             int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
309             QString inName = pa.attribute("inpoints");
310             QString outName = pa.attribute("outpoints");
311             int start = pa.attribute("min").toInt();
312             for (int j = start; j <= number; j++) {
313                 QString in = inName;
314                 in.replace("%i", QString::number(j));
315                 QString out = outName;
316                 out.replace("%i", QString::number(j));
317                 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
318             }
319             if (!points.isEmpty()) 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     }
404     m_vbox->addStretch();
405 }
406
407 wipeInfo EffectStackEdit::getWipeInfo(QString value)
408 {
409     wipeInfo info;
410     QString start = value.section(';', 0, 0);
411     QString end = value.section(';', 1, 1).section('=', 1, 1);
412     if (start.startsWith("-100%,0")) info.start = LEFT;
413     else if (start.startsWith("100%,0")) info.start = RIGHT;
414     else if (start.startsWith("0%,100%")) info.start = DOWN;
415     else if (start.startsWith("0%,-100%")) info.start = UP;
416     else info.start = CENTER;
417     if (start.count(':') == 2) info.startTransparency = start.section(':', -1).toInt();
418     else info.startTransparency = 100;
419
420     if (end.startsWith("-100%,0")) info.end = LEFT;
421     else if (end.startsWith("100%,0")) info.end = RIGHT;
422     else if (end.startsWith("0%,100%")) info.end = DOWN;
423     else if (end.startsWith("0%,-100%")) info.end = UP;
424     else info.end = CENTER;
425     if (end.count(':') == 2) info.endTransparency = end.section(':', -1).toInt();
426     else info.endTransparency = 100;
427     return info;
428 }
429
430 QString EffectStackEdit::getWipeString(wipeInfo info)
431 {
432
433     QString start;
434     QString end;
435     switch (info.start) {
436     case LEFT:
437         start = "-100%,0%:100%x100%";
438         break;
439     case RIGHT:
440         start = "100%,0%:100%x100%";
441         break;
442     case DOWN:
443         start = "0%,100%:100%x100%";
444         break;
445     case UP:
446         start = "0%,-100%:100%x100%";
447         break;
448     default:
449         start = "0%,0%:100%x100%";
450         break;
451     }
452     start.append(':' + QString::number(info.startTransparency));
453
454     switch (info.end) {
455     case LEFT:
456         end = "-100%,0%:100%x100%";
457         break;
458     case RIGHT:
459         end = "100%,0%:100%x100%";
460         break;
461     case DOWN:
462         end = "0%,100%:100%x100%";
463         break;
464     case UP:
465         end = "0%,-100%:100%x100%";
466         break;
467     default:
468         end = "0%,0%:100%x100%";
469         break;
470     }
471     end.append(':' + QString::number(info.endTransparency));
472     return QString(start + ";-1=" + end);
473 }
474
475 void EffectStackEdit::collectAllParameters()
476 {
477     if (m_valueItems.isEmpty() || m_params.isNull()) return;
478     const QDomElement oldparam = m_params.cloneNode().toElement();
479     QDomElement newparam = oldparam.cloneNode().toElement();
480     QDomNodeList namenode = newparam.elementsByTagName("parameter");
481
482     for (int i = 0; i < namenode.count() ; i++) {
483         QDomNode pa = namenode.item(i);
484         QDomNode na = pa.firstChildElement("name");
485         QString type = pa.attributes().namedItem("type").nodeValue();
486         QString paramName = i18n(na.toElement().text().toUtf8().data());
487         if (type == "complex") paramName.append("complex");
488         else if (type == "position") paramName.append("position");
489         else if (type == "geometry") paramName.append("geometry");
490         else if (type == "keyframe") paramName.append("keyframe");
491         if (type != "simplekeyframe" && !m_valueItems.contains(paramName)) {
492             kDebug() << "// Param: " << paramName << " NOT FOUND";
493             continue;
494         }
495
496         QString setValue;
497         if (type == "double" || type == "constant") {
498             QSlider* slider = ((Constval*)m_valueItems.value(paramName))->horizontalSlider;
499             setValue = QString::number(slider->value());
500         } else if (type == "list") {
501             KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
502             setValue = box->itemData(box->currentIndex()).toString();
503         } else if (type == "bool") {
504             QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
505             setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
506         } else if (type == "color") {
507             KColorButton *color = ((Colorval*)m_valueItems.value(paramName))->kcolorbutton;
508             setValue = color->color().name();
509         } else if (type == "complex") {
510             ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
511             namenode.item(i) = complex->getParamDesc();
512         } else if (type == "geometry") {
513             Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
514             namenode.item(i).toElement().setAttribute("value", geom->getValue());
515         } else if (type == "position") {
516             PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
517             int pos = pedit->getPosition();
518             setValue = QString::number(pos);
519             if (newparam.attribute("id") == "fadein" || newparam.attribute("id") == "fade_from_black") {
520                 // Make sure duration is not longer than clip
521                 /*if (pos > m_out) {
522                     pos = m_out;
523                     pedit->setPosition(pos);
524                 }*/
525                 EffectsList::setParameter(newparam, "in", QString::number(m_in));
526                 EffectsList::setParameter(newparam, "out", QString::number(m_in + pos));
527                 setValue.clear();
528             } else if (newparam.attribute("id") == "fadeout" || newparam.attribute("id") == "fade_to_black") {
529                 // Make sure duration is not longer than clip
530                 /*if (pos > m_out) {
531                     pos = m_out;
532                     pedit->setPosition(pos);
533                 }*/
534                 EffectsList::setParameter(newparam, "in", QString::number(m_out + m_in - pos));
535                 EffectsList::setParameter(newparam, "out", QString::number(m_out + m_in));
536                 setValue.clear();
537             }
538         } else if (type == "curve") {
539             KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
540             QList<QPointF> points = curve->curve().points();
541             QString number = pa.attributes().namedItem("number").nodeValue();
542             QString inName = pa.attributes().namedItem("inpoints").nodeValue();
543             QString outName = pa.attributes().namedItem("outpoints").nodeValue();
544             int off = pa.attributes().namedItem("min").nodeValue().toInt();
545             int end = pa.attributes().namedItem("max").nodeValue().toInt();
546             EffectsList::setParameter(newparam, number, QString::number(points.count()));
547             for (int j = 0; (j < points.count() && j + off <= end); j++) {
548                 QString in = inName;
549                 in.replace("%i", QString::number(j + off));
550                 QString out = outName;
551                 out.replace("%i", QString::number(j + off));
552                 EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
553                 EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
554             }
555         } else if (type == "wipe") {
556             Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
557             wipeInfo info;
558             if (wp->start_left->isChecked()) info.start = LEFT;
559             else if (wp->start_right->isChecked()) info.start = RIGHT;
560             else if (wp->start_up->isChecked()) info.start = UP;
561             else if (wp->start_down->isChecked()) info.start = DOWN;
562             else if (wp->start_center->isChecked()) info.start = CENTER;
563             else info.start = LEFT;
564             info.startTransparency = wp->start_transp->value();
565             if (wp->end_left->isChecked()) info.end = LEFT;
566             else if (wp->end_right->isChecked()) info.end = RIGHT;
567             else if (wp->end_up->isChecked()) info.end = UP;
568             else if (wp->end_down->isChecked()) info.end = DOWN;
569             else if (wp->end_center->isChecked()) info.end = CENTER;
570             else info.end = RIGHT;
571             info.endTransparency = wp->end_transp->value();
572             setValue = getWipeString(info);
573         } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
574             QString realName = i18n(na.toElement().text().toUtf8().data());
575             QString val = m_keyframeEditor->getValue(realName);
576             kDebug() << "SET VALUE: " << val;
577             namenode.item(i).toElement().setAttribute("keyframes", val);
578         } else if (type == "url") {
579             KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
580             setValue = req->url().path();
581         }
582         if (!setValue.isNull()) {
583             pa.attributes().namedItem("value").setNodeValue(setValue);
584         }
585     }
586     emit parameterChanged(oldparam, newparam);
587 }
588
589 void EffectStackEdit::createSliderItem(const QString& name, int val , int min, int max, const QString suffix)
590 {
591     QWidget* toFillin = new QWidget(m_baseWidget);
592     Constval *ctval = new Constval;
593     ctval->setupUi(toFillin);
594     ctval->horizontalSlider->setMinimum(min);
595     ctval->horizontalSlider->setMaximum(max);
596     if (!suffix.isEmpty()) ctval->spinBox->setSuffix(suffix);
597     ctval->spinBox->setMinimum(min);
598     ctval->spinBox->setMaximum(max);
599     ctval->horizontalSlider->setPageStep((int)(max - min) / 10);
600     ctval->horizontalSlider->setValue(val);
601     ctval->label->setText(name);
602     m_valueItems[name] = ctval;
603     m_uiItems.append(ctval);
604     connect(ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT(collectAllParameters()));
605     m_vbox->addWidget(toFillin);
606 }
607
608 void EffectStackEdit::slotSliderMoved(int)
609 {
610     collectAllParameters();
611 }
612
613 void EffectStackEdit::clearAllItems()
614 {
615     blockSignals(true);
616     m_valueItems.clear();
617     m_uiItems.clear();
618     /*while (!m_items.isEmpty()) {
619         QWidget *die = m_items.takeFirst();
620         die->disconnect();
621         delete die;
622     }*/
623     //qDeleteAll(m_uiItems);
624     QLayoutItem *child;
625     while ((child = m_vbox->takeAt(0)) != 0) {
626         QWidget *wid = child->widget();
627         delete child;
628         if (wid) delete wid;
629     }
630     m_keyframeEditor = NULL;
631     blockSignals(false);
632 }