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>
55 #include <KGlobalSettings>
57 #include <KMessageBox>
58 #include <KStandardDirs>
59 #include <KFileDialog>
60 #include <KUrlRequester>
61 #include <KColorScheme>
63 class Boolval: public QWidget, public Ui::Boolval_UI
67 class Listval: public QWidget, public Ui::Listval_UI
71 class Wipeval: public QWidget, public Ui::Wipeval_UI
75 class Urlval: public QWidget, public Ui::Urlval_UI
79 class Keywordval: public QWidget, public Ui::Keywordval_UI
83 class Fontval: public QWidget, public Ui::Fontval_UI
87 QMap<QString, QImage> CollapsibleEffect::iconCache;
89 void clearLayout(QLayout *layout)
92 while((item = layout->takeAt(0))) {
94 clearLayout(item->layout());
95 delete item->layout();
98 delete item->widget();
104 MySpinBox::MySpinBox(QWidget * parent):
107 setFocusPolicy(Qt::StrongFocus);
110 void MySpinBox::focusInEvent(QFocusEvent*)
112 setFocusPolicy(Qt::WheelFocus);
115 void MySpinBox::focusOutEvent(QFocusEvent*)
117 setFocusPolicy(Qt::StrongFocus);
121 CollapsibleEffect::CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent) :
122 AbstractCollapsibleWidget(parent),
125 m_original_effect(original_effect),
126 m_lastEffect(lastEffect)
129 filterWheelEvent = true;
130 m_info.fromString(effect.attribute("kdenlive_info"));
131 setFont(KGlobalSettings::smallestReadableFont());
133 buttonUp->setIcon(KIcon("kdenlive-up"));
134 buttonUp->setToolTip(i18n("Move effect up"));
136 buttonDown->setIcon(KIcon("kdenlive-down"));
137 buttonDown->setToolTip(i18n("Move effect down"));
139 buttonDel->setIcon(KIcon("kdenlive-deleffect"));
140 buttonDel->setToolTip(i18n("Delete effect"));
141 if (effectIndex() == 1) buttonUp->setVisible(false);
142 if (m_lastEffect) buttonDown->setVisible(false);
143 //buttonUp->setVisible(false);
144 //buttonDown->setVisible(false);
146 /*buttonReset->setIcon(KIcon("view-refresh"));
147 buttonReset->setToolTip(i18n("Reset effect"));*/
148 //checkAll->setToolTip(i18n("Enable/Disable all effects"));
149 //buttonShowComments->setIcon(KIcon("help-about"));
150 //buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
152 m_menu->addAction(KIcon("view-refresh"), i18n("Reset effect"), this, SLOT(slotResetEffect()));
153 m_menu->addAction(KIcon("document-save"), i18n("Save effect"), this, SLOT(slotSaveEffect()));
155 QDomElement namenode = m_effect.firstChildElement("name");
156 if (namenode.isNull()) return;
157 title->setText(i18n(namenode.text().toUtf8().data()));
158 QString type = m_effect.attribute("type", QString());
160 if (type == "audio") icon = KIcon("kdenlive-show-audio");
161 else if (m_effect.attribute("tag") == "region") icon = KIcon("kdenlive-mask-effect");
162 else if (type == "custom") icon = KIcon("kdenlive-custom-effect");
163 else icon = KIcon("kdenlive-show-video");
164 effecticon->setPixmap(icon.pixmap(16,16));
165 m_menu->addAction(KIcon("folder-new"), i18n("Create Group"), this, SLOT(slotCreateGroup()));
166 setupWidget(info, metaInfo);
168 setAcceptDrops(true);
169 menuButton->setIcon(KIcon("kdenlive-menu"));
170 menuButton->setMenu(m_menu);
172 if (m_effect.attribute("disable") == "1") {
173 title->setEnabled(false);
174 enabledBox->setChecked(false);
177 enabledBox->setChecked(true);
180 connect(collapseButton, SIGNAL(clicked()), this, SLOT(slotSwitch()));
181 connect(enabledBox, SIGNAL(toggled(bool)), this, SLOT(slotEnable(bool)));
182 connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotEffectUp()));
183 connect(buttonDown, SIGNAL(clicked()), this, SLOT(slotEffectDown()));
184 connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteEffect()));
186 Q_FOREACH( QSpinBox * sp, findChildren<QSpinBox*>() ) {
187 sp->installEventFilter( this );
188 sp->setFocusPolicy( Qt::StrongFocus );
190 Q_FOREACH( KComboBox * cb, findChildren<KComboBox*>() ) {
191 cb->installEventFilter( this );
192 cb->setFocusPolicy( Qt::StrongFocus );
194 Q_FOREACH( QProgressBar * cb, findChildren<QProgressBar*>() ) {
195 cb->installEventFilter( this );
196 cb->setFocusPolicy( Qt::StrongFocus );
200 CollapsibleEffect::~CollapsibleEffect()
202 if (m_paramWidget) delete m_paramWidget;
207 const QString CollapsibleEffect::getStyleSheet(QPalette p)
209 KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
210 QColor dark_bg = scheme.shade(KColorScheme::DarkShade);
211 QColor selected_bg = scheme.decoration(KColorScheme::FocusColor).color();
212 QColor hover_bg = scheme.decoration(KColorScheme::HoverColor).color();
213 QColor light_bg = scheme.shade(KColorScheme::LightShade);
214 QColor midlight_bg = scheme.shade(KColorScheme::MidlightShade);
215 QColor normal_bg = scheme.background(KColorScheme::AlternateBackground).color();
216 QColor alt_bg = scheme.background(KColorScheme::NormalBackground).color();
218 KColorScheme scheme2(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
219 QColor normal_bg2 = scheme2.background(KColorScheme::NormalBackground).color();
220 QColor normal_bg3 = scheme2.background(KColorScheme::AlternateBackground).color();
224 // group editable labels
225 stylesheet.append(QString("MyEditableLabel { background-color: transparent;} "));
228 stylesheet.append(QString("QFrame#decoframe {border-radius:5px;border:0px solid %1;background:%3;} QFrame:hover#decoframe {background:%4;} QFrame#decoframe[active=\"true\"] {background:%2;} ").arg(dark_bg.name()).arg(alt_bg.name()).arg(normal_bg2.name()).arg(normal_bg.name()));
230 // effect group background
231 stylesheet.append(QString("QFrame#decoframegroup {border-radius:5px;border:1px solid %1;background:%2;} QFrame#decoframegroup[active=\"true\"] {background:%3;} ").arg(dark_bg.name()).arg(normal_bg2.name()).arg(alt_bg.name()));
234 stylesheet.append(QString("QFrame#frame {border-radius: 5px;} QFrame#frame[active=\"true\"] {background:%1;}").arg(selected_bg.name()));
236 // group effect title bar
237 stylesheet.append(QString("QFrame#framegroup {border-radius: 5px; background: %2;} QFrame#framegroup[active=\"true\"] {background:%1;} ").arg(selected_bg.name()).arg(normal_bg3.name()));
239 // draggable effect content bar
240 stylesheet.append(QString("QProgressBar::chunk:horizontal {background: %1;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal#dragOnly {background: %2;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal:hover {background: %3;}").arg(normal_bg2.name()).arg(alt_bg.name()).arg(selected_bg.name()));
242 // draggable effect content bar
243 stylesheet.append(QString("QProgressBar:horizontal {border: 1px solid %1;border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right:0px;background:%4;padding: 0px;text-align:left center} QProgressBar:horizontal:disabled {border: 1px solid %5} QProgressBar:horizontal#dragOnly {background: %4} QProgressBar:horizontal[inTimeline=\"true\"] { border: 1px solid %2;border-right: 0px;background: %3;padding: 0px;text-align:left center } QProgressBar::chunk:horizontal[inTimeline=\"true\"] {background: %2;}").arg(dark_bg.name()).arg(hover_bg.name()).arg(light_bg.name()).arg(alt_bg.name()).arg(normal_bg2.name()));
246 // spin box for draggable widget
247 stylesheet.append(QString("QAbstractSpinBox#dragBox {border: 1px solid %1;border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QAbstractSpinBox::down-button#dragBox {width:0px;padding:0px;} QAbstractSpinBox:disabled#dragBox {border: 1px solid %4;} QAbstractSpinBox::up-button#dragBox {width:0px;padding:0px;} QAbstractSpinBox[inTimeline=\"true\"]#dragBox { border: 1px solid %2;} QAbstractSpinBox:hover#dragBox {border: 1px solid %3;} ").arg(dark_bg.name()).arg(hover_bg.name()).arg(selected_bg.name()).arg(normal_bg2.name()));
252 void CollapsibleEffect::slotCreateGroup()
254 emit createGroup(effectIndex());
257 void CollapsibleEffect::slotUnGroup()
262 bool CollapsibleEffect::eventFilter( QObject * o, QEvent * e )
264 if (e->type() == QEvent::Wheel) {
265 QWheelEvent *we = static_cast<QWheelEvent *>(e);
266 if (!filterWheelEvent || we->modifiers() != Qt::NoModifier) {
270 if (qobject_cast<QAbstractSpinBox*>(o)) {
271 if(qobject_cast<QAbstractSpinBox*>(o)->focusPolicy() == Qt::WheelFocus)
282 if (qobject_cast<KComboBox*>(o)) {
283 if(qobject_cast<KComboBox*>(o)->focusPolicy() == Qt::WheelFocus)
294 if (qobject_cast<QProgressBar*>(o)) {
295 if(qobject_cast<QProgressBar*>(o)->focusPolicy() == Qt::WheelFocus)
307 return QWidget::eventFilter(o, e);
310 QDomElement CollapsibleEffect::effect() const
315 bool CollapsibleEffect::isActive() const
317 return decoframe->property("active").toBool();
320 void CollapsibleEffect::setActive(bool activate)
322 decoframe->setProperty("active", activate);
323 decoframe->setStyleSheet(decoframe->styleSheet());
326 void CollapsibleEffect::mouseDoubleClickEvent ( QMouseEvent * event )
328 if (frame->underMouse() && collapseButton->isEnabled()) slotSwitch();
329 QWidget::mouseDoubleClickEvent(event);
332 void CollapsibleEffect::mousePressEvent ( QMouseEvent *event )
335 if (!decoframe->property("active").toBool() && !isGroup()) emit activateEffect(effectIndex());
336 QWidget::mousePressEvent(event);
340 void CollapsibleEffect::slotEnable(bool enable)
342 title->setEnabled(enable);
343 enabledBox->blockSignals(true);
344 enabledBox->setChecked(enable);
345 enabledBox->blockSignals(false);
346 m_effect.setAttribute("disable", enable ? 0 : 1);
347 if (enable || KdenliveSettings::disable_effect_parameters()) {
348 widgetFrame->setEnabled(enable);
350 emit effectStateChanged(!enable, effectIndex());
353 void CollapsibleEffect::slotDeleteEffect()
355 emit deleteEffect(m_effect);
358 void CollapsibleEffect::slotEffectUp()
360 emit changeEffectPosition(effectIndex(), true);
363 void CollapsibleEffect::slotEffectDown()
365 emit changeEffectPosition(effectIndex(), false);
368 void CollapsibleEffect::slotSaveEffect()
370 QString name = QInputDialog::getText(this, i18n("Save Effect"), i18n("Name for saved effect: "));
371 if (name.isEmpty()) return;
372 QString path = KStandardDirs::locateLocal("appdata", "effects/", true);
373 path = path + name + ".xml";
374 if (QFile::exists(path)) if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", path)) == KMessageBox::No) return;
377 QDomElement effect = m_effect.cloneNode().toElement();
378 doc.appendChild(doc.importNode(effect, true));
379 effect = doc.firstChild().toElement();
380 effect.removeAttribute("kdenlive_ix");
381 effect.setAttribute("id", name);
382 effect.setAttribute("type", "custom");
383 QDomElement effectname = effect.firstChildElement("name");
384 effect.removeChild(effectname);
385 effectname = doc.createElement("name");
386 QDomText nametext = doc.createTextNode(name);
387 effectname.appendChild(nametext);
388 effect.insertBefore(effectname, QDomNode());
389 QDomElement effectprops = effect.firstChildElement("properties");
390 effectprops.setAttribute("id", name);
391 effectprops.setAttribute("type", "custom");
394 if (file.open(QFile::WriteOnly | QFile::Truncate)) {
395 QTextStream out(&file);
396 out << doc.toString();
399 emit reloadEffects();
402 void CollapsibleEffect::slotResetEffect()
404 emit resetEffect(effectIndex());
407 void CollapsibleEffect::slotSwitch()
409 bool enable = !widgetFrame->isVisible();
413 void CollapsibleEffect::slotShow(bool show)
415 widgetFrame->setVisible(show);
417 collapseButton->setArrowType(Qt::DownArrow);
418 m_info.isCollapsed = false;
421 collapseButton->setArrowType(Qt::RightArrow);
422 m_info.isCollapsed = true;
424 m_effect.setAttribute("kdenlive_info", m_info.toString());
425 emit parameterChanged(m_original_effect, m_effect, effectIndex());
428 void CollapsibleEffect::updateGroupIndex(int groupIndex)
430 m_info.groupIndex = groupIndex;
431 m_effect.setAttribute("kdenlive_info", m_info.toString());
432 emit parameterChanged(m_original_effect, m_effect, effectIndex());
435 void CollapsibleEffect::setGroupIndex(int ix)
437 m_info.groupIndex = ix;
440 void CollapsibleEffect::setGroupName(const QString &groupName)
442 m_info.groupName = groupName;
445 QString CollapsibleEffect::infoString() const
447 return m_info.toString();
450 void CollapsibleEffect::removeGroup(int ix, QVBoxLayout *layout)
452 QVBoxLayout *vbox = static_cast<QVBoxLayout *>(widgetFrame->layout());
453 if (vbox == NULL) return;
455 for (int j = vbox->count() - 1; j >= 0; j--) {
456 QLayoutItem *child = vbox->takeAt(j);
457 CollapsibleEffect *e = static_cast<CollapsibleEffect *>(child->widget());
458 layout->insertWidget(ix, e);
459 e->updateGroupIndex(-1);
464 int CollapsibleEffect::groupIndex() const
466 return m_info.groupIndex;
469 int CollapsibleEffect::effectIndex() const
471 if (m_effect.isNull()) return -1;
472 return m_effect.attribute("kdenlive_ix").toInt();
475 void CollapsibleEffect::updateWidget(ItemInfo info, QDomElement effect, EffectMetaInfo *metaInfo)
479 delete m_paramWidget;
480 m_paramWidget = NULL;
483 setupWidget(info, metaInfo);
486 void CollapsibleEffect::setupWidget(ItemInfo info, EffectMetaInfo *metaInfo)
488 if (m_effect.isNull()) {
489 // kDebug() << "// EMPTY EFFECT STACK";
493 if (m_effect.attribute("tag") == "region") {
494 QVBoxLayout *vbox = new QVBoxLayout(widgetFrame);
495 vbox->setContentsMargins(2, 0, 2, 0);
497 QDomNodeList effects = m_effect.elementsByTagName("effect");
498 QDomNodeList origin_effects = m_original_effect.elementsByTagName("effect");
499 QWidget *container = new QWidget(widgetFrame);
500 vbox->addWidget(container);
501 m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, container);
502 for (int i = 0; i < effects.count(); i++) {
503 CollapsibleEffect *coll = new CollapsibleEffect(effects.at(i).toElement(), origin_effects.at(i).toElement(), info, metaInfo, container);
504 m_subParamWidgets.append(coll);
505 //container = new QWidget(widgetFrame);
506 vbox->addWidget(coll);
507 //p = new ParameterContainer(effects.at(i).toElement(), info, isEffect, container);
512 m_paramWidget = new ParameterContainer(m_effect, info, metaInfo, widgetFrame);
513 if (m_effect.firstChildElement("parameter").isNull()) {
514 // Effect has no parameter, don't allow expand
515 collapseButton->setEnabled(false);
516 collapseButton->setVisible(false);
517 widgetFrame->setVisible(false);
520 if (collapseButton->isEnabled() && m_info.isCollapsed) {
521 widgetFrame->setVisible(false);
522 collapseButton->setArrowType(Qt::RightArrow);
525 connect (m_paramWidget, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)));
527 connect(m_paramWidget, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)), this, SIGNAL(startFilterJob(QString,QString,QString,QString,QString,QString)));
529 connect (this, SIGNAL(syncEffectsPos(int)), m_paramWidget, SIGNAL(syncEffectsPos(int)));
530 connect (this, SIGNAL(effectStateChanged(bool)), m_paramWidget, SIGNAL(effectStateChanged(bool)));
531 connect (m_paramWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
532 connect (m_paramWidget, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int)));
537 bool CollapsibleEffect::isGroup() const
542 void CollapsibleEffect::updateTimecodeFormat()
544 m_paramWidget->updateTimecodeFormat();
545 if (!m_subParamWidgets.isEmpty()) {
547 for (int i = 0; i < m_subParamWidgets.count(); i++)
548 m_subParamWidgets.at(i)->updateTimecodeFormat();
552 void CollapsibleEffect::slotSyncEffectsPos(int pos)
554 emit syncEffectsPos(pos);
557 void CollapsibleEffect::dragEnterEvent(QDragEnterEvent *event)
559 if (event->mimeData()->hasFormat("kdenlive/effectslist")) {
560 frame->setProperty("active", true);
561 frame->setStyleSheet(frame->styleSheet());
562 event->acceptProposedAction();
566 void CollapsibleEffect::dragLeaveEvent(QDragLeaveEvent */*event*/)
568 frame->setProperty("active", false);
569 frame->setStyleSheet(frame->styleSheet());
572 void CollapsibleEffect::dropEvent(QDropEvent *event)
574 frame->setProperty("active", false);
575 frame->setStyleSheet(frame->styleSheet());
576 const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
577 //event->acceptProposedAction();
579 doc.setContent(effects, true);
580 QDomElement e = doc.documentElement();
581 int ix = e.attribute("kdenlive_ix").toInt();
582 if (ix == effectIndex()) {
583 // effect dropped on itself, reject
588 // effect dropped from effects list, add it
589 e.setAttribute("kdenlive_ix", ix);
590 event->setDropAction(Qt::CopyAction);
595 emit moveEffect(ix, effectIndex(), groupIndex());
596 event->setDropAction(Qt::MoveAction);
600 ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, QWidget * parent) :
601 m_keyframeEditor(NULL),
602 m_geometryWidget(NULL),
603 m_metaInfo(metaInfo),
606 m_in = info.cropStart.frames(KdenliveSettings::project_fps());
607 m_out = (info.cropStart + info.cropDuration).frames(KdenliveSettings::project_fps()) - 1;
609 QDomNodeList namenode = effect.childNodes(); //elementsByTagName("parameter");
611 QDomElement e = effect.toElement();
612 int minFrame = e.attribute("start").toInt();
613 int maxFrame = e.attribute("end").toInt();
614 // In transitions, maxFrame is in fact one frame after the end of transition
615 if (maxFrame > 0) maxFrame --;
617 bool disable = effect.attribute("disable") == "1" && KdenliveSettings::disable_effect_parameters();
618 parent->setEnabled(!disable);
621 m_vbox = new QVBoxLayout(parent);
622 m_vbox->setContentsMargins(2, 0, 2, 0);
623 m_vbox->setSpacing(2);
625 for (int i = 0; i < namenode.count() ; i++) {
626 QDomElement pa = namenode.item(i).toElement();
627 if (pa.tagName() != "parameter") continue;
628 QDomElement na = pa.firstChildElement("name");
629 QDomElement commentElem = pa.firstChildElement("comment");
630 QString type = pa.attribute("type");
631 QString paramName = na.isNull() ? pa.attribute("name") : i18n(na.text().toUtf8().data());
633 if (!commentElem.isNull())
634 comment = i18n(commentElem.text().toUtf8().data());
635 QWidget * toFillin = new QWidget(parent);
636 QString value = pa.attribute("value").isNull() ?
637 pa.attribute("default") : pa.attribute("value");
640 /** See effects/README for info on the different types */
642 if (type == "double" || type == "constant") {
645 if (pa.attribute("min").contains('%'))
646 min = ProfilesDialog::getStringEval(m_metaInfo->profile, pa.attribute("min"), m_metaInfo->frameSize);
648 min = pa.attribute("min").toDouble();
649 if (pa.attribute("max").contains('%'))
650 max = ProfilesDialog::getStringEval(m_metaInfo->profile, pa.attribute("max"), m_metaInfo->frameSize);
652 max = pa.attribute("max").toDouble();
654 DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, value.toDouble(), min, max,
655 pa.attribute("default").toDouble(), comment, -1, pa.attribute("suffix"), pa.attribute("decimals").toInt(), parent);
656 doubleparam->setFocusPolicy(Qt::StrongFocus);
657 m_vbox->addWidget(doubleparam);
658 m_valueItems[paramName] = doubleparam;
659 connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotCollectAllParameters()));
660 connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
661 } else if (type == "list") {
662 Listval *lsval = new Listval;
663 lsval->setupUi(toFillin);
664 lsval->list->setFocusPolicy(Qt::StrongFocus);
665 QStringList listitems = pa.attribute("paramlist").split(';');
666 if (listitems.count() == 1) {
667 // probably custom effect created before change to ';' as separator
668 listitems = pa.attribute("paramlist").split(",");
670 QDomElement list = pa.firstChildElement("paramlistdisplay");
671 QStringList listitemsdisplay;
672 if (!list.isNull()) {
673 listitemsdisplay = i18n(list.text().toUtf8().data()).split(',');
675 listitemsdisplay = i18n(pa.attribute("paramlistdisplay").toUtf8().data()).split(',');
677 if (listitemsdisplay.count() != listitems.count())
678 listitemsdisplay = listitems;
679 lsval->list->setIconSize(QSize(30, 30));
680 for (int i = 0; i < listitems.count(); i++) {
681 lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
682 QString entry = listitems.at(i);
683 if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
684 if (!CollapsibleEffect::iconCache.contains(entry)) {
686 CollapsibleEffect::iconCache[entry] = pix.scaled(30, 30);
688 lsval->list->setItemIcon(i, QPixmap::fromImage(CollapsibleEffect::iconCache[entry]));
691 if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
692 lsval->name->setText(paramName);
693 lsval->labelComment->setText(comment);
694 lsval->widgetComment->setHidden(true);
695 m_valueItems[paramName] = lsval;
696 connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(slotCollectAllParameters()));
697 if (!comment.isEmpty())
698 connect(this, SIGNAL(showComments(bool)), lsval->widgetComment, SLOT(setVisible(bool)));
699 m_uiItems.append(lsval);
700 } else if (type == "bool") {
701 Boolval *bval = new Boolval;
702 bval->setupUi(toFillin);
703 bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
704 bval->name->setText(paramName);
705 bval->labelComment->setText(comment);
706 bval->widgetComment->setHidden(true);
707 m_valueItems[paramName] = bval;
708 connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(slotCollectAllParameters()));
709 if (!comment.isEmpty())
710 connect(this, SIGNAL(showComments(bool)), bval->widgetComment, SLOT(setVisible(bool)));
711 m_uiItems.append(bval);
712 } else if (type == "complex") {
713 ComplexParameter *pl = new ComplexParameter;
714 pl->setupParam(effect, pa.attribute("name"), 0, 100);
715 m_vbox->addWidget(pl);
716 m_valueItems[paramName+"complex"] = pl;
717 connect(pl, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
718 } else if (type == "geometry") {
719 if (KdenliveSettings::on_monitor_effects()) {
720 m_geometryWidget = new GeometryWidget(m_metaInfo->monitor, m_metaInfo->timecode, 0, true, effect.hasAttribute("showrotation"), parent);
721 m_geometryWidget->setFrameSize(m_metaInfo->frameSize);
722 m_geometryWidget->slotShowScene(!disable);
723 // connect this before setupParam to make sure the monitor scene shows up at startup
724 connect(m_geometryWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
725 connect(m_geometryWidget, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
726 if (minFrame == maxFrame)
727 m_geometryWidget->setupParam(pa, m_in, m_out);
729 m_geometryWidget->setupParam(pa, minFrame, maxFrame);
730 m_vbox->addWidget(m_geometryWidget);
731 m_valueItems[paramName+"geometry"] = m_geometryWidget;
732 connect(m_geometryWidget, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
733 connect(this, SIGNAL(syncEffectsPos(int)), m_geometryWidget, SLOT(slotSyncPosition(int)));
734 connect(this, SIGNAL(effectStateChanged(bool)), m_geometryWidget, SLOT(slotShowScene(bool)));
736 Geometryval *geo = new Geometryval(m_metaInfo->profile, m_metaInfo->timecode, m_metaInfo->frameSize, 0);
737 if (minFrame == maxFrame)
738 geo->setupParam(pa, m_in, m_out);
740 geo->setupParam(pa, minFrame, maxFrame);
741 m_vbox->addWidget(geo);
742 m_valueItems[paramName+"geometry"] = geo;
743 connect(geo, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
744 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
745 connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
747 } else if (type == "addedgeometry") {
748 // this is a parameter that should be linked to the geometry widget, for example rotation, shear, ...
749 if (m_geometryWidget) m_geometryWidget->addParameter(pa);
750 } else if (type == "keyframe" || type == "simplekeyframe") {
751 // keyframe editor widget
752 if (m_keyframeEditor == NULL) {
754 if (pa.attribute("widget") == "corners") {
755 // we want a corners-keyframe-widget
756 CornersWidget *corners = new CornersWidget(m_metaInfo->monitor, pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt(), parent);
757 corners->slotShowScene(!disable);
758 connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
759 connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
760 connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int)));
761 geo = static_cast<KeyframeEdit *>(corners);
763 geo = new KeyframeEdit(pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt());
765 m_vbox->addWidget(geo);
766 m_valueItems[paramName+"keyframe"] = geo;
767 m_keyframeEditor = geo;
768 connect(geo, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
769 connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
770 connect(this, SIGNAL(showComments(bool)), geo, SIGNAL(showComments(bool)));
772 // we already have a keyframe editor, so just add another column for the new param
773 m_keyframeEditor->addParameter(pa);
775 } else if (type == "color") {
776 if (value.startsWith('#'))
777 value = value.replace('#', "0x");
778 ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, parent);
779 m_vbox->addWidget(choosecolor);
780 m_valueItems[paramName] = choosecolor;
781 connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
782 connect(choosecolor, SIGNAL(modified()) , this, SLOT(slotCollectAllParameters()));
783 } else if (type == "position") {
784 int pos = value.toInt();
785 if (effect.attribute("id") == "fadein" || effect.attribute("id") == "fade_from_black") {
787 } else if (effect.attribute("id") == "fadeout" || effect.attribute("id") == "fade_to_black") {
788 // fadeout position starts from clip end
791 PositionEdit *posedit = new PositionEdit(paramName, pos, 0, m_out - m_in, m_metaInfo->timecode);
792 m_vbox->addWidget(posedit);
793 m_valueItems[paramName+"position"] = posedit;
794 connect(posedit, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters()));
795 } else if (type == "curve") {
796 KisCurveWidget *curve = new KisCurveWidget(parent);
797 curve->setMaxPoints(pa.attribute("max").toInt());
798 QList<QPointF> points;
799 int number = EffectsList::parameter(e, pa.attribute("number")).toInt();
800 QString inName = pa.attribute("inpoints");
801 QString outName = pa.attribute("outpoints");
802 int start = pa.attribute("min").toInt();
803 for (int j = start; j <= number; j++) {
805 in.replace("%i", QString::number(j));
806 QString out = outName;
807 out.replace("%i", QString::number(j));
808 points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble());
810 if (!points.isEmpty())
811 curve->setCurve(KisCubicCurve(points));
812 MySpinBox *spinin = new MySpinBox();
813 spinin->setRange(0, 1000);
814 MySpinBox *spinout = new MySpinBox();
815 spinout->setRange(0, 1000);
816 curve->setupInOutControls(spinin, spinout, 0, 1000);
817 m_vbox->addWidget(curve);
818 m_vbox->addWidget(spinin);
819 m_vbox->addWidget(spinout);
821 connect(curve, SIGNAL(modified()), this, SLOT(slotCollectAllParameters()));
822 m_valueItems[paramName] = curve;
824 QString depends = pa.attribute("depends");
825 if (!depends.isEmpty())
826 meetDependency(paramName, type, EffectsList::parameter(e, depends));
827 } else if (type == "bezier_spline") {
828 BezierSplineWidget *widget = new BezierSplineWidget(value, parent);
830 m_vbox->addWidget(widget);
831 m_valueItems[paramName] = widget;
832 connect(widget, SIGNAL(modified()), this, SLOT(slotCollectAllParameters()));
833 QString depends = pa.attribute("depends");
834 if (!depends.isEmpty())
835 meetDependency(paramName, type, EffectsList::parameter(e, depends));
837 } else if (type == "roto-spline") {
838 RotoWidget *roto = new RotoWidget(value, m_metaInfo->monitor, info, m_metaInfo->timecode, parent);
839 roto->slotShowScene(!disable);
840 connect(roto, SIGNAL(valueChanged()), this, SLOT(slotCollectAllParameters()));
841 connect(roto, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
842 connect(roto, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
843 connect(this, SIGNAL(syncEffectsPos(int)), roto, SLOT(slotSyncPosition(int)));
844 connect(this, SIGNAL(effectStateChanged(bool)), roto, SLOT(slotShowScene(bool)));
845 m_vbox->addWidget(roto);
846 m_valueItems[paramName] = roto;
848 } else if (type == "wipe") {
849 Wipeval *wpval = new Wipeval;
850 wpval->setupUi(toFillin);
851 wipeInfo w = getWipeInfo(value);
854 wpval->start_up->setChecked(true);
857 wpval->start_down->setChecked(true);
860 wpval->start_right->setChecked(true);
863 wpval->start_left->setChecked(true);
866 wpval->start_center->setChecked(true);
871 wpval->end_up->setChecked(true);
874 wpval->end_down->setChecked(true);
877 wpval->end_right->setChecked(true);
880 wpval->end_left->setChecked(true);
883 wpval->end_center->setChecked(true);
886 wpval->start_transp->setValue(w.startTransparency);
887 wpval->end_transp->setValue(w.endTransparency);
888 m_valueItems[paramName] = wpval;
889 connect(wpval->end_up, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
890 connect(wpval->end_down, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
891 connect(wpval->end_left, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
892 connect(wpval->end_right, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
893 connect(wpval->end_center, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
894 connect(wpval->start_up, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
895 connect(wpval->start_down, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
896 connect(wpval->start_left, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
897 connect(wpval->start_right, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
898 connect(wpval->start_center, SIGNAL(clicked()), this, SLOT(slotCollectAllParameters()));
899 connect(wpval->start_transp, SIGNAL(valueChanged(int)), this, SLOT(slotCollectAllParameters()));
900 connect(wpval->end_transp, SIGNAL(valueChanged(int)), this, SLOT(slotCollectAllParameters()));
901 //wpval->title->setTitle(na.toElement().text());
902 m_uiItems.append(wpval);
903 } else if (type == "url") {
904 Urlval *cval = new Urlval;
905 cval->setupUi(toFillin);
906 cval->label->setText(paramName);
907 cval->urlwidget->fileDialog()->setFilter(ProjectList::getExtensions());
908 m_valueItems[paramName] = cval;
909 cval->urlwidget->setUrl(KUrl(value));
910 connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(slotCollectAllParameters()));
911 connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(slotCollectAllParameters()));
912 m_uiItems.append(cval);
913 } else if (type == "keywords") {
914 Keywordval* kval = new Keywordval;
915 kval->setupUi(toFillin);
916 kval->label->setText(paramName);
917 kval->lineeditwidget->setText(value);
918 QDomElement klistelem = pa.firstChildElement("keywords");
919 QDomElement kdisplaylistelem = pa.firstChildElement("keywordsdisplay");
920 QStringList keywordlist;
921 QStringList keyworddisplaylist;
922 if (!klistelem.isNull()) {
923 keywordlist = klistelem.text().split(';');
924 keyworddisplaylist = i18n(kdisplaylistelem.text().toUtf8().data()).split(';');
926 if (keyworddisplaylist.count() != keywordlist.count()) {
927 keyworddisplaylist = keywordlist;
929 for (int i = 0; i < keywordlist.count(); i++) {
930 kval->comboboxwidget->addItem(keyworddisplaylist.at(i), keywordlist.at(i));
932 // Add disabled user prompt at index 0
933 kval->comboboxwidget->insertItem(0, i18n("<select a keyword>"), "");
934 kval->comboboxwidget->model()->setData( kval->comboboxwidget->model()->index(0,0), QVariant(Qt::NoItemFlags), Qt::UserRole -1);
935 kval->comboboxwidget->setCurrentIndex(0);
936 m_valueItems[paramName] = kval;
937 connect(kval->lineeditwidget, SIGNAL(editingFinished()) , this, SLOT(collectAllParameters()));
938 connect(kval->comboboxwidget, SIGNAL(activated (const QString&)), this, SLOT(collectAllParameters()));
939 m_uiItems.append(kval);
940 } else if (type == "fontfamily") {
941 Fontval* fval = new Fontval;
942 fval->setupUi(toFillin);
943 fval->name->setText(paramName);
944 fval->fontfamilywidget->setCurrentFont(QFont(value));
945 m_valueItems[paramName] = fval;
946 connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
947 m_uiItems.append(fval);
948 } else if (type == "filterjob") {
949 QVBoxLayout *l= new QVBoxLayout(toFillin);
950 QPushButton *button = new QPushButton(paramName, toFillin);
951 l->addWidget(button);
952 m_valueItems[paramName] = button;
953 connect(button, SIGNAL(pressed()), this, SLOT(slotStartFilterJobAction()));
960 m_vbox->addWidget(toFillin);
964 m_vbox->addStretch();
966 if (m_keyframeEditor)
967 m_keyframeEditor->checkVisibleParam();
969 // Make sure all doubleparam spinboxes have the same width, looks much better
970 QList<DoubleParameterWidget *> allWidgets = findChildren<DoubleParameterWidget *>();
972 for (int i = 0; i < allWidgets.count(); i++) {
973 if (minSize < allWidgets.at(i)->spinSize()) minSize = allWidgets.at(i)->spinSize();
975 for (int i = 0; i < allWidgets.count(); i++) {
976 allWidgets.at(i)->setSpinSize(minSize);
980 ParameterContainer::~ParameterContainer()
986 void ParameterContainer::meetDependency(const QString& name, QString type, QString value)
988 if (type == "curve") {
989 KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
991 int color = value.toInt();
992 curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)(color == 3 ? 4 : color), 0.8)));
994 } else if (type == "bezier_spline") {
995 BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems[name];
997 widget->setMode((BezierSplineWidget::CurveModes)((int)(value.toDouble() * 10)));
1002 wipeInfo ParameterContainer::getWipeInfo(QString value)
1005 // Convert old geometry values that used a comma as separator
1006 if (value.contains(',')) value.replace(',','/');
1007 QString start = value.section(';', 0, 0);
1008 QString end = value.section(';', 1, 1).section('=', 1, 1);
1009 if (start.startsWith("-100%/0"))
1011 else if (start.startsWith("100%/0"))
1013 else if (start.startsWith("0%/100%"))
1015 else if (start.startsWith("0%/-100%"))
1018 info.start = CENTER;
1020 if (start.count(':') == 2)
1021 info.startTransparency = start.section(':', -1).toInt();
1023 info.startTransparency = 100;
1025 if (end.startsWith("-100%/0"))
1027 else if (end.startsWith("100%/0"))
1029 else if (end.startsWith("0%/100%"))
1031 else if (end.startsWith("0%/-100%"))
1036 if (end.count(':') == 2)
1037 info.endTransparency = end.section(':', -1).toInt();
1039 info.endTransparency = 100;
1044 void ParameterContainer::updateTimecodeFormat()
1046 if (m_keyframeEditor)
1047 m_keyframeEditor->updateTimecodeFormat();
1049 QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1050 for (int i = 0; i < namenode.count() ; i++) {
1051 QDomNode pa = namenode.item(i);
1052 QDomElement na = pa.firstChildElement("name");
1053 QString type = pa.attributes().namedItem("type").nodeValue();
1054 QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
1056 if (type == "geometry") {
1057 if (KdenliveSettings::on_monitor_effects()) {
1058 if (m_geometryWidget) m_geometryWidget->updateTimecodeFormat();
1060 Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
1061 geom->updateTimecodeFormat();
1064 } else if (type == "position") {
1065 PositionEdit *posi = ((PositionEdit*)m_valueItems[paramName+"position"]);
1066 posi->updateTimecodeFormat();
1069 } else if (type == "roto-spline") {
1070 RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems[paramName]);
1071 widget->updateTimecodeFormat();
1077 void ParameterContainer::slotCollectAllParameters()
1079 if (m_valueItems.isEmpty() || m_effect.isNull()) return;
1081 locale.setNumberOptions(QLocale::OmitGroupSeparator);
1082 const QDomElement oldparam = m_effect.cloneNode().toElement();
1083 //QDomElement newparam = oldparam.cloneNode().toElement();
1084 QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1086 for (int i = 0; i < namenode.count() ; i++) {
1087 QDomNode pa = namenode.item(i);
1088 QDomElement na = pa.firstChildElement("name");
1089 QString type = pa.attributes().namedItem("type").nodeValue();
1090 QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
1091 if (type == "complex")
1092 paramName.append("complex");
1093 else if (type == "position")
1094 paramName.append("position");
1095 else if (type == "geometry")
1096 paramName.append("geometry");
1097 else if (type == "keyframe")
1098 paramName.append("keyframe");
1099 if (type != "simplekeyframe" && type != "fixed" && type != "addedgeometry" && !m_valueItems.contains(paramName)) {
1100 kDebug() << "// Param: " << paramName << " NOT FOUND";
1105 if (type == "double" || type == "constant") {
1106 DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
1107 setValue = locale.toString(doubleparam->getValue());
1108 } else if (type == "list") {
1109 KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
1110 setValue = box->itemData(box->currentIndex()).toString();
1111 } else if (type == "bool") {
1112 QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
1113 setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
1114 } else if (type == "color") {
1115 ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
1116 setValue = choosecolor->getColor();
1117 } else if (type == "complex") {
1118 ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
1119 namenode.item(i) = complex->getParamDesc();
1120 } else if (type == "geometry") {
1121 if (KdenliveSettings::on_monitor_effects()) {
1122 if (m_geometryWidget) namenode.item(i).toElement().setAttribute("value", m_geometryWidget->getValue());
1124 Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
1125 namenode.item(i).toElement().setAttribute("value", geom->getValue());
1127 } else if (type == "addedgeometry") {
1128 namenode.item(i).toElement().setAttribute("value", m_geometryWidget->getExtraValue(namenode.item(i).toElement().attribute("name")));
1129 } else if (type == "position") {
1130 PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
1131 int pos = pedit->getPosition();
1132 setValue = QString::number(pos);
1133 if (m_effect.attribute("id") == "fadein" || m_effect.attribute("id") == "fade_from_black") {
1134 // Make sure duration is not longer than clip
1135 /*if (pos > m_out) {
1137 pedit->setPosition(pos);
1139 EffectsList::setParameter(m_effect, "in", QString::number(m_in));
1140 EffectsList::setParameter(m_effect, "out", QString::number(m_in + pos));
1142 } else if (m_effect.attribute("id") == "fadeout" || m_effect.attribute("id") == "fade_to_black") {
1143 // Make sure duration is not longer than clip
1144 /*if (pos > m_out) {
1146 pedit->setPosition(pos);
1148 EffectsList::setParameter(m_effect, "in", QString::number(m_out - pos));
1149 EffectsList::setParameter(m_effect, "out", QString::number(m_out));
1152 } else if (type == "curve") {
1153 KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
1154 QList<QPointF> points = curve->curve().points();
1155 QString number = pa.attributes().namedItem("number").nodeValue();
1156 QString inName = pa.attributes().namedItem("inpoints").nodeValue();
1157 QString outName = pa.attributes().namedItem("outpoints").nodeValue();
1158 int off = pa.attributes().namedItem("min").nodeValue().toInt();
1159 int end = pa.attributes().namedItem("max").nodeValue().toInt();
1160 EffectsList::setParameter(m_effect, number, QString::number(points.count()));
1161 for (int j = 0; (j < points.count() && j + off <= end); j++) {
1162 QString in = inName;
1163 in.replace("%i", QString::number(j + off));
1164 QString out = outName;
1165 out.replace("%i", QString::number(j + off));
1166 EffectsList::setParameter(m_effect, in, locale.toString(points.at(j).x()));
1167 EffectsList::setParameter(m_effect, out, locale.toString(points.at(j).y()));
1169 QString depends = pa.attributes().namedItem("depends").nodeValue();
1170 if (!depends.isEmpty())
1171 meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
1172 } else if (type == "bezier_spline") {
1173 BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems.value(paramName);
1174 setValue = widget->spline();
1175 QString depends = pa.attributes().namedItem("depends").nodeValue();
1176 if (!depends.isEmpty())
1177 meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
1179 } else if (type == "roto-spline") {
1180 RotoWidget *widget = static_cast<RotoWidget *>(m_valueItems.value(paramName));
1181 setValue = widget->getSpline();
1183 } else if (type == "wipe") {
1184 Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
1186 if (wp->start_left->isChecked())
1188 else if (wp->start_right->isChecked())
1190 else if (wp->start_up->isChecked())
1192 else if (wp->start_down->isChecked())
1194 else if (wp->start_center->isChecked())
1195 info.start = CENTER;
1198 info.startTransparency = wp->start_transp->value();
1200 if (wp->end_left->isChecked())
1202 else if (wp->end_right->isChecked())
1204 else if (wp->end_up->isChecked())
1206 else if (wp->end_down->isChecked())
1208 else if (wp->end_center->isChecked())
1212 info.endTransparency = wp->end_transp->value();
1214 setValue = getWipeString(info);
1215 } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
1216 QDomElement elem = pa.toElement();
1217 QString realName = i18n(na.toElement().text().toUtf8().data());
1218 QString val = m_keyframeEditor->getValue(realName);
1219 elem.setAttribute("keyframes", val);
1221 if (m_keyframeEditor->isVisibleParam(realName))
1222 elem.setAttribute("intimeline", "1");
1223 else if (elem.hasAttribute("intimeline"))
1224 elem.removeAttribute("intimeline");
1225 } else if (type == "url") {
1226 KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
1227 setValue = req->url().path();
1228 } else if (type == "keywords"){
1229 QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
1230 QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
1231 if(combo->currentIndex())
1233 QString comboval = combo->itemData(combo->currentIndex()).toString();
1234 line->insert(comboval);
1235 combo->setCurrentIndex(0);
1237 setValue = line->text();
1238 } else if (type == "fontfamily") {
1239 QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
1240 setValue = fontfamily->currentFont().family();
1242 if (!setValue.isNull())
1243 pa.attributes().namedItem("value").setNodeValue(setValue);
1246 emit parameterChanged(oldparam, m_effect, m_effect.attribute("kdenlive_ix").toInt());
1249 QString ParameterContainer::getWipeString(wipeInfo info)
1254 switch (info.start) {
1256 start = "-100%/0%:100%x100%";
1259 start = "100%/0%:100%x100%";
1262 start = "0%/100%:100%x100%";
1265 start = "0%/-100%:100%x100%";
1268 start = "0%/0%:100%x100%";
1271 start.append(':' + QString::number(info.startTransparency));
1275 end = "-100%/0%:100%x100%";
1278 end = "100%/0%:100%x100%";
1281 end = "0%/100%:100%x100%";
1284 end = "0%/-100%:100%x100%";
1287 end = "0%/0%:100%x100%";
1290 end.append(':' + QString::number(info.endTransparency));
1291 return QString(start + ";-1=" + end);
1294 void ParameterContainer::slotStartFilterJobAction()
1296 QDomNodeList namenode = m_effect.elementsByTagName("parameter");
1297 for (int i = 0; i < namenode.count() ; i++) {
1298 QDomElement pa = namenode.item(i).toElement();
1299 QString type = pa.attribute("type");
1300 if (type == "filterjob") {
1301 emit startFilterJob(pa.attribute("filtertag"), pa.attribute("filterparams"), pa.attribute("finalfilter"), pa.attribute("consumer"), pa.attribute("consumerparams"), pa.attribute("wantedproperties"));
1302 kDebug()<<" - - -PROPS:\n"<<pa.attribute("filtertag")<<"-"<< pa.attribute("filterparams")<<"-"<< pa.attribute("consumer")<<"-"<< pa.attribute("consumerparams")<<"-"<< pa.attribute("wantedproperties");