#include <KUrlRequester>
#include <KColorScheme>
#include <KColorUtils>
+#include <KApplication>
class Boolval: public QWidget, public Ui::Boolval_UI
{
m_paramWidget(NULL),
m_effect(effect),
m_original_effect(original_effect),
- m_lastEffect(lastEffect)
+ m_lastEffect(lastEffect),
+ m_regionEffect(false)
{
setupUi(this);
+ if (m_effect.attribute("tag") == "region") {
+ m_regionEffect = true;
+ decoframe->setObjectName("decoframegroup");
+ }
filterWheelEvent = true;
m_info.fromString(effect.attribute("kdenlive_info"));
setFont(KGlobalSettings::smallestReadableFont());
//buttonShowComments->setIcon(KIcon("help-about"));
//buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
m_menu = new QMenu;
+ if (m_regionEffect) m_menu->addAction(KIcon("document-new"), i18n("Change Region"), this, SLOT(slotResetEffect()));
m_menu->addAction(KIcon("view-refresh"), i18n("Reset Effect"), this, SLOT(slotResetEffect()));
m_menu->addAction(KIcon("document-save"), i18n("Save Effect"), this, SLOT(slotSaveEffect()));
QDomElement namenode = m_effect.firstChildElement("name");
if (namenode.isNull()) return;
- title->setText(i18n(namenode.text().toUtf8().data()));
+ QString effectname = i18n(namenode.text().toUtf8().data());
+ if (m_regionEffect) effectname.append(":" + KUrl(EffectsList::parameter(m_effect, "resource")).fileName());
+ title->setText(effectname);
/*
* Do not show icon, makes too much visual noise
QString type = m_effect.attribute("type", QString());
else icon = KIcon("kdenlive-show-video");
effecticon->setPixmap(icon.pixmap(16,16));*/
- m_menu->addAction(KIcon("folder-new"), i18n("Create Group"), this, SLOT(slotCreateGroup()));
+ if (!m_regionEffect) {
+ m_menu->addAction(KIcon("folder-new"), i18n("Create Group"), this, SLOT(slotCreateGroup()));
+ m_menu->addAction(KIcon("folder-new"), i18n("Create Region"), this, SLOT(slotCreateRegion()));
+ }
setupWidget(info, metaInfo);
setAcceptDrops(true);
menuButton->setIcon(KIcon("kdenlive-menu"));
emit createGroup(effectIndex());
}
+void CollapsibleEffect::slotCreateRegion()
+{
+ QString allExtensions = ProjectList::getExtensions();
+ const QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files");
+ KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow());
+ d->setOperationMode(KFileDialog::Opening);
+ d->setMode(KFile::File);
+ if (d->exec() == QDialog::Accepted) {
+ KUrl url = d->selectedUrl();
+ if (!url.isEmpty()) emit createRegion(effectIndex(), url);
+ }
+ delete d;
+}
+
void CollapsibleEffect::slotUnGroup()
{
emit unGroup(this);
}
if (m_effect.attribute("tag") == "region") {
+ m_regionEffect = true;
QVBoxLayout *vbox = new QVBoxLayout(widgetFrame);
vbox->setContentsMargins(0, 0, 0, 0);
vbox->setSpacing(2);
QDomNodeList origin_effects = m_original_effect.elementsByTagName("effect");
QWidget *container = new QWidget(widgetFrame);
vbox->addWidget(container);
- m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, container);
+ // m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, container);
for (int i = 0; i < effects.count(); i++) {
CollapsibleEffect *coll = new CollapsibleEffect(effects.at(i).toElement(), origin_effects.at(i).toElement(), info, metaInfo, container);
m_subParamWidgets.append(coll);
+ connect(coll, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this , SLOT(slotUpdateRegionEffectParams(const QDomElement, const QDomElement, int)));
//container = new QWidget(widgetFrame);
vbox->addWidget(coll);
//p = new ParameterContainer(effects.at(i).toElement(), info, isEffect, container);
}
}
+void CollapsibleEffect::slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/)
+{
+ kDebug()<<"// EMIT CHANGE SUBEFFECT.....:";
+ emit parameterChanged(m_original_effect, m_effect, effectIndex());
+}
+
void CollapsibleEffect::slotSyncEffectsPos(int pos)
{
emit syncEffectsPos(pos);
m_keyframeEditor->addParameter(pa);
}
} else if (type == "color") {
+ if (pa.hasAttribute("paramprefix")) value.remove(0, pa.attribute("paramprefix").size());
if (value.startsWith('#'))
value = value.replace('#', "0x");
ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, parent);
+ choosecolor->setAlphaChannelEnabled(true);
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
QDomNodeList namenode = m_effect.elementsByTagName("parameter");
for (int i = 0; i < namenode.count() ; i++) {
- QDomNode pa = namenode.item(i);
+ QDomElement pa = namenode.item(i).toElement();
QDomElement na = pa.firstChildElement("name");
- QString type = pa.attributes().namedItem("type").nodeValue();
- QString paramName = na.isNull() ? pa.attributes().namedItem("name").nodeValue() : i18n(na.text().toUtf8().data());
+ QString type = pa.attribute("type");
+ QString paramName = na.isNull() ? pa.attribute("name") : i18n(na.text().toUtf8().data());
if (type == "complex")
paramName.append("complex");
else if (type == "position")
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
setValue = choosecolor->getColor();
+ if (pa.hasAttribute("paramprefix")) setValue.prepend(pa.attribute("paramprefix"));
} else if (type == "complex") {
ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
namenode.item(i) = complex->getParamDesc();
} else if (type == "curve") {
KisCurveWidget *curve = ((KisCurveWidget*)m_valueItems.value(paramName));
QList<QPointF> points = curve->curve().points();
- QString number = pa.attributes().namedItem("number").nodeValue();
- QString inName = pa.attributes().namedItem("inpoints").nodeValue();
- QString outName = pa.attributes().namedItem("outpoints").nodeValue();
- int off = pa.attributes().namedItem("min").nodeValue().toInt();
- int end = pa.attributes().namedItem("max").nodeValue().toInt();
+ QString number = pa.attribute("number");
+ QString inName = pa.attribute("inpoints");
+ QString outName = pa.attribute("outpoints");
+ int off = pa.attribute("min").toInt();
+ int end = pa.attribute("max").toInt();
if (oldparam.attribute("version").toDouble() > 0.2) {
EffectsList::setParameter(m_effect, number, locale.toString(points.count() / 10.));
} else {
EffectsList::setParameter(m_effect, in, locale.toString(points.at(j).x()));
EffectsList::setParameter(m_effect, out, locale.toString(points.at(j).y()));
}
- QString depends = pa.attributes().namedItem("depends").nodeValue();
+ QString depends = pa.attribute("depends");
if (!depends.isEmpty())
meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
} else if (type == "bezier_spline") {
BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems.value(paramName);
setValue = widget->spline();
- QString depends = pa.attributes().namedItem("depends").nodeValue();
+ QString depends = pa.attribute("depends");
if (!depends.isEmpty())
meetDependency(paramName, type, EffectsList::parameter(m_effect, depends));
#ifdef USE_QJSON
setValue = getWipeString(info);
} else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
- QDomElement elem = pa.toElement();
QString realName = i18n(na.toElement().text().toUtf8().data());
QString val = m_keyframeEditor->getValue(realName);
- elem.setAttribute("keyframes", val);
+ pa.setAttribute("keyframes", val);
if (m_keyframeEditor->isVisibleParam(realName)) {
- elem.setAttribute("intimeline", "1");
+ pa.setAttribute("intimeline", "1");
}
- else if (elem.hasAttribute("intimeline"))
- elem.removeAttribute("intimeline");
+ else if (pa.hasAttribute("intimeline"))
+ pa.removeAttribute("intimeline");
} else if (type == "url") {
KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
setValue = req->url().path();
setValue = fontfamily->currentFont().family();
}
if (!setValue.isNull())
- pa.attributes().namedItem("value").setNodeValue(setValue);
+ pa.setAttribute("value", setValue);
}
emit parameterChanged(oldparam, m_effect, m_effect.attribute("kdenlive_ix").toInt());