- QDomElement list = pa.firstChildElement("paramlistdisplay");
- QStringList listitemsdisplay;
- if (!list.isNull()) {
- listitemsdisplay = i18n(list.text().toUtf8().data()).split(',');
- } else {
- listitemsdisplay = i18n(pa.attribute("paramlistdisplay").toUtf8().data()).split(',');
- }
- if (listitemsdisplay.count() != listitems.count())
- listitemsdisplay = listitems;
- lsval->list->setIconSize(QSize(30, 30));
- for (int i = 0; i < listitems.count(); i++) {
- lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
- QString entry = listitems.at(i);
- if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
- if (!EffectStackEdit::iconCache.contains(entry)) {
- QImage pix(entry);
- EffectStackEdit::iconCache[entry] = pix.scaled(30, 30);
- }
- lsval->list->setItemIcon(i, QPixmap::fromImage(iconCache[entry]));
- }
- }
- if (!value.isEmpty()) lsval->list->setCurrentIndex(listitems.indexOf(value));
- lsval->name->setText(paramName);
- lsval->labelComment->setText(comment);
- lsval->widgetComment->setHidden(true);
- m_valueItems[paramName] = lsval;
- connect(lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT(collectAllParameters()));
- if (!comment.isEmpty())
- connect(this, SIGNAL(showComments(bool)), lsval->widgetComment, SLOT(setVisible(bool)));
- m_uiItems.append(lsval);
- } else if (type == "bool") {
- Boolval *bval = new Boolval;
- bval->setupUi(toFillin);
- bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked);
- bval->name->setText(paramName);
- bval->labelComment->setText(comment);
- bval->widgetComment->setHidden(true);
- m_valueItems[paramName] = bval;
- connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters()));
- if (!comment.isEmpty())
- connect(this, SIGNAL(showComments(bool)), bval->widgetComment, SLOT(setVisible(bool)));
- m_uiItems.append(bval);
- } else if (type == "complex") {
- ComplexParameter *pl = new ComplexParameter;
- pl->setupParam(d, pa.attribute("name"), 0, 100);
- m_vbox->addWidget(pl);
- m_valueItems[paramName+"complex"] = pl;
- connect(pl, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- } else if (type == "geometry") {
- if (KdenliveSettings::on_monitor_effects()) {
- m_geometryWidget = new GeometryWidget(m_monitor, m_timecode, isEffect ? 0 : qMax(0, (int)info.startPos.frames(KdenliveSettings::project_fps())), isEffect, m_params.hasAttribute("showrotation"), this);
- m_geometryWidget->setFrameSize(m_frameSize);
- m_geometryWidget->slotShowScene(!disable);
- // connect this before setupParam to make sure the monitor scene shows up at startup
- connect(m_geometryWidget, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
- connect(m_geometryWidget, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- if (minFrame == maxFrame)
- m_geometryWidget->setupParam(pa, m_in, m_out);
- else
- m_geometryWidget->setupParam(pa, minFrame, maxFrame);
- m_vbox->addWidget(m_geometryWidget);
- m_valueItems[paramName+"geometry"] = m_geometryWidget;
- connect(m_geometryWidget, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
- connect(this, SIGNAL(syncEffectsPos(int)), m_geometryWidget, SLOT(slotSyncPosition(int)));
- connect(this, SIGNAL(effectStateChanged(bool)), m_geometryWidget, SLOT(slotShowScene(bool)));
- } else {
- Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, isEffect ? 0 : qMax(0, (int)info.startPos.frames(KdenliveSettings::project_fps())));
- if (minFrame == maxFrame)
- geo->setupParam(pa, m_in, m_out);
- else
- geo->setupParam(pa, minFrame, maxFrame);
- m_vbox->addWidget(geo);
- m_valueItems[paramName+"geometry"] = geo;
- connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
- connect(this, SIGNAL(syncEffectsPos(int)), geo, SLOT(slotSyncPosition(int)));
- }
- } else if (type == "addedgeometry") {
- // this is a parameter that should be linked to the geometry widget, for example rotation, shear, ...
- if (m_geometryWidget) m_geometryWidget->addParameter(pa);
- } else if (type == "keyframe" || type == "simplekeyframe") {
- // keyframe editor widget
- if (m_keyframeEditor == NULL) {
- KeyframeEdit *geo;
- if (pa.attribute("widget") == "corners") {
- // we want a corners-keyframe-widget
- CornersWidget *corners = new CornersWidget(m_monitor, pa, m_in, m_out, m_timecode, d.attribute("active_keyframe", "-1").toInt(), this);
- corners->slotShowScene(!disable);
- connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
- connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
- connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int)));
- geo = static_cast<KeyframeEdit *>(corners);
- } else {
- geo = new KeyframeEdit(pa, m_in, m_out, m_timecode, d.attribute("active_keyframe", "-1").toInt());
- }
- m_vbox->addWidget(geo);
- m_valueItems[paramName+"keyframe"] = geo;
- m_keyframeEditor = geo;
- connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
- connect(this, SIGNAL(showComments(bool)), geo, SIGNAL(showComments(bool)));
- } else {
- // we already have a keyframe editor, so just add another column for the new param
- m_keyframeEditor->addParameter(pa);
- }
- } else if (type == "color") {
- if (value.startsWith('#'))
- value = value.replace('#', "0x");
- bool ok;
- ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
- m_vbox->addWidget(choosecolor);
- m_valueItems[paramName] = choosecolor;
- connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
- connect(choosecolor, SIGNAL(modified()) , this, SLOT(collectAllParameters()));
- } else if (type == "position") {
- int pos = value.toInt();
- if (d.attribute("id") == "fadein" || d.attribute("id") == "fade_from_black") {
- pos = pos - m_in;
- } else if (d.attribute("id") == "fadeout" || d.attribute("id") == "fade_to_black") {
- // fadeout position starts from clip end
- pos = m_out - pos;