1 /***************************************************************************
2 effecstackedit.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_listval_ui.h"
20 #include "ui_boolval_ui.h"
21 #include "ui_wipeval_ui.h"
22 #include "ui_urlval_ui.h"
23 #include "complexparameter.h"
24 #include "geometryval.h"
25 #include "positionedit.h"
26 #include "projectlist.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 #include "choosecolorwidget.h"
33 #include "geometrywidget.h"
34 #include "colortools.h"
35 #include "doubleparameterwidget.h"
36 #include "cornerswidget.h"
37 #include "beziercurve/beziersplinewidget.h"
41 #include <KFileDialog>
43 #include <QVBoxLayout>
45 #include <QPushButton>
47 #include <QScrollArea>
50 class Boolval: public QWidget, public Ui::Boolval_UI
54 class Listval: public QWidget, public Ui::Listval_UI
58 class Wipeval: public QWidget, public Ui::Wipeval_UI
62 class Urlval: public QWidget, public Ui::Urlval_UI
66 QMap<QString, QImage> EffectStackEdit::iconCache;
68 EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
72 m_frameSize(QPoint()),
73 m_keyframeEditor(NULL),
76 m_baseWidget = new QWidget(this);
77 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
78 setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
79 setFrameStyle(QFrame::NoFrame);
80 setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
82 setWidget(m_baseWidget);
83 setWidgetResizable(true);
84 m_vbox = new QVBoxLayout(m_baseWidget);
85 m_vbox->setContentsMargins(0, 0, 0, 0);
86 m_vbox->setSpacing(0);
90 EffectStackEdit::~EffectStackEdit()
96 void EffectStackEdit::setFrameSize(QPoint p)
99 QDomNodeList namenode = m_params.elementsByTagName("parameter");
100 for (int i = 0; i < namenode.count() ; i++) {
101 QDomNode pa = namenode.item(i);
102 QDomNode na = pa.firstChildElement("name");
103 QString type = pa.attributes().namedItem("type").nodeValue();
104 QString paramName = i18n(na.toElement().text().toUtf8().data());
106 if (type == "geometry" && !KdenliveSettings::on_monitor_effects()) {
107 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
108 geom->setFrameSize(m_frameSize);
114 void EffectStackEdit::updateTimecodeFormat()
116 if (m_keyframeEditor)
117 m_keyframeEditor->updateTimecodeFormat();
119 QDomNodeList namenode = m_params.elementsByTagName("parameter");
120 for (int i = 0; i < namenode.count() ; i++) {
121 QDomNode pa = namenode.item(i);
122 QDomNode na = pa.firstChildElement("name");
123 QString type = pa.attributes().namedItem("type").nodeValue();
124 QString paramName = i18n(na.toElement().text().toUtf8().data());
126 if (type == "geometry") {
127 if (KdenliveSettings::on_monitor_effects()) {
128 GeometryWidget *geom = (GeometryWidget*)m_valueItems[paramName+"geometry"];
129 geom->updateTimecodeFormat();
131 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
132 geom->updateTimecodeFormat();
136 if (type == "position") {
137 PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
138 posi->updateTimecodeFormat();
144 void EffectStackEdit::meetDependency(const QString& name, QString type, QString value)
146 if (type == "curve") {
147 KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
149 int color = value.toInt();
150 curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)(color == 3 ? 4 : color), 0.8)));
152 } else if (type == "bezier_spline") {
153 BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems[name];
155 widget->setMode((BezierSplineWidget::CurveModes)((int)(value.toDouble() * 10)));
160 void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
166 void EffectStackEdit::updateParameter(const QString &name, const QString &value)
168 m_params.setAttribute(name, value);
170 if (name == "disable") {
171 // if effect is disabled, disable parameters widget
172 bool enabled = value.toInt() == 0 || !KdenliveSettings::disable_effect_parameters();
174 emit effectStateChanged(enabled);
178 void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, int out, bool isEffect)
181 if (m_keyframeEditor) delete m_keyframeEditor;
182 m_keyframeEditor = NULL;
186 if (m_params.isNull()) {
187 kDebug() << "// EMPTY EFFECT STACK";
191 QDomNodeList namenode = m_params.elementsByTagName("parameter");
192 QDomElement e = m_params.toElement();
193 const int minFrame = e.attribute("start").toInt();
194 const int maxFrame = e.attribute("end").toInt();
196 bool disable = d.attribute("disable") == "1" && KdenliveSettings::disable_effect_parameters();
197 setEnabled(!disable);
202 for (int i = 0; i < namenode.count() ; i++) {
203 QDomElement pa = namenode.item(i).toElement();
204 QDomElement na = pa.firstChildElement("name");
205 QDomElement commentElem = pa.firstChildElement("comment");
206 QString type = pa.attribute("type");
207 QString paramName = i18n(na.text().toUtf8().data());
209 if (!commentElem.isNull())
210 comment = i18n(commentElem.text().toUtf8().data());
211 QWidget * toFillin = new QWidget(m_baseWidget);
212 QString value = pa.attribute("value").isNull() ?
213 pa.attribute("default") : pa.attribute("value");
215 /** Currently supported parameter types are:
216 * constant (=double): a slider with an integer value (use the "factor" attribute to divide the value so that you can get a double
217 * list: a combobox containing a list of values to choose
219 * complex: designed for keyframe parameters, but old and not finished, do not use
220 * geometry: a rectangle that can be moved & resized, with possible keyframes, used in composite transition
221 * keyframe: a list widget with a list of entries (position and value)
222 * color: a color chooser button
223 * position: a slider representing the position of a frame in the current clip
224 * curve: a single curve representing multiple points
225 * wipe: a widget designed for the wipe transition, allowing to choose a position (left, right, top,...)
228 if (type == "double" || type == "constant") {
231 if (pa.attribute("min").startsWith('%'))
232 min = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
234 min = pa.attribute("min").toInt();
235 if (pa.attribute("max").startsWith('%'))
236 max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
238 max = pa.attribute("max").toInt();
240 DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, (int)(value.toDouble() + 0.5), min, max,
241 pa.attribute("default").toInt(), comment, pa.attribute("suffix"), this);
242 m_vbox->addWidget(doubleparam);
243 m_valueItems[paramName] = doubleparam;
244 connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
245 connect(this, SIGNAL(showComments()), doubleparam, SLOT(slotShowComment()));
246 } else if (type == "list") {
247 Listval *lsval = new Listval;
248 lsval->setupUi(toFillin);
249 QStringList listitems = pa.attribute("paramlist").split(',');
250 QDomElement list = pa.firstChildElement("paramlistdisplay");
251 QStringList listitemsdisplay;
252 if (!list.isNull()) listitemsdisplay = i18n(list.text().toUtf8().data()).split(',');
253 else listitemsdisplay = i18n(pa.attribute("paramlistdisplay").toUtf8().data()).split(',');
254 if (listitemsdisplay.count() != listitems.count())
255 listitemsdisplay = listitems;
256 lsval->list->setIconSize(QSize(30, 30));
257 for (int i = 0; i < listitems.count(); i++) {
258 lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
259 QString entry = listitems.at(i);
260 if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
261 if (!EffectStackEdit::iconCache.contains(entry)) {
263 EffectStackEdit::iconCache[entry] = pix.scaled(30, 30);
265 lsval->list->setItemIcon(i, QPixmap::fromImage(iconCache[entry]));
268 if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
269 lsval->name->setText(paramName);
270 m_valueItems[paramName] = lsval;
271 connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(collectAllParameters()));
272 m_uiItems.append(lsval);
273 } else if (type == "bool") {
274 Boolval *bval = new Boolval;
275 bval->setupUi(toFillin);
276 bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
277 bval->name->setText(paramName);
278 m_valueItems[paramName] = bval;
279 connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters()));
280 m_uiItems.append(bval);
281 } else if (type == "complex") {
282 ComplexParameter *pl = new ComplexParameter;
283 pl->setupParam(d, pa.attribute("name"), 0, 100);
284 m_vbox->addWidget(pl);
285 m_valueItems[paramName+"complex"] = pl;
286 connect(pl, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
287 } else if (type == "geometry") {
288 if (KdenliveSettings::on_monitor_effects()) {
289 GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
290 geometry->slotShowScene(!disable);
291 // connect this before setupParam to make sure the monitor scene shows up at startup
292 connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
293 connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
294 if (minFrame == maxFrame)
295 geometry->setupParam(pa, m_in, m_out);
297 geometry->setupParam(pa, minFrame, maxFrame);
298 m_vbox->addWidget(geometry);
299 m_valueItems[paramName+"geometry"] = geometry;
300 connect(geometry, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
301 connect(this, SIGNAL(syncEffectsPos(int)), geometry, SLOT(slotSyncPosition(int)));
302 connect(this, SIGNAL(effectStateChanged(bool)), geometry, SLOT(slotShowScene(bool)));
304 Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, pos);
305 if (minFrame == maxFrame)
306 geo->setupParam(pa, m_in, m_out);
308 geo->setupParam(pa, minFrame, maxFrame);
309 m_vbox->addWidget(geo);
310 m_valueItems[paramName+"geometry"] = geo;
311 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
312 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
313 connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
315 } else if (type == "keyframe" || type == "simplekeyframe") {
316 // keyframe editor widget
317 if (m_keyframeEditor == NULL) {
319 if (pa.attribute("widget") == "corners") {
320 // we want a corners-keyframe-widget
321 CornersWidget *corners = new CornersWidget(m_monitor, pa, m_in, m_in + m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt(), this);
322 corners->slotShowScene(!disable);
323 connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
324 connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
325 geo = static_cast<KeyframeEdit *>(corners);
327 geo = new KeyframeEdit(pa, m_in, m_in + m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt());
329 m_vbox->addWidget(geo);
330 m_valueItems[paramName+"keyframe"] = geo;
331 m_keyframeEditor = geo;
332 connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
333 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
334 connect(this, SIGNAL(showComments()), geo, SIGNAL(showComments()));
336 // we already have a keyframe editor, so just add another column for the new param
337 m_keyframeEditor->addParameter(pa);
339 } else if (type == "color") {
340 if (value.startsWith('#'))
341 value = value.replace('#', "0x");
343 ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
344 m_vbox->addWidget(choosecolor);
345 m_valueItems[paramName] = choosecolor;
346 connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
347 connect(choosecolor, SIGNAL(modified()) , this, SLOT(collectAllParameters()));
348 } else if (type == "position") {
349 int pos = value.toInt();
350 if (d.attribute("id") == "fadein" || d.attribute("id") == "fade_from_black") {
352 } else if (d.attribute("id") == "fadeout" || d.attribute("id") == "fade_to_black") {
353 // fadeout position starts from clip end
356 PositionEdit *posedit = new PositionEdit(paramName, pos, 0, m_out - m_in, m_timecode);
357 m_vbox->addWidget(posedit);
358 m_valueItems[paramName+"position"] = posedit;
359 connect(posedit, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
360 } else if (type == "curve") {
361 KisCurveWidget *curve = new KisCurveWidget(this);
362 curve->setMaxPoints(pa.attribute("max").toInt());
363 QList<QPointF> points;
364 int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
365 QString inName = pa.attribute("inpoints");
366 QString outName = pa.attribute("outpoints");
367 int start = pa.attribute("min").toInt();
368 for (int j = start; j <= number; j++) {
370 in.replace("%i", QString::number(j));
371 QString out = outName;
372 out.replace("%i", QString::number(j));
373 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
375 if (!points.isEmpty())
376 curve->setCurve(KisCubicCurve(points));
377 QSpinBox *spinin = new QSpinBox();
378 spinin->setRange(0, 1000);
379 QSpinBox *spinout = new QSpinBox();
380 spinout->setRange(0, 1000);
381 curve->setupInOutControls(spinin, spinout, 0, 1000);
382 m_vbox->addWidget(curve);
383 m_vbox->addWidget(spinin);
384 m_vbox->addWidget(spinout);
386 connect(curve, SIGNAL(modified()), this, SLOT(collectAllParameters()));
387 m_valueItems[paramName] = curve;
389 QString depends = pa.attribute("depends");
390 if (!depends.isEmpty())
391 meetDependency(paramName, type, EffectsList::parameter(e, depends));
392 } else if (type == "bezier_spline") {
393 BezierSplineWidget *widget = new BezierSplineWidget(value, this);
395 m_vbox->addWidget(widget);
396 m_valueItems[paramName] = widget;
397 connect(widget, SIGNAL(modified()), this, SLOT(collectAllParameters()));
398 QString depends = pa.attribute("depends");
399 if (!depends.isEmpty())
400 meetDependency(paramName, type, EffectsList::parameter(e, depends));
401 } else if (type == "wipe") {
402 Wipeval *wpval = new Wipeval;
403 wpval->setupUi(toFillin);
404 wipeInfo w = getWipeInfo(value);
407 wpval->start_up->setChecked(true);
410 wpval->start_down->setChecked(true);
413 wpval->start_right->setChecked(true);
416 wpval->start_left->setChecked(true);
419 wpval->start_center->setChecked(true);
424 wpval->end_up->setChecked(true);
427 wpval->end_down->setChecked(true);
430 wpval->end_right->setChecked(true);
433 wpval->end_left->setChecked(true);
436 wpval->end_center->setChecked(true);
439 wpval->start_transp->setValue(w.startTransparency);
440 wpval->end_transp->setValue(w.endTransparency);
441 m_valueItems[paramName] = wpval;
442 connect(wpval->end_up, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
443 connect(wpval->end_down, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
444 connect(wpval->end_left, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
445 connect(wpval->end_right, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
446 connect(wpval->end_center, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
447 connect(wpval->start_up, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
448 connect(wpval->start_down, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
449 connect(wpval->start_left, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
450 connect(wpval->start_right, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
451 connect(wpval->start_center, SIGNAL(clicked()), this, SLOT(collectAllParameters()));
452 connect(wpval->start_transp, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
453 connect(wpval->end_transp, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
454 //wpval->title->setTitle(na.toElement().text());
455 m_uiItems.append(wpval);
456 } else if (type == "url") {
457 Urlval *cval = new Urlval;
458 cval->setupUi(toFillin);
459 cval->label->setText(paramName);
460 cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
461 m_valueItems[paramName] = cval;
462 cval->urlwidget->setUrl(KUrl(value));
463 connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(collectAllParameters()));
464 connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(collectAllParameters()));
465 m_uiItems.append(cval);
472 m_vbox->addWidget(toFillin);
476 m_vbox->addStretch();
478 if (m_keyframeEditor)
479 m_keyframeEditor->checkVisibleParam();
482 wipeInfo EffectStackEdit::getWipeInfo(QString value)
485 QString start = value.section(';', 0, 0);
486 QString end = value.section(';', 1, 1).section('=', 1, 1);
488 if (start.startsWith("-100%,0"))
490 else if (start.startsWith("100%,0"))
492 else if (start.startsWith("0%,100%"))
494 else if (start.startsWith("0%,-100%"))
499 if (start.count(':') == 2)
500 info.startTransparency = start.section(':', -1).toInt();
502 info.startTransparency = 100;
504 if (end.startsWith("-100%,0"))
506 else if (end.startsWith("100%,0"))
508 else if (end.startsWith("0%,100%"))
510 else if (end.startsWith("0%,-100%"))
515 if (end.count(':') == 2)
516 info.endTransparency = end.section(':', -1).toInt();
518 info.endTransparency = 100;
523 QString EffectStackEdit::getWipeString(wipeInfo info)
528 switch (info.start) {
530 start = "-100%,0%:100%x100%";
533 start = "100%,0%:100%x100%";
536 start = "0%,100%:100%x100%";
539 start = "0%,-100%:100%x100%";
542 start = "0%,0%:100%x100%";
545 start.append(':' + QString::number(info.startTransparency));
549 end = "-100%,0%:100%x100%";
552 end = "100%,0%:100%x100%";
555 end = "0%,100%:100%x100%";
558 end = "0%,-100%:100%x100%";
561 end = "0%,0%:100%x100%";
564 end.append(':' + QString::number(info.endTransparency));
565 return QString(start + ";-1=" + end);
568 void EffectStackEdit::collectAllParameters()
570 if (m_valueItems.isEmpty() || m_params.isNull()) return;
571 const QDomElement oldparam = m_params.cloneNode().toElement();
572 QDomElement newparam = oldparam.cloneNode().toElement();
573 QDomNodeList namenode = newparam.elementsByTagName("parameter");
575 for (int i = 0; i < namenode.count() ; i++) {
576 QDomNode pa = namenode.item(i);
577 QDomNode na = pa.firstChildElement("name");
578 QString type = pa.attributes().namedItem("type").nodeValue();
579 QString paramName = i18n(na.toElement().text().toUtf8().data());
580 if (type == "complex")
581 paramName.append("complex");
582 else if (type == "position")
583 paramName.append("position");
584 else if (type == "geometry")
585 paramName.append("geometry");
586 else if (type == "keyframe")
587 paramName.append("keyframe");
588 if (type != "simplekeyframe" && !m_valueItems.contains(paramName)) {
589 kDebug() << "// Param: " << paramName << " NOT FOUND";
594 if (type == "double" || type == "constant") {
595 DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
596 setValue = QString::number(doubleparam->getValue());
597 } else if (type == "list") {
598 KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
599 setValue = box->itemData(box->currentIndex()).toString();
600 } else if (type == "bool") {
601 QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
602 setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
603 } else if (type == "color") {
604 ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
605 setValue = choosecolor->getColor().name();
606 } else if (type == "complex") {
607 ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
608 namenode.item(i) = complex->getParamDesc();
609 } else if (type == "geometry") {
610 if (KdenliveSettings::on_monitor_effects()) {
611 GeometryWidget *geometry = ((GeometryWidget*)m_valueItems.value(paramName));
612 namenode.item(i).toElement().setAttribute("value", geometry->getValue());
614 Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
615 namenode.item(i).toElement().setAttribute("value", geom->getValue());
617 } else if (type == "position") {
618 PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
619 int pos = pedit->getPosition();
620 setValue = QString::number(pos);
621 if (newparam.attribute("id") == "fadein" || newparam.attribute("id") == "fade_from_black") {
622 // Make sure duration is not longer than clip
625 pedit->setPosition(pos);
627 EffectsList::setParameter(newparam, "in", QString::number(m_in));
628 EffectsList::setParameter(newparam, "out", QString::number(m_in + pos));
630 } else if (newparam.attribute("id") == "fadeout" || newparam.attribute("id") == "fade_to_black") {
631 // Make sure duration is not longer than clip
634 pedit->setPosition(pos);
636 EffectsList::setParameter(newparam, "in", QString::number(m_out - pos));
637 EffectsList::setParameter(newparam, "out", QString::number(m_out));
640 } else if (type == "curve") {
641 KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
642 QList<QPointF> points = curve->curve().points();
643 QString number = pa.attributes().namedItem("number").nodeValue();
644 QString inName = pa.attributes().namedItem("inpoints").nodeValue();
645 QString outName = pa.attributes().namedItem("outpoints").nodeValue();
646 int off = pa.attributes().namedItem("min").nodeValue().toInt();
647 int end = pa.attributes().namedItem("max").nodeValue().toInt();
648 EffectsList::setParameter(newparam, number, QString::number(points.count()));
649 for (int j = 0; (j < points.count() && j + off <= end); j++) {
651 in.replace("%i", QString::number(j + off));
652 QString out = outName;
653 out.replace("%i", QString::number(j + off));
654 EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
655 EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
657 QString depends = pa.attributes().namedItem("depends").nodeValue();
658 if (!depends.isEmpty())
659 meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
660 } else if (type == "bezier_spline") {
661 BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems.value(paramName);
662 setValue = widget->spline();
663 QString depends = pa.attributes().namedItem("depends").nodeValue();
664 if (!depends.isEmpty())
665 meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
666 } else if (type == "wipe") {
667 Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
669 if (wp->start_left->isChecked())
671 else if (wp->start_right->isChecked())
673 else if (wp->start_up->isChecked())
675 else if (wp->start_down->isChecked())
677 else if (wp->start_center->isChecked())
681 info.startTransparency = wp->start_transp->value();
683 if (wp->end_left->isChecked())
685 else if (wp->end_right->isChecked())
687 else if (wp->end_up->isChecked())
689 else if (wp->end_down->isChecked())
691 else if (wp->end_center->isChecked())
695 info.endTransparency = wp->end_transp->value();
697 setValue = getWipeString(info);
698 } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
699 QDomElement elem = pa.toElement();
700 QString realName = i18n(na.toElement().text().toUtf8().data());
701 QString val = m_keyframeEditor->getValue(realName);
702 elem.setAttribute("keyframes", val);
704 if (m_keyframeEditor->isVisibleParam(realName))
705 elem.setAttribute("intimeline", "1");
706 else if (elem.hasAttribute("intimeline"))
707 elem.removeAttribute("intimeline");
708 } else if (type == "url") {
709 KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
710 setValue = req->url().path();
713 if (!setValue.isNull())
714 pa.attributes().namedItem("value").setNodeValue(setValue);
717 emit parameterChanged(oldparam, newparam);
720 void EffectStackEdit::clearAllItems()
723 m_valueItems.clear();
725 /*while (!m_items.isEmpty()) {
726 QWidget *die = m_items.takeFirst();
730 //qDeleteAll(m_uiItems);
732 while ((child = m_vbox->takeAt(0)) != 0) {
733 QWidget *wid = child->widget();
737 m_keyframeEditor = NULL;
741 void EffectStackEdit::slotSyncEffectsPos(int pos)
743 emit syncEffectsPos(pos);