1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
21 #include "collapsibleeffect.h"
23 #include "ui_listval_ui.h"
24 #include "ui_boolval_ui.h"
25 #include "ui_wipeval_ui.h"
26 #include "ui_urlval_ui.h"
27 #include "ui_keywordval_ui.h"
28 #include "ui_fontval_ui.h"
29 #include "complexparameter.h"
30 #include "geometryval.h"
31 #include "positionedit.h"
32 #include "projectlist.h"
33 #include "effectslist.h"
34 #include "kdenlivesettings.h"
35 #include "profilesdialog.h"
36 #include "kis_curve_widget.h"
37 #include "kis_cubic_curve.h"
38 #include "choosecolorwidget.h"
39 #include "geometrywidget.h"
40 #include "colortools.h"
41 #include "doubleparameterwidget.h"
42 #include "cornerswidget.h"
43 #include "dragvalue.h"
44 #include "beziercurve/beziersplinewidget.h"
46 #include "rotoscoping/rotowidget.h"
49 #include <QInputDialog>
52 #include <QVBoxLayout>
54 #include <KGlobalSettings>
56 #include <KMessageBox>
57 #include <KStandardDirs>
58 #include <KFileDialog>
59 #include <KUrlRequester>
61 class Boolval: public QWidget, public Ui::Boolval_UI
65 class Listval: public QWidget, public Ui::Listval_UI
69 class Wipeval: public QWidget, public Ui::Wipeval_UI
73 class Urlval: public QWidget, public Ui::Urlval_UI
77 class Keywordval: public QWidget, public Ui::Keywordval_UI
81 class Fontval: public QWidget, public Ui::Fontval_UI
85 QMap<QString, QImage> CollapsibleEffect::iconCache;
87 void clearLayout(QLayout *layout)
90 while((item = layout->takeAt(0))) {
92 clearLayout(item->layout());
93 delete item->layout();
96 delete item->widget();
102 MySpinBox::MySpinBox(QWidget * parent):
105 setFocusPolicy(Qt::StrongFocus);
108 void MySpinBox::focusInEvent(QFocusEvent*)
110 setFocusPolicy(Qt::WheelFocus);
113 void MySpinBox::focusOutEvent(QFocusEvent*)
115 setFocusPolicy(Qt::StrongFocus);
119 CollapsibleEffect::CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, int ix, EffectMetaInfo *metaInfo, bool lastEffect, bool isGroup, QWidget * parent) :
123 m_original_effect(original_effect),
124 m_lastEffect(lastEffect),
129 //setMouseTracking(true);
131 filterWheelEvent = true;
132 m_info.fromString(effect.attribute("kdenlive_info"));
133 frame->setBackgroundRole(QPalette::Midlight);
134 frame->setAutoFillBackground(true);
135 setFont(KGlobalSettings::smallestReadableFont());
137 buttonUp->setIcon(KIcon("go-up"));
138 buttonUp->setToolTip(i18n("Move effect up"));
140 buttonDown->setIcon(KIcon("go-down"));
141 buttonDown->setToolTip(i18n("Move effect down"));
143 buttonDel->setIcon(KIcon("edit-delete"));
144 buttonDel->setToolTip(i18n("Delete effect"));
146 buttonUp->setVisible(false);
147 buttonDown->setVisible(false);
148 buttonDel->setVisible(false);
150 /*buttonReset->setIcon(KIcon("view-refresh"));
151 buttonReset->setToolTip(i18n("Reset effect"));*/
152 //checkAll->setToolTip(i18n("Enable/Disable all effects"));
153 //buttonShowComments->setIcon(KIcon("help-about"));
154 //buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
156 m_menu->addAction(KIcon("view-refresh"), i18n("Reset effect"), this, SLOT(slotResetEffect()));
157 m_menu->addAction(KIcon("document-save"), i18n("Save effect"), this, SLOT(slotSaveEffect()));
160 QDomElement namenode = m_effect.firstChildElement("name");
161 if (namenode.isNull()) return;
162 title->setText(i18n(namenode.text().toUtf8().data()));
163 QString type = m_effect.attribute("type", QString());
165 if (type == "audio") icon = KIcon("kdenlive-show-audio");
166 else if (m_effect.attribute("tag") == "region") icon = KIcon("kdenlive-mask-effect");
167 else if (type == "custom") icon = KIcon("kdenlive-custom-effect");
168 else icon = KIcon("kdenlive-show-video");
169 title->setIcon(icon);
170 m_menu->addAction(KIcon("folder-new"), i18n("Create Group"), this, SLOT(slotCreateGroup()));
171 setupWidget(info, ix, metaInfo);
174 title->setText(i18n("Effect Group"));
175 title->setIcon(KIcon("folder"));
176 m_menu->addAction(KIcon("list-remove"), i18n("Ungroup"), this, SLOT(slotUnGroup()));
178 setAcceptDrops(true);
179 title->setMenu(m_menu);
181 if (m_effect.attribute("disable") == "1") {
182 enabledBox->setCheckState(Qt::Unchecked);
183 title->setEnabled(false);
186 enabledBox->setCheckState(Qt::Checked);
189 connect(collapseButton, SIGNAL(clicked()), this, SLOT(slotSwitch()));
190 connect(enabledBox, SIGNAL(toggled(bool)), this, SLOT(slotEnable(bool)));
191 connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotEffectUp()));
192 connect(buttonDown, SIGNAL(clicked()), this, SLOT(slotEffectDown()));
193 connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteEffect()));
195 Q_FOREACH( QSpinBox * sp, findChildren<QSpinBox*>() ) {
196 sp->installEventFilter( this );
197 sp->setFocusPolicy( Qt::StrongFocus );
199 Q_FOREACH( KComboBox * cb, findChildren<KComboBox*>() ) {
200 cb->installEventFilter( this );
201 cb->setFocusPolicy( Qt::StrongFocus );
203 Q_FOREACH( QProgressBar * cb, findChildren<QProgressBar*>() ) {
204 cb->installEventFilter( this );
205 cb->setFocusPolicy( Qt::StrongFocus );
209 CollapsibleEffect::~CollapsibleEffect()
211 if (m_paramWidget) delete m_paramWidget;
216 void CollapsibleEffect::slotCreateGroup()
218 emit createGroup(effectIndex());
221 void CollapsibleEffect::slotUnGroup()
226 bool CollapsibleEffect::eventFilter( QObject * o, QEvent * e )
228 if (e->type() == QEvent::Wheel) {
229 QWheelEvent *we = static_cast<QWheelEvent *>(e);
230 if (!filterWheelEvent || we->modifiers() != Qt::NoModifier) {
234 if (qobject_cast<QAbstractSpinBox*>(o)) {
235 if(qobject_cast<QAbstractSpinBox*>(o)->focusPolicy() == Qt::WheelFocus)
246 if (qobject_cast<KComboBox*>(o)) {
247 if(qobject_cast<KComboBox*>(o)->focusPolicy() == Qt::WheelFocus)
258 if (qobject_cast<QProgressBar*>(o)) {
259 if(qobject_cast<QProgressBar*>(o)->focusPolicy() == Qt::WheelFocus)
271 return QWidget::eventFilter(o, e);
274 QDomElement CollapsibleEffect::effect() const
279 bool CollapsibleEffect::isActive() const
284 void CollapsibleEffect::setActive(bool activate, bool focused)
288 frame->setBackgroundRole(QPalette::Highlight);
290 else frame->setBackgroundRole(m_active ? QPalette::Mid : QPalette::Midlight);
293 void CollapsibleEffect::mouseDoubleClickEvent ( QMouseEvent * event )
295 if (frame->underMouse() && collapseButton->isEnabled()) slotSwitch();
296 QWidget::mouseDoubleClickEvent(event);
299 void CollapsibleEffect::mousePressEvent ( QMouseEvent *event )
301 if (!m_active && !isGroup()) emit activateEffect(effectIndex());
302 QWidget::mousePressEvent(event);
305 void CollapsibleEffect::enterEvent ( QEvent * event )
307 if (m_paramWidget == NULL || m_paramWidget->index() > 0) buttonUp->setVisible(true);
308 if (!m_lastEffect) buttonDown->setVisible(true);
309 buttonDel->setVisible(true);
310 QWidget::enterEvent(event);
313 void CollapsibleEffect::leaveEvent ( QEvent * event )
315 buttonUp->setVisible(false);
316 buttonDown->setVisible(false);
317 buttonDel->setVisible(false);
318 QWidget::leaveEvent(event);
321 void CollapsibleEffect::slotEnable(bool enable)
323 title->setEnabled(enable);
324 enabledBox->blockSignals(true);
325 enabledBox->setChecked(enable);
326 enabledBox->blockSignals(false);
328 QVBoxLayout *vbox = static_cast<QVBoxLayout *>(widgetFrame->layout());
329 if (vbox == NULL) return;
330 for (int i = 0; i < vbox->count(); i++) {
331 CollapsibleEffect *e = static_cast<CollapsibleEffect *>(vbox->itemAt(i)->widget());
332 if (e) e->enabledBox->setChecked(enable);// slotEnable(enable);
335 m_effect.setAttribute("disable", enable ? 0 : 1);
336 if (enable || KdenliveSettings::disable_effect_parameters()) {
337 widgetFrame->setEnabled(enable);
339 emit effectStateChanged(!enable, effectIndex());
343 void CollapsibleEffect::slotDeleteEffect()
345 if (!m_isGroup) emit deleteEffect(m_effect);
348 void CollapsibleEffect::slotEffectUp()
350 if (!m_isGroup) emit changeEffectPosition(effectIndex(), true);
353 void CollapsibleEffect::slotEffectDown()
355 if (!m_isGroup) emit changeEffectPosition(effectIndex(), false);
358 void CollapsibleEffect::slotSaveEffect()
360 QString name = QInputDialog::getText(this, i18n("Save Effect"), i18n("Name for saved effect: "));
361 if (name.isEmpty()) return;
362 QString path = KStandardDirs::locateLocal("appdata", "effects/", true);
363 path = path + name + ".xml";
364 if (QFile::exists(path)) if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", path)) == KMessageBox::No) return;
367 QDomElement effect = m_effect.cloneNode().toElement();
368 doc.appendChild(doc.importNode(effect, true));
369 effect = doc.firstChild().toElement();
370 effect.removeAttribute("kdenlive_ix");
371 effect.setAttribute("id", name);
372 effect.setAttribute("type", "custom");
373 QDomElement effectname = effect.firstChildElement("name");
374 effect.removeChild(effectname);
375 effectname = doc.createElement("name");
376 QDomText nametext = doc.createTextNode(name);
377 effectname.appendChild(nametext);
378 effect.insertBefore(effectname, QDomNode());
379 QDomElement effectprops = effect.firstChildElement("properties");
380 effectprops.setAttribute("id", name);
381 effectprops.setAttribute("type", "custom");
384 if (file.open(QFile::WriteOnly | QFile::Truncate)) {
385 QTextStream out(&file);
386 out << doc.toString();
389 emit reloadEffects();
392 void CollapsibleEffect::slotResetEffect()
394 emit resetEffect(effectIndex());
397 void CollapsibleEffect::slotSwitch()
399 bool enable = !widgetFrame->isVisible();
403 void CollapsibleEffect::slotShow(bool show)
405 widgetFrame->setVisible(show);
407 collapseButton->setArrowType(Qt::DownArrow);
408 m_info.isCollapsed = false;
411 collapseButton->setArrowType(Qt::RightArrow);
412 m_info.isCollapsed = true;
414 m_effect.setAttribute("kdenlive_info", m_info.toString());
415 emit parameterChanged(m_original_effect, m_effect, effectIndex());
418 void CollapsibleEffect::updateGroupIndex(int groupIndex)
420 m_info.groupIndex = groupIndex;
421 m_effect.setAttribute("kdenlive_info", m_info.toString());
422 emit parameterChanged(m_original_effect, m_effect, effectIndex());
425 void CollapsibleEffect::setGroupIndex(int ix)
427 m_info.groupIndex = ix;
430 void CollapsibleEffect::addGroupEffect(CollapsibleEffect *effect)
432 QVBoxLayout *vbox = static_cast<QVBoxLayout *>(widgetFrame->layout());
434 vbox = new QVBoxLayout();
435 vbox->setContentsMargins(10, 0, 0, 0);
437 widgetFrame->setLayout(vbox);
439 effect->setGroupIndex(groupIndex());
440 vbox->addWidget(effect);
443 QString CollapsibleEffect::infoString() const
445 return m_info.toString();
448 void CollapsibleEffect::removeGroup(int ix, QVBoxLayout *layout)
450 QVBoxLayout *vbox = static_cast<QVBoxLayout *>(widgetFrame->layout());
451 if (vbox == NULL) return;
453 for (int j = vbox->count() - 1; j >= 0; j--) {
454 QLayoutItem *child = vbox->takeAt(j);
455 CollapsibleEffect *e = static_cast<CollapsibleEffect *>(child->widget());
456 layout->insertWidget(ix, e);
457 e->updateGroupIndex(-1);
462 int CollapsibleEffect::index() const
467 int CollapsibleEffect::groupIndex() const
469 if (m_isGroup) return m_index;
473 bool CollapsibleEffect::isGroup() const
478 int CollapsibleEffect::effectIndex() const
480 if (m_effect.isNull()) return -1;
481 return m_effect.attribute("kdenlive_ix").toInt();
484 void CollapsibleEffect::updateWidget(ItemInfo info, int index, QDomElement effect, EffectMetaInfo *metaInfo)
488 delete m_paramWidget;
489 m_paramWidget = NULL;
492 setupWidget(info, index, metaInfo);
495 void CollapsibleEffect::setupWidget(ItemInfo info, int index, EffectMetaInfo *metaInfo)
497 if (m_effect.isNull()) {
498 // kDebug() << "// EMPTY EFFECT STACK";
502 if (m_effect.attribute("tag") == "region") {
503 QVBoxLayout *vbox = new QVBoxLayout(widgetFrame);
504 vbox->setContentsMargins(0, 0, 0, 0);
506 QDomNodeList effects = m_effect.elementsByTagName("effect");
507 QDomNodeList origin_effects = m_original_effect.elementsByTagName("effect");
508 QWidget *container = new QWidget(widgetFrame);
509 vbox->addWidget(container);
510 m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, index, container);
511 for (int i = 0; i < effects.count(); i++) {
512 CollapsibleEffect *coll = new CollapsibleEffect(effects.at(i).toElement(), origin_effects.at(i).toElement(), info, i, metaInfo, container);
513 m_subParamWidgets.append(coll);
514 //container = new QWidget(widgetFrame);
515 vbox->addWidget(coll);
516 //p = new ParameterContainer(effects.at(i).toElement(), info, isEffect, container);
521 m_paramWidget = new ParameterContainer(m_effect, info, metaInfo, index, widgetFrame);
522 if (m_effect.firstChildElement("parameter").isNull()) {
523 // Effect has no parameter, don't allow expand
524 collapseButton->setEnabled(false);
525 widgetFrame->setVisible(false);
528 if (collapseButton->isEnabled() && m_info.isCollapsed) {
529 widgetFrame->setVisible(false);
530 collapseButton->setArrowType(Qt::RightArrow);
533 connect (m_paramWidget, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)));
535 connect(m_paramWidget, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)), this, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)));
537 connect (this, SIGNAL(syncEffectsPos(int)), m_paramWidget, SIGNAL(syncEffectsPos(int)));
538 connect (this, SIGNAL(effectStateChanged(bool)), m_paramWidget, SIGNAL(effectStateChanged(bool)));
539 connect (m_paramWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
540 connect (m_paramWidget, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int)));
545 void CollapsibleEffect::updateTimecodeFormat()
547 m_paramWidget->updateTimecodeFormat();
548 if (!m_subParamWidgets.isEmpty()) {
550 for (int i = 0; i < m_subParamWidgets.count(); i++)
551 m_subParamWidgets.at(i)->updateTimecodeFormat();
555 void CollapsibleEffect::slotSyncEffectsPos(int pos)
557 emit syncEffectsPos(pos);
560 void CollapsibleEffect::dragEnterEvent(QDragEnterEvent *event)
562 if (event->mimeData()->hasFormat("kdenlive/effectslist")) {
563 setActive(m_active, true);
564 event->acceptProposedAction();
568 void CollapsibleEffect::dragLeaveEvent(QDragLeaveEvent */*event*/)
570 setActive(m_active, false);
573 void CollapsibleEffect::dropEvent(QDropEvent *event)
575 const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
576 //event->acceptProposedAction();
578 doc.setContent(effects, true);
579 QDomElement e = doc.documentElement();
580 int ix = e.attribute("kdenlive_ix").toInt();
581 if (ix == effectIndex()) {
582 // effect dropped on itself, reject
587 // effect dropped from effects list, add it
588 e.setAttribute("kdenlive_ix", ix);
589 event->setDropAction(Qt::CopyAction);
596 QVBoxLayout *vbox = static_cast<QVBoxLayout *>(widgetFrame->layout());
597 if (vbox == NULL) return;
598 CollapsibleEffect *e = static_cast<CollapsibleEffect *>(vbox->itemAt(vbox->count() -1)->widget());
599 new_index = e->effectIndex() + 1;
602 new_index = effectIndex();
604 emit moveEffect(ix, new_index, this);
605 event->setDropAction(Qt::MoveAction);
609 ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, int index, QWidget * parent) :
611 m_keyframeEditor(NULL),
612 m_geometryWidget(NULL),
613 m_metaInfo(metaInfo),
616 m_in = info.cropStart.frames(KdenliveSettings::project_fps());
617 m_out = (info.cropStart + info.cropDuration).frames(KdenliveSettings::project_fps()) - 1;
619 QDomNodeList namenode = effect.childNodes(); //elementsByTagName("parameter");
621 QDomElement e = effect.toElement();
622 int minFrame = e.attribute("start").toInt();
623 int maxFrame = e.attribute("end").toInt();
624 // In transitions, maxFrame is in fact one frame after the end of transition
625 if (maxFrame > 0) maxFrame --;
627 bool disable = effect.attribute("disable") == "1" && KdenliveSettings::disable_effect_parameters();
628 parent->setEnabled(!disable);
631 m_vbox = new QVBoxLayout(parent);
632 m_vbox->setContentsMargins(0, 0, 0, 0);
633 m_vbox->setSpacing(2);
635 for (int i = 0; i < namenode.count() ; i++) {
636 QDomElement pa = namenode.item(i).toElement();
637 if (pa.tagName() != "parameter") continue;
638 QDomElement na = pa.firstChildElement("name");
639 QDomElement commentElem = pa.firstChildElement("comment");
640 QString type = pa.attribute("type");
641 QString paramName = na.isNull() ? pa.attribute("name") : i18n(na.text().toUtf8().data());
643 if (!commentElem.isNull())
644 comment = i18n(commentElem.text().toUtf8().data());
645 QWidget * toFillin = new QWidget(parent);
646 QString value = pa.attribute("value").isNull() ?
647 pa.attribute("default") : pa.attribute("value");
650 /** See effects/README for info on the different types */
652 if (type == "double" || type == "constant") {
655 if (pa.attribute("min").contains('%'))
656 min = ProfilesDialog::getStringEval(m_metaInfo->profile, pa.attribute("min"), m_metaInfo->frameSize);
658 min = pa.attribute("min").toDouble();
659 if (pa.attribute("max").contains('%'))
660 max = ProfilesDialog::getStringEval(m_metaInfo->profile, pa.attribute("max"), m_metaInfo->frameSize);
662 max = pa.attribute("max").toDouble();
664 DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, value.toDouble(), min, max,
665 pa.attribute("default").toDouble(), comment, -1, pa.attribute("suffix"), pa.attribute("decimals").toInt(), parent);
666 doubleparam->setFocusPolicy(Qt::StrongFocus);
667 m_vbox->addWidget(doubleparam);
668 m_valueItems[paramName] = doubleparam;
669 connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotCollectAllParameters()));
670 connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
671 } else if (type == "list") {
672 Listval *lsval = new Listval;
673 lsval->setupUi(toFillin);
674 lsval->list->setFocusPolicy(Qt::StrongFocus);
675 QStringList listitems = pa.attribute("paramlist").split(';');
676 if (listitems.count() == 1) {
677 // probably custom effect created before change to ';' as separator
678 listitems = pa.attribute("paramlist").split(",");
680 QDomElement list = pa.firstChildElement("paramlistdisplay");
681 QStringList listitemsdisplay;
682 if (!list.isNull()) {
683 listitemsdisplay = i18n(list.text().toUtf8().data()).split(',');
685 listitemsdisplay = i18n(pa.attribute("paramlistdisplay").toUtf8().data()).split(',');
687 if (listitemsdisplay.count() != listitems.count())
688 listitemsdisplay = listitems;
689 lsval->list->setIconSize(QSize(30, 30));
690 for (int i = 0; i < listitems.count(); i++) {
691 lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
692 QString entry = listitems.at(i);
693 if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
694 if (!CollapsibleEffect::iconCache.contains(entry)) {
696 CollapsibleEffect::iconCache[entry] = pix.scaled(30, 30);
698 lsval->list->setItemIcon(i, QPixmap::fromImage(CollapsibleEffect::iconCache[entry]));
701 if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
702 lsval->name->setText(paramName);
703 lsval->labelComment->setText(comment);
704 lsval->widgetComment->setHidden(true);
705 m_valueItems[paramName] = lsval;
706 connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(slotCollectAllParameters()));
707 if (!comment.isEmpty())
708 connect(this, SIGNAL(showComments(bool)), lsval->widgetComment, SLOT(setVisible(bool)));
709 m_uiItems.append(lsval);
710 } else if (type == "bool") {
711 Boolval *bval = new Boolval;
712 bval->setupUi(toFillin);
713 bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
714 bval->name->setText(paramName);
715 bval->labelComment->setText(comment);
716 bval->widgetComment->setHidden(true);
717 m_valueItems[paramName] = bval;
718 connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(slotCollectAllParameters()));
719 if (!comment.isEmpty())
720 connect(this, SIGNAL(showComments(bool)), bval->widgetComment, SLOT(setVisible(bool)));
721 m_uiItems.append(bval);
722 } else if (type == "complex") {
723 ComplexParameter *pl = new ComplexParameter;
724 pl->setupParam(effect, pa.attribute("name"), 0, 100);
725 m_vbox->addWidget(pl);
726 m_valueItems[paramName+"complex"] = pl;
727 connect(pl, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
728 } else if (type == "geometry") {
729 if (KdenliveSettings::on_monitor_effects()) {
730 m_geometryWidget = new GeometryWidget(m_metaInfo->monitor, m_metaInfo->timecode, 0, true, effect.hasAttribute("showrotation"), parent);
731 m_geometryWidget->setFrameSize(m_metaInfo->frameSize);
732 m_geometryWidget->slotShowScene(!disable);
733 // connect this before setupParam to make sure the monitor scene shows up at startup
734 connect(m_geometryWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
735 connect(m_geometryWidget, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
736 if (minFrame == maxFrame)
737 m_geometryWidget->setupParam(pa, m_in, m_out);
739 m_geometryWidget->setupParam(pa, minFrame, maxFrame);
740 m_vbox->addWidget(m_geometryWidget);
741 m_valueItems[paramName+"geometry"] = m_geometryWidget;
742 connect(m_geometryWidget, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
743 connect(this, SIGNAL(syncEffectsPos(int)), m_geometryWidget, SLOT(slotSyncPosition(int)));
744 connect(this, SIGNAL(effectStateChanged(bool)), m_geometryWidget, SLOT(slotShowScene(bool)));
746 Geometryval *geo = new Geometryval(m_metaInfo->profile, m_metaInfo->timecode, m_metaInfo->frameSize, 0);
747 if (minFrame == maxFrame)
748 geo->setupParam(pa, m_in, m_out);
750 geo->setupParam(pa, minFrame, maxFrame);
751 m_vbox->addWidget(geo);
752 m_valueItems[paramName+"geometry"] = geo;
753 connect(geo, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
754 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
755 connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
757 } else if (type == "addedgeometry") {
758 // this is a parameter that should be linked to the geometry widget, for example rotation, shear, ...
759 if (m_geometryWidget) m_geometryWidget->addParameter(pa);
760 } else if (type == "keyframe" || type == "simplekeyframe") {
761 // keyframe editor widget
762 if (m_keyframeEditor == NULL) {
764 if (pa.attribute("widget") == "corners") {
765 // we want a corners-keyframe-widget
766 CornersWidget *corners = new CornersWidget(m_metaInfo->monitor, pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt(), parent);
767 corners->slotShowScene(!disable);
768 connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
769 connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
770 connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int)));
771 geo = static_cast<KeyframeEdit *>(corners);
773 geo = new KeyframeEdit(pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt());
775 m_vbox->addWidget(geo);
776 m_valueItems[paramName+"keyframe"] = geo;
777 m_keyframeEditor = geo;
778 connect(geo, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
779 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
780 connect(this, SIGNAL(showComments(bool)), geo, SIGNAL(showComments(bool)));
782 // we already have a keyframe editor, so just add another column for the new param
783 m_keyframeEditor->addParameter(pa);
785 } else if (type == "color") {
786 if (value.startsWith('#'))
787 value = value.replace('#', "0x");
788 ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, parent);
789 m_vbox->addWidget(choosecolor);
790 m_valueItems[paramName] = choosecolor;
791 connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
792 connect(choosecolor, SIGNAL(modified()) , this, SLOT(slotCollectAllParameters()));
793 } else if (type == "position") {
794 int pos = value.toInt();
795 if (effect.attribute("id") == "fadein" || effect.attribute("id") == "fade_from_black") {
797 } else if (effect.attribute("id") == "fadeout" || effect.attribute("id") == "fade_to_black") {
798 // fadeout position starts from clip end
801 PositionEdit *posedit = new PositionEdit(paramName, pos, 0, m_out - m_in, m_metaInfo->timecode);
802 m_vbox->addWidget(posedit);
803 m_valueItems[paramName+"position"] = posedit;
804 connect(posedit, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
805 } else if (type == "curve") {
806 KisCurveWidget *curve = new KisCurveWidget(parent);
807 curve->setMaxPoints(pa.attribute("max").toInt());
808 QList<QPointF> points;
809 int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
810 QString inName = pa.attribute("inpoints");
811 QString outName = pa.attribute("outpoints");
812 int start = pa.attribute("min").toInt();
813 for (int j = start; j <= number; j++) {
815 in.replace("%i", QString::number(j));
816 QString out = outName;
817 out.replace("%i", QString::number(j));
818 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
820 if (!points.isEmpty())
821 curve->setCurve(KisCubicCurve(points));
822 MySpinBox *spinin = new MySpinBox();
823 spinin->setRange(0, 1000);
824 MySpinBox *spinout = new MySpinBox();
825 spinout->setRange(0, 1000);
826 curve->setupInOutControls(spinin, spinout, 0, 1000);
827 m_vbox->addWidget(curve);
828 m_vbox->addWidget(spinin);
829 m_vbox->addWidget(spinout);
831 connect(curve, SIGNAL(modified()), this, SLOT(slotCollectAllParameters()));
832 m_valueItems[paramName] = curve;
834 QString depends = pa.attribute("depends");
835 if (!depends.isEmpty())
836 meetDependency(paramName, type, EffectsList::parameter(e, depends));
837 } else if (type == "bezier_spline") {
838 BezierSplineWidget *widget = new BezierSplineWidget(value, parent);
840 m_vbox->addWidget(widget);
841 m_valueItems[paramName] = widget;
842 connect(widget, SIGNAL(modified()), this, SLOT(slotCollectAllParameters()));
843 QString depends = pa.attribute("depends");
844 if (!depends.isEmpty())
845 meetDependency(paramName, type, EffectsList::parameter(e, depends));
847 } else if (type == "roto-spline") {
848 RotoWidget *roto = new RotoWidget(value, m_metaInfo->monitor, info, m_metaInfo->timecode, parent);
849 roto->slotShowScene(!disable);
850 connect(roto, SIGNAL(valueChanged()), this, SLOT(slotCollectAllParameters()));
851 connect(roto, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
852 connect(roto, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
853 connect(this, SIGNAL(syncEffectsPos(int)), roto, SLOT(slotSyncPosition(int)));
854 connect(this, SIGNAL(effectStateChanged(bool)), roto, SLOT(slotShowScene(bool)));
855 m_vbox->addWidget(roto);
856 m_valueItems[paramName] = roto;
858 } else if (type == "wipe") {
859 Wipeval *wpval = new Wipeval;
860 wpval->setupUi(toFillin);
861 wipeInfo w = getWipeInfo(value);
864 wpval->start_up->setChecked(true);
867 wpval->start_down->setChecked(true);
870 wpval->start_right->setChecked(true);
873 wpval->start_left->setChecked(true);
876 wpval->start_center->setChecked(true);
881 wpval->end_up->setChecked(true);
884 wpval->end_down->setChecked(true);
887 wpval->end_right->setChecked(true);
890 wpval->end_left->setChecked(true);
893 wpval->end_center->setChecked(true);
896 wpval->start_transp->setValue(w.startTransparency);
897 wpval->end_transp->setValue(w.endTransparency);
898 m_valueItems[paramName] = wpval;
899 connect(wpval->end_up, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
900 connect(wpval->end_down, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
901 connect(wpval->end_left, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
902 connect(wpval->end_right, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
903 connect(wpval->end_center, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
904 connect(wpval->start_up, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
905 connect(wpval->start_down, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
906 connect(wpval->start_left, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
907 connect(wpval->start_right, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
908 connect(wpval->start_center, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
909 connect(wpval->start_transp, SIGNAL(valueChanged(int)), this, SLOT(slotCollectAllParameters()));
910 connect(wpval->end_transp, SIGNAL(valueChanged(int)), this, SLOT(slotCollectAllParameters()));
911 //wpval->title->setTitle(na.toElement().text());
912 m_uiItems.append(wpval);
913 } else if (type == "url") {
914 Urlval *cval = new Urlval;
915 cval->setupUi(toFillin);
916 cval->label->setText(paramName);
917 cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
918 m_valueItems[paramName] = cval;
919 cval->urlwidget->setUrl(KUrl(value));
920 connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(slotCollectAllParameters()));
921 connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(slotCollectAllParameters()));
922 m_uiItems.append(cval);
923 } else if (type == "keywords") {
924 Keywordval* kval = new Keywordval;
925 kval->setupUi(toFillin);
926 kval->label->setText(paramName);
927 kval->lineeditwidget->setText(value);
928 QDomElement klistelem = pa.firstChildElement("keywords");
929 QDomElement kdisplaylistelem = pa.firstChildElement("keywordsdisplay");
930 QStringList keywordlist;
931 QStringList keyworddisplaylist;
932 if (!klistelem.isNull()) {
933 keywordlist = klistelem.text().split(';');
934 keyworddisplaylist = i18n(kdisplaylistelem.text().toUtf8().data()).split(';');
936 if (keyworddisplaylist.count() != keywordlist.count()) {
937 keyworddisplaylist = keywordlist;
939 for (int i = 0; i < keywordlist.count(); i++) {
940 kval->comboboxwidget->addItem(keyworddisplaylist.at(i), keywordlist.at(i));
942 // Add disabled user prompt at index 0
943 kval->comboboxwidget->insertItem(0, i18n("<select a keyword>"), "");
944 kval->comboboxwidget->model()->setData( kval->comboboxwidget->model()->index(0,0), QVariant(Qt::NoItemFlags), Qt::UserRole -1);
945 kval->comboboxwidget->setCurrentIndex(0);
946 m_valueItems[paramName] = kval;
947 connect(kval->lineeditwidget, SIGNAL(editingFinished()) , this, SLOT(collectAllParameters()));
948 connect(kval->comboboxwidget, SIGNAL(activated (const QString&)), this, SLOT(collectAllParameters()));
949 m_uiItems.append(kval);
950 } else if (type == "fontfamily") {
951 Fontval* fval = new Fontval;
952 fval->setupUi(toFillin);
953 fval->name->setText(paramName);
954 fval->fontfamilywidget->setCurrentFont(QFont(value));
955 m_valueItems[paramName] = fval;
956 connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
957 m_uiItems.append(fval);
958 } else if (type == "filterjob") {
959 QVBoxLayout *l= new QVBoxLayout(toFillin);
960 QPushButton *button = new QPushButton(paramName, toFillin);
961 l->addWidget(button);
962 m_valueItems[paramName] = button;
963 connect(button, SIGNAL(pressed()), this, SLOT(slotStartFilterJobAction()));
970 m_vbox->addWidget(toFillin);
974 m_vbox->addStretch();
976 if (m_keyframeEditor)
977 m_keyframeEditor->checkVisibleParam();
979 // Make sure all doubleparam spinboxes have the same width, looks much better
980 QList<DoubleParameterWidget *> allWidgets = findChildren<DoubleParameterWidget *>();
982 for (int i = 0; i < allWidgets.count(); i++) {
983 if (minSize < allWidgets.at(i)->spinSize()) minSize = allWidgets.at(i)->spinSize();
985 for (int i = 0; i < allWidgets.count(); i++) {
986 allWidgets.at(i)->setSpinSize(minSize);
990 ParameterContainer::~ParameterContainer()
996 void ParameterContainer::meetDependency(const QString& name, QString type, QString value)
998 if (type == "curve") {
999 KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
1001 int color = value.toInt();
1002 curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)(color == 3 ? 4 : color), 0.8)));
1004 } else if (type == "bezier_spline") {
1005 BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems[name];
1007 widget->setMode((BezierSplineWidget::CurveModes)((int)(value.toDouble() * 10)));
1012 wipeInfo ParameterContainer::getWipeInfo(QString value)
1015 // Convert old geometry values that used a comma as separator
1016 if (value.contains(',')) value.replace(',','/');
1017 QString start = value.section(';', 0, 0);
1018 QString end = value.section(';', 1, 1).section('=', 1, 1);
1019 if (start.startsWith("-100%/0"))
1021 else if (start.startsWith("100%/0"))
1023 else if (start.startsWith("0%/100%"))
1025 else if (start.startsWith("0%/-100%"))
1028 info.start = CENTER;
1030 if (start.count(':') == 2)
1031 info.startTransparency = start.section(':', -1).toInt();
1033 info.startTransparency = 100;
1035 if (end.startsWith("-100%/0"))
1037 else if (end.startsWith("100%/0"))
1039 else if (end.startsWith("0%/100%"))
1041 else if (end.startsWith("0%/-100%"))
1046 if (end.count(':') == 2)
1047 info.endTransparency = end.section(':', -1).toInt();
1049 info.endTransparency = 100;
1054 void ParameterContainer::updateTimecodeFormat()
1056 if (m_keyframeEditor)
1057 m_keyframeEditor->updateTimecodeFormat();
1059 QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1060 for (int i = 0; i < namenode.count() ; i++) {
1061 QDomNode pa = namenode.item(i);
1062 QDomElement na = pa.firstChildElement("name");
1063 QString type = pa.attributes().namedItem("type").nodeValue();
1064 QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
1066 if (type == "geometry") {
1067 if (KdenliveSettings::on_monitor_effects()) {
1068 if (m_geometryWidget) m_geometryWidget->updateTimecodeFormat();
1070 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
1071 geom->updateTimecodeFormat();
1074 } else if (type == "position") {
1075 PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
1076 posi->updateTimecodeFormat();
1079 } else if (type == "roto-spline") {
1080 RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems[paramName]);
1081 widget->updateTimecodeFormat();
1087 void ParameterContainer::slotCollectAllParameters()
1089 if (m_valueItems.isEmpty() || m_effect.isNull()) return;
1091 locale.setNumberOptions(QLocale::OmitGroupSeparator);
1092 const QDomElement oldparam = m_effect.cloneNode().toElement();
1093 //QDomElement newparam = oldparam.cloneNode().toElement();
1094 QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1096 for (int i = 0; i < namenode.count() ; i++) {
1097 QDomNode pa = namenode.item(i);
1098 QDomElement na = pa.firstChildElement("name");
1099 QString type = pa.attributes().namedItem("type").nodeValue();
1100 QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
1101 if (type == "complex")
1102 paramName.append("complex");
1103 else if (type == "position")
1104 paramName.append("position");
1105 else if (type == "geometry")
1106 paramName.append("geometry");
1107 else if (type == "keyframe")
1108 paramName.append("keyframe");
1109 if (type != "simplekeyframe" && type != "fixed" && type != "addedgeometry" && !m_valueItems.contains(paramName)) {
1110 kDebug() << "// Param: " << paramName << " NOT FOUND";
1115 if (type == "double" || type == "constant") {
1116 DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
1117 setValue = locale.toString(doubleparam->getValue());
1118 } else if (type == "list") {
1119 KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
1120 setValue = box->itemData(box->currentIndex()).toString();
1121 } else if (type == "bool") {
1122 QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
1123 setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
1124 } else if (type == "color") {
1125 ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
1126 setValue = choosecolor->getColor();
1127 } else if (type == "complex") {
1128 ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
1129 namenode.item(i) = complex->getParamDesc();
1130 } else if (type == "geometry") {
1131 if (KdenliveSettings::on_monitor_effects()) {
1132 if (m_geometryWidget) namenode.item(i).toElement().setAttribute("value", m_geometryWidget->getValue());
1134 Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
1135 namenode.item(i).toElement().setAttribute("value", geom->getValue());
1137 } else if (type == "addedgeometry") {
1138 namenode.item(i).toElement().setAttribute("value", m_geometryWidget->getExtraValue(namenode.item(i).toElement().attribute("name")));
1139 } else if (type == "position") {
1140 PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
1141 int pos = pedit->getPosition();
1142 setValue = QString::number(pos);
1143 if (m_effect.attribute("id") == "fadein" || m_effect.attribute("id") == "fade_from_black") {
1144 // Make sure duration is not longer than clip
1145 /*if (pos > m_out) {
1147 pedit->setPosition(pos);
1149 EffectsList::setParameter(m_effect, "in", QString::number(m_in));
1150 EffectsList::setParameter(m_effect, "out", QString::number(m_in + pos));
1152 } else if (m_effect.attribute("id") == "fadeout" || m_effect.attribute("id") == "fade_to_black") {
1153 // Make sure duration is not longer than clip
1154 /*if (pos > m_out) {
1156 pedit->setPosition(pos);
1158 EffectsList::setParameter(m_effect, "in", QString::number(m_out - pos));
1159 EffectsList::setParameter(m_effect, "out", QString::number(m_out));
1162 } else if (type == "curve") {
1163 KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
1164 QList<QPointF> points = curve->curve().points();
1165 QString number = pa.attributes().namedItem("number").nodeValue();
1166 QString inName = pa.attributes().namedItem("inpoints").nodeValue();
1167 QString outName = pa.attributes().namedItem("outpoints").nodeValue();
1168 int off = pa.attributes().namedItem("min").nodeValue().toInt();
1169 int end = pa.attributes().namedItem("max").nodeValue().toInt();
1170 EffectsList::setParameter(m_effect, number, QString::number(points.count()));
1171 for (int j = 0; (j < points.count() && j + off <= end); j++) {
1172 QString in = inName;
1173 in.replace("%i", QString::number(j + off));
1174 QString out = outName;
1175 out.replace("%i", QString::number(j + off));
1176 EffectsList::setParameter(m_effect, in, locale.toString(points.at(j).x()));
1177 EffectsList::setParameter(m_effect, out, locale.toString(points.at(j).y()));
1179 QString depends = pa.attributes().namedItem("depends").nodeValue();
1180 if (!depends.isEmpty())
1181 meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
1182 } else if (type == "bezier_spline") {
1183 BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems.value(paramName);
1184 setValue = widget->spline();
1185 QString depends = pa.attributes().namedItem("depends").nodeValue();
1186 if (!depends.isEmpty())
1187 meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
1189 } else if (type == "roto-spline") {
1190 RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems.value(paramName));
1191 setValue = widget->getSpline();
1193 } else if (type == "wipe") {
1194 Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
1196 if (wp->start_left->isChecked())
1198 else if (wp->start_right->isChecked())
1200 else if (wp->start_up->isChecked())
1202 else if (wp->start_down->isChecked())
1204 else if (wp->start_center->isChecked())
1205 info.start = CENTER;
1208 info.startTransparency = wp->start_transp->value();
1210 if (wp->end_left->isChecked())
1212 else if (wp->end_right->isChecked())
1214 else if (wp->end_up->isChecked())
1216 else if (wp->end_down->isChecked())
1218 else if (wp->end_center->isChecked())
1222 info.endTransparency = wp->end_transp->value();
1224 setValue = getWipeString(info);
1225 } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
1226 QDomElement elem = pa.toElement();
1227 QString realName = i18n(na.toElement().text().toUtf8().data());
1228 QString val = m_keyframeEditor->getValue(realName);
1229 elem.setAttribute("keyframes", val);
1231 if (m_keyframeEditor->isVisibleParam(realName))
1232 elem.setAttribute("intimeline", "1");
1233 else if (elem.hasAttribute("intimeline"))
1234 elem.removeAttribute("intimeline");
1235 } else if (type == "url") {
1236 KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
1237 setValue = req->url().path();
1238 } else if (type == "keywords"){
1239 QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
1240 QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
1241 if(combo->currentIndex())
1243 QString comboval = combo->itemData(combo->currentIndex()).toString();
1244 line->insert(comboval);
1245 combo->setCurrentIndex(0);
1247 setValue = line->text();
1248 } else if (type == "fontfamily") {
1249 QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
1250 setValue = fontfamily->currentFont().family();
1252 if (!setValue.isNull())
1253 pa.attributes().namedItem("value").setNodeValue(setValue);
1256 emit parameterChanged(oldparam, m_effect, m_effect.attribute("kdenlive_ix").toInt());
1259 QString ParameterContainer::getWipeString(wipeInfo info)
1264 switch (info.start) {
1266 start = "-100%/0%:100%x100%";
1269 start = "100%/0%:100%x100%";
1272 start = "0%/100%:100%x100%";
1275 start = "0%/-100%:100%x100%";
1278 start = "0%/0%:100%x100%";
1281 start.append(':' + QString::number(info.startTransparency));
1285 end = "-100%/0%:100%x100%";
1288 end = "100%/0%:100%x100%";
1291 end = "0%/100%:100%x100%";
1294 end = "0%/-100%:100%x100%";
1297 end = "0%/0%:100%x100%";
1300 end.append(':' + QString::number(info.endTransparency));
1301 return QString(start + ";-1=" + end);
1304 int ParameterContainer::index() const
1309 void ParameterContainer::slotStartFilterJobAction()
1311 QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1312 for (int i = 0; i < namenode.count() ; i++) {
1313 QDomElement pa = namenode.item(i).toElement();
1314 QString type = pa.attribute("type");
1315 if (type == "filterjob") {
1316 emit startFilterJob(pa.attribute("filtertag"), pa.attribute("filterparams"), pa.attribute("finalfilter"), pa.attribute("consumer"), pa.attribute("consumerparams"), pa.attribute("wantedproperties"));
1317 kDebug()<<" - - -PROPS:\n"<<pa.attribute("filtertag")<<"-"<< pa.attribute("filterparams")<<"-"<< pa.attribute("consumer")<<"-"<< pa.attribute("consumerparams")<<"-"<< pa.attribute("wantedproperties");