***************************************************************************/
#include "effectstackedit.h"
-#include "ui_constval_ui.h"
#include "ui_listval_ui.h"
#include "ui_boolval_ui.h"
#include "ui_wipeval_ui.h"
#include "kis_cubic_curve.h"
#include "choosecolorwidget.h"
#include "geometrywidget.h"
+#include "colortools.h"
+#include "doubleparameterwidget.h"
#include <KDebug>
#include <KLocale>
#include <KFileDialog>
#include <QVBoxLayout>
-#include <QSlider>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
{
};
-class Constval: public QWidget, public Ui::Constval_UI
-{
-};
-
class Listval: public QWidget, public Ui::Listval_UI
{
};
{
if (m_keyframeEditor)
m_keyframeEditor->updateTimecodeFormat();
+
QDomNodeList namenode = m_params.elementsByTagName("parameter");
for (int i = 0; i < namenode.count() ; i++) {
QDomNode pa = namenode.item(i);
}
}
+void EffectStackEdit::meetDependency(const QString& name, QString type, QString value)
+{
+ if (type == "curve") {
+ KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
+ if (curve) {
+ int color = value.toInt();
+ curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)color)));
+ }
+ }
+}
+
void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
{
m_profile = profile;
return;
}
- /*QDomDocument doc;
- doc.appendChild(doc.importNode(m_params, true));
- kDebug() << "IMPORTED TRANS: " << doc.toString();*/
-
QDomNodeList namenode = m_params.elementsByTagName("parameter");
QDomElement e = m_params.toElement();
const int minFrame = e.attribute("start").toInt();
max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
else
max = pa.attribute("max").toInt();
- createSliderItem(paramName, (int)(value.toDouble() + 0.5) , min, max, pa.attribute("suffix", QString()));
- delete toFillin;
- toFillin = NULL;
+
+ DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, (int)(value.toDouble() + 0.5), min, max,
+ pa.attribute("default").toInt(), pa.attribute("suffix"), this);
+ m_vbox->addWidget(doubleparam);
+ m_valueItems[paramName] = doubleparam;
+ connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
} else if (type == "list") {
Listval *lsval = new Listval;
lsval->setupUi(toFillin);
connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters()));
m_uiItems.append(bval);
} else if (type == "complex") {
- /*QStringList names=nodeAtts.namedItem("name").nodeValue().split(';');
- QStringList max=nodeAtts.namedItem("max").nodeValue().split(';');
- QStringList min=nodeAtts.namedItem("min").nodeValue().split(';');
- QStringList val=value.split(';');
- kDebug() << "in complex"<<names.size() << " " << max.size() << " " << min.size() << " " << val.size() ;
- if ( (names.size() == max.size() ) &&
- (names.size()== min.size()) &&
- (names.size()== val.size()) )
- {
- for (int i=0;i< names.size();i++){
- createSliderItem(names[i],val[i].toInt(),min[i].toInt(),max[i].toInt());
- };
- }*/
ComplexParameter *pl = new ComplexParameter;
pl->setupParam(d, pa.attribute("name"), 0, 100);
m_vbox->addWidget(pl);
} else if (type == "geometry") {
if (KdenliveSettings::on_monitor_effects()) {
GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
+ // connect this before setupParam to make sure the monitor scene shows up at startup
+ connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
if (minFrame == maxFrame)
geometry->setupParam(pa, m_in, m_out);
else
m_vbox->addWidget(geometry);
m_valueItems[paramName+"geometry"] = geometry;
connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
connect(geometry, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
connect(this, SIGNAL(syncEffectsPos(int)), geometry, SLOT(slotSyncPosition(int)));
} else {
m_vbox->addWidget(curve);
m_vbox->addWidget(spinin);
m_vbox->addWidget(spinout);
+
connect(curve, SIGNAL(modified()), this, SLOT(collectAllParameters()));
m_valueItems[paramName] = curve;
+
+ QString depends = pa.attribute("depends");
+ if (!depends.isEmpty())
+ meetDependency(paramName, type, EffectsList::parameter(e, depends));
} else if (type == "wipe") {
Wipeval *wpval = new Wipeval;
wpval->setupUi(toFillin);
QString setValue;
if (type == "double" || type == "constant") {
- QSlider* slider = ((Constval*)m_valueItems.value(paramName))->horizontalSlider;
- setValue = QString::number(slider->value());
+ DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
+ setValue = QString::number(doubleparam->getValue());
} else if (type == "list") {
KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
setValue = box->itemData(box->currentIndex()).toString();
EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
}
+ QString depends = pa.attributes().namedItem("depends").nodeValue();
+ if (!depends.isEmpty())
+ meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
} else if (type == "wipe") {
Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
wipeInfo info;
emit parameterChanged(oldparam, newparam);
}
-void EffectStackEdit::createSliderItem(const QString& name, int val , int min, int max, const QString suffix)
-{
- QWidget* toFillin = new QWidget(m_baseWidget);
- Constval *ctval = new Constval;
- ctval->setupUi(toFillin);
- ctval->horizontalSlider->setMinimum(min);
- ctval->horizontalSlider->setMaximum(max);
- if (!suffix.isEmpty()) ctval->spinBox->setSuffix(suffix);
- ctval->spinBox->setMinimum(min);
- ctval->spinBox->setMaximum(max);
- ctval->horizontalSlider->setPageStep((int)(max - min) / 10);
- ctval->horizontalSlider->setValue(val);
- ctval->label->setText(name);
- m_valueItems[name] = ctval;
- m_uiItems.append(ctval);
- connect(ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT(collectAllParameters()));
- m_vbox->addWidget(toFillin);
-}
-
-void EffectStackEdit::slotSliderMoved(int)
-{
- collectAllParameters();
-}
-
void EffectStackEdit::clearAllItems()
{
blockSignals(true);