1 /***************************************************************************
2 effecstackview.cpp - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
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 #include "geometrywidget.h"
35 #include "colortools.h"
39 #include <KFileDialog>
41 #include <QVBoxLayout>
44 #include <QPushButton>
46 #include <QScrollArea>
49 class Boolval: public QWidget, public Ui::Boolval_UI
53 class Constval: public QWidget, public Ui::Constval_UI
57 class Listval: public QWidget, public Ui::Listval_UI
61 class Wipeval: public QWidget, public Ui::Wipeval_UI
65 class Urlval: public QWidget, public Ui::Urlval_UI
69 QMap<QString, QImage> EffectStackEdit::iconCache;
71 EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
75 m_frameSize(QPoint()),
76 m_keyframeEditor(NULL),
79 m_baseWidget = new QWidget(this);
80 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
81 setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
82 setFrameStyle(QFrame::NoFrame);
83 setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
85 setWidget(m_baseWidget);
86 setWidgetResizable(true);
87 m_vbox = new QVBoxLayout(m_baseWidget);
88 m_vbox->setContentsMargins(0, 0, 0, 0);
89 m_vbox->setSpacing(0);
93 EffectStackEdit::~EffectStackEdit()
99 void EffectStackEdit::setFrameSize(QPoint p)
102 QDomNodeList namenode = m_params.elementsByTagName("parameter");
103 for (int i = 0; i < namenode.count() ; i++) {
104 QDomNode pa = namenode.item(i);
105 QDomNode na = pa.firstChildElement("name");
106 QString type = pa.attributes().namedItem("type").nodeValue();
107 QString paramName = i18n(na.toElement().text().toUtf8().data());
109 if (type == "geometry" && !KdenliveSettings::on_monitor_effects()) {
110 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
111 geom->setFrameSize(m_frameSize);
117 void EffectStackEdit::updateTimecodeFormat()
119 if (m_keyframeEditor)
120 m_keyframeEditor->updateTimecodeFormat();
121 QDomNodeList namenode = m_params.elementsByTagName("parameter");
122 for (int i = 0; i < namenode.count() ; i++) {
123 QDomNode pa = namenode.item(i);
124 QDomNode na = pa.firstChildElement("name");
125 QString type = pa.attributes().namedItem("type").nodeValue();
126 QString paramName = i18n(na.toElement().text().toUtf8().data());
128 if (type == "geometry") {
129 if (KdenliveSettings::on_monitor_effects()) {
130 GeometryWidget *geom = (GeometryWidget*)m_valueItems[paramName+"geometry"];
131 geom->updateTimecodeFormat();
133 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
134 geom->updateTimecodeFormat();
138 if (type == "position") {
139 PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
140 posi->updateTimecodeFormat();
146 void EffectStackEdit::meetDependency(const QString& name, QString type, QString value)
148 if (type == "curve") {
149 KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
151 int color = value.toInt();
153 curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)color)));
155 curve->setPixmap(QPixmap());
160 void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
166 void EffectStackEdit::updateParameter(const QString &name, const QString &value)
168 m_params.setAttribute(name, value);
171 void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, int out, bool isEffect)
174 if (m_keyframeEditor) delete m_keyframeEditor;
175 m_keyframeEditor = NULL;
179 if (m_params.isNull()) {
180 kDebug() << "// EMPTY EFFECT STACK";
185 doc.appendChild(doc.importNode(m_params, true));
186 kDebug() << "IMPORTED TRANS: " << doc.toString();*/
188 QDomNodeList namenode = m_params.elementsByTagName("parameter");
189 QDomElement e = m_params.toElement();
190 const int minFrame = e.attribute("start").toInt();
191 const int maxFrame = e.attribute("end").toInt();
194 for (int i = 0; i < namenode.count() ; i++) {
195 QDomElement pa = namenode.item(i).toElement();
196 QDomNode na = pa.firstChildElement("name");
197 QString type = pa.attribute("type");
198 QString paramName = i18n(na.toElement().text().toUtf8().data());
199 QWidget * toFillin = new QWidget(m_baseWidget);
200 QString value = pa.attribute("value").isNull() ?
201 pa.attribute("default") : pa.attribute("value");
203 /** Currently supported parameter types are:
204 * constant (=double): a slider with an integer value (use the "factor" attribute to divide the value so that you can get a double
205 * list: a combobox containing a list of values to choose
207 * complex: designed for keyframe parameters, but old and not finished, do not use
208 * geometry: a rectangle that can be moved & resized, with possible keyframes, used in composite transition
209 * keyframe: a list widget with a list of entries (position and value)
210 * color: a color chooser button
211 * position: a slider representing the position of a frame in the current clip
212 * curve: a single curve representing multiple points
213 * wipe: a widget designed for the wipe transition, allowing to choose a position (left, right, top,...)
216 if (type == "double" || type == "constant") {
219 if (pa.attribute("min").startsWith('%'))
220 min = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
222 min = pa.attribute("min").toInt();
223 if (pa.attribute("max").startsWith('%'))
224 max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
226 max = pa.attribute("max").toInt();
227 createSliderItem(paramName, (int)(value.toDouble() + 0.5) , min, max, pa.attribute("suffix", QString()));
230 } else if (type == "list") {
231 Listval *lsval = new Listval;
232 lsval->setupUi(toFillin);
233 QStringList listitems = pa.attribute("paramlist").split(',');
234 QStringList listitemsdisplay = pa.attribute("paramlistdisplay").split(',');
235 if (listitemsdisplay.count() != listitems.count()) listitemsdisplay = listitems;
236 //lsval->list->addItems(listitems);
237 lsval->list->setIconSize(QSize(30, 30));
238 for (int i = 0; i < listitems.count(); i++) {
239 lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
240 QString entry = listitems.at(i);
241 if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
242 if (!EffectStackEdit::iconCache.contains(entry)) {
244 EffectStackEdit::iconCache[entry] = pix.scaled(30, 30);
246 lsval->list->setItemIcon(i, QPixmap::fromImage(iconCache[entry]));
249 if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
250 lsval->title->setTitle(paramName);
251 m_valueItems[paramName] = lsval;
252 connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(collectAllParameters()));
253 m_uiItems.append(lsval);
254 } else if (type == "bool") {
255 Boolval *bval = new Boolval;
256 bval->setupUi(toFillin);
257 bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
258 bval->checkBox->setText(paramName);
259 m_valueItems[paramName] = bval;
260 connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters()));
261 m_uiItems.append(bval);
262 } else if (type == "complex") {
263 /*QStringList names=nodeAtts.namedItem("name").nodeValue().split(';');
264 QStringList max=nodeAtts.namedItem("max").nodeValue().split(';');
265 QStringList min=nodeAtts.namedItem("min").nodeValue().split(';');
266 QStringList val=value.split(';');
267 kDebug() << "in complex"<<names.size() << " " << max.size() << " " << min.size() << " " << val.size() ;
268 if ( (names.size() == max.size() ) &&
269 (names.size()== min.size()) &&
270 (names.size()== val.size()) )
272 for (int i=0;i< names.size();i++){
273 createSliderItem(names[i],val[i].toInt(),min[i].toInt(),max[i].toInt());
276 ComplexParameter *pl = new ComplexParameter;
277 pl->setupParam(d, pa.attribute("name"), 0, 100);
278 m_vbox->addWidget(pl);
279 m_valueItems[paramName+"complex"] = pl;
280 connect(pl, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
281 } else if (type == "geometry") {
282 if (KdenliveSettings::on_monitor_effects()) {
283 GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
284 if (minFrame == maxFrame)
285 geometry->setupParam(pa, m_in, m_out);
287 geometry->setupParam(pa, minFrame, maxFrame);
288 m_vbox->addWidget(geometry);
289 m_valueItems[paramName+"geometry"] = geometry;
290 connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
291 connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
292 connect(geometry, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
293 connect(this, SIGNAL(syncEffectsPos(int)), geometry, SLOT(slotSyncPosition(int)));
295 Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, pos);
296 if (minFrame == maxFrame)
297 geo->setupParam(pa, m_in, m_out);
299 geo->setupParam(pa, minFrame, maxFrame);
300 m_vbox->addWidget(geo);
301 m_valueItems[paramName+"geometry"] = geo;
302 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
303 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
304 connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
306 } else if (type == "keyframe" || type == "simplekeyframe") {
307 //Â keyframe editor widget
308 kDebug() << "min: " << m_in << ", MAX: " << m_out;
309 if (m_keyframeEditor == NULL) {
310 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());
311 m_vbox->addWidget(geo);
312 m_valueItems[paramName+"keyframe"] = geo;
313 m_keyframeEditor = geo;
314 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
315 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
317 // we already have a keyframe editor, so just add another column for the new param
318 m_keyframeEditor->addParameter(pa);
320 } else if (type == "color") {
321 if (value.startsWith('#'))
322 value = value.replace('#', "0x");
324 ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
325 m_vbox->addWidget(choosecolor);
326 m_valueItems[paramName] = choosecolor;
327 connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
328 connect(choosecolor, SIGNAL(modified()) , this, SLOT(collectAllParameters()));
329 } else if (type == "position") {
330 int pos = value.toInt();
331 if (d.attribute("id") == "fadein" || d.attribute("id") == "fade_from_black") {
333 } else if (d.attribute("id") == "fadeout" || d.attribute("id") == "fade_to_black") {
334 // fadeout position starts from clip end
335 pos = m_out - (pos - m_in);
337 PositionEdit *posedit = new PositionEdit(paramName, pos, 1, m_out, m_timecode);
338 m_vbox->addWidget(posedit);
339 m_valueItems[paramName+"position"] = posedit;
340 connect(posedit, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
341 } else if (type == "curve") {
342 KisCurveWidget *curve = new KisCurveWidget(this);
343 curve->setMaxPoints(pa.attribute("max").toInt());
344 QList<QPointF> points;
345 int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
346 QString inName = pa.attribute("inpoints");
347 QString outName = pa.attribute("outpoints");
348 int start = pa.attribute("min").toInt();
349 for (int j = start; j <= number; j++) {
351 in.replace("%i", QString::number(j));
352 QString out = outName;
353 out.replace("%i", QString::number(j));
354 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
356 if (!points.isEmpty())
357 curve->setCurve(KisCubicCurve(points));
358 QSpinBox *spinin = new QSpinBox();
359 spinin->setRange(0, 1000);
360 QSpinBox *spinout = new QSpinBox();
361 spinout->setRange(0, 1000);
362 curve->setupInOutControls(spinin, spinout, 0, 1000);
363 m_vbox->addWidget(curve);
364 m_vbox->addWidget(spinin);
365 m_vbox->addWidget(spinout);
367 connect(curve, SIGNAL(modified()), this, SLOT(collectAllParameters()));
368 m_valueItems[paramName] = curve;
370 QString depends = pa.attribute("depends");
371 if (!depends.isEmpty())
372 meetDependency(paramName, type, EffectsList::parameter(e, depends));
373 } else if (type == "wipe") {
374 Wipeval *wpval = new Wipeval;
375 wpval->setupUi(toFillin);
376 wipeInfo w = getWipeInfo(value);
379 wpval->start_up->setChecked(true);
382 wpval->start_down->setChecked(true);
385 wpval->start_right->setChecked(true);
388 wpval->start_left->setChecked(true);
391 wpval->start_center->setChecked(true);
396 wpval->end_up->setChecked(true);
399 wpval->end_down->setChecked(true);
402 wpval->end_right->setChecked(true);
405 wpval->end_left->setChecked(true);
408 wpval->end_center->setChecked(true);
411 wpval->start_transp->setValue(w.startTransparency);
412 wpval->end_transp->setValue(w.endTransparency);
413 m_valueItems[paramName] = wpval;
414 connect(wpval->end_up, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
415 connect(wpval->end_down, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
416 connect(wpval->end_left, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
417 connect(wpval->end_right, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
418 connect(wpval->end_center, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
419 connect(wpval->start_up, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
420 connect(wpval->start_down, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
421 connect(wpval->start_left, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
422 connect(wpval->start_right, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
423 connect(wpval->start_center, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
424 connect(wpval->start_transp, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
425 connect(wpval->end_transp, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
426 //wpval->title->setTitle(na.toElement().text());
427 m_uiItems.append(wpval);
428 } else if (type == "url") {
429 Urlval *cval = new Urlval;
430 cval->setupUi(toFillin);
431 cval->label->setText(paramName);
432 cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
433 m_valueItems[paramName] = cval;
434 cval->urlwidget->setUrl(KUrl(value));
435 connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(collectAllParameters()));
436 connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(collectAllParameters()));
437 m_uiItems.append(cval);
444 m_vbox->addWidget(toFillin);
446 m_vbox->addStretch();
449 wipeInfo EffectStackEdit::getWipeInfo(QString value)
452 QString start = value.section(';', 0, 0);
453 QString end = value.section(';', 1, 1).section('=', 1, 1);
455 if (start.startsWith("-100%,0"))
457 else if (start.startsWith("100%,0"))
459 else if (start.startsWith("0%,100%"))
461 else if (start.startsWith("0%,-100%"))
466 if (start.count(':') == 2)
467 info.startTransparency = start.section(':', -1).toInt();
469 info.startTransparency = 100;
471 if (end.startsWith("-100%,0"))
473 else if (end.startsWith("100%,0"))
475 else if (end.startsWith("0%,100%"))
477 else if (end.startsWith("0%,-100%"))
482 if (end.count(':') == 2)
483 info.endTransparency = end.section(':', -1).toInt();
485 info.endTransparency = 100;
490 QString EffectStackEdit::getWipeString(wipeInfo info)
495 switch (info.start) {
497 start = "-100%,0%:100%x100%";
500 start = "100%,0%:100%x100%";
503 start = "0%,100%:100%x100%";
506 start = "0%,-100%:100%x100%";
509 start = "0%,0%:100%x100%";
512 start.append(':' + QString::number(info.startTransparency));
516 end = "-100%,0%:100%x100%";
519 end = "100%,0%:100%x100%";
522 end = "0%,100%:100%x100%";
525 end = "0%,-100%:100%x100%";
528 end = "0%,0%:100%x100%";
531 end.append(':' + QString::number(info.endTransparency));
532 return QString(start + ";-1=" + end);
535 void EffectStackEdit::collectAllParameters()
537 if (m_valueItems.isEmpty() || m_params.isNull()) return;
538 const QDomElement oldparam = m_params.cloneNode().toElement();
539 QDomElement newparam = oldparam.cloneNode().toElement();
540 QDomNodeList namenode = newparam.elementsByTagName("parameter");
542 for (int i = 0; i < namenode.count() ; i++) {
543 QDomNode pa = namenode.item(i);
544 QDomNode na = pa.firstChildElement("name");
545 QString type = pa.attributes().namedItem("type").nodeValue();
546 QString paramName = i18n(na.toElement().text().toUtf8().data());
547 if (type == "complex")
548 paramName.append("complex");
549 else if (type == "position")
550 paramName.append("position");
551 else if (type == "geometry")
552 paramName.append("geometry");
553 else if (type == "keyframe")
554 paramName.append("keyframe");
555 if (type != "simplekeyframe" && !m_valueItems.contains(paramName)) {
556 kDebug() << "// Param: " << paramName << " NOT FOUND";
561 if (type == "double" || type == "constant") {
562 QSlider* slider = ((Constval*)m_valueItems.value(paramName))->horizontalSlider;
563 setValue = QString::number(slider->value());
564 } else if (type == "list") {
565 KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
566 setValue = box->itemData(box->currentIndex()).toString();
567 } else if (type == "bool") {
568 QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
569 setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
570 } else if (type == "color") {
571 ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
572 setValue = choosecolor->getColor().name();
573 } else if (type == "complex") {
574 ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
575 namenode.item(i) = complex->getParamDesc();
576 } else if (type == "geometry") {
577 if (KdenliveSettings::on_monitor_effects()) {
578 GeometryWidget *geometry = ((GeometryWidget*)m_valueItems.value(paramName));
579 namenode.item(i).toElement().setAttribute("value", geometry->getValue());
581 Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
582 namenode.item(i).toElement().setAttribute("value", geom->getValue());
584 } else if (type == "position") {
585 PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
586 int pos = pedit->getPosition();
587 setValue = QString::number(pos);
588 if (newparam.attribute("id") == "fadein" || newparam.attribute("id") == "fade_from_black") {
589 // Make sure duration is not longer than clip
592 pedit->setPosition(pos);
594 EffectsList::setParameter(newparam, "in", QString::number(m_in));
595 EffectsList::setParameter(newparam, "out", QString::number(m_in + pos));
597 } else if (newparam.attribute("id") == "fadeout" || newparam.attribute("id") == "fade_to_black") {
598 // Make sure duration is not longer than clip
601 pedit->setPosition(pos);
603 EffectsList::setParameter(newparam, "in", QString::number(m_out + m_in - pos));
604 EffectsList::setParameter(newparam, "out", QString::number(m_out + m_in));
607 } else if (type == "curve") {
608 KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
609 QList<QPointF> points = curve->curve().points();
610 QString number = pa.attributes().namedItem("number").nodeValue();
611 QString inName = pa.attributes().namedItem("inpoints").nodeValue();
612 QString outName = pa.attributes().namedItem("outpoints").nodeValue();
613 int off = pa.attributes().namedItem("min").nodeValue().toInt();
614 int end = pa.attributes().namedItem("max").nodeValue().toInt();
615 EffectsList::setParameter(newparam, number, QString::number(points.count()));
616 for (int j = 0; (j < points.count() && j + off <= end); j++) {
618 in.replace("%i", QString::number(j + off));
619 QString out = outName;
620 out.replace("%i", QString::number(j + off));
621 EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
622 EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
624 QString depends = pa.attributes().namedItem("depends").nodeValue();
625 if (!depends.isEmpty())
626 meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
627 } else if (type == "wipe") {
628 Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
630 if (wp->start_left->isChecked())
632 else if (wp->start_right->isChecked())
634 else if (wp->start_up->isChecked())
636 else if (wp->start_down->isChecked())
638 else if (wp->start_center->isChecked())
642 info.startTransparency = wp->start_transp->value();
644 if (wp->end_left->isChecked())
646 else if (wp->end_right->isChecked())
648 else if (wp->end_up->isChecked())
650 else if (wp->end_down->isChecked())
652 else if (wp->end_center->isChecked())
656 info.endTransparency = wp->end_transp->value();
658 setValue = getWipeString(info);
659 } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
660 QString realName = i18n(na.toElement().text().toUtf8().data());
661 QString val = m_keyframeEditor->getValue(realName);
662 kDebug() << "SET VALUE: " << val;
663 namenode.item(i).toElement().setAttribute("keyframes", val);
664 } else if (type == "url") {
665 KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
666 setValue = req->url().path();
669 if (!setValue.isNull())
670 pa.attributes().namedItem("value").setNodeValue(setValue);
673 emit parameterChanged(oldparam, newparam);
676 void EffectStackEdit::createSliderItem(const QString& name, int val , int min, int max, const QString suffix)
678 QWidget* toFillin = new QWidget(m_baseWidget);
679 Constval *ctval = new Constval;
680 ctval->setupUi(toFillin);
681 ctval->horizontalSlider->setMinimum(min);
682 ctval->horizontalSlider->setMaximum(max);
683 if (!suffix.isEmpty()) ctval->spinBox->setSuffix(suffix);
684 ctval->spinBox->setMinimum(min);
685 ctval->spinBox->setMaximum(max);
686 ctval->horizontalSlider->setPageStep((int)(max - min) / 10);
687 ctval->horizontalSlider->setValue(val);
688 ctval->label->setText(name);
689 m_valueItems[name] = ctval;
690 m_uiItems.append(ctval);
691 connect(ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT(collectAllParameters()));
692 m_vbox->addWidget(toFillin);
695 void EffectStackEdit::slotSliderMoved(int)
697 collectAllParameters();
700 void EffectStackEdit::clearAllItems()
703 m_valueItems.clear();
705 /*while (!m_items.isEmpty()) {
706 QWidget *die = m_items.takeFirst();
710 //qDeleteAll(m_uiItems);
712 while ((child = m_vbox->takeAt(0)) != 0) {
713 QWidget *wid = child->widget();
717 m_keyframeEditor = NULL;
721 void EffectStackEdit::slotSyncEffectsPos(int pos)
723 emit syncEffectsPos(pos);