]> git.sesse.net Git - kdenlive/commitdiff
Add proper support for 'float' parameter type in effect's drag widget (required for...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 16 May 2011 18:30:09 +0000 (18:30 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 16 May 2011 18:30:09 +0000 (18:30 +0000)
svn path=/trunk/kdenlive/; revision=5590

src/beziercurve/beziersplinewidget.cpp
src/customtrackview.cpp
src/doubleparameterwidget.cpp
src/doubleparameterwidget.h
src/dragvalue.cpp
src/dragvalue.h
src/effectstackedit.cpp
src/effectstackedit.h
src/geometrywidget.cpp
src/initeffects.cpp
src/keyframeedit.cpp

index c3b917761bef8ff0b3a8ed839e6c4b7d1f4c377f..8736f904311c3b2503bfcc83785c60189cb29985 100644 (file)
@@ -47,23 +47,17 @@ BezierSplineWidget::BezierSplineWidget(const QString& spline, QWidget* parent) :
     m_ui.buttonShowAllHandles->setIcon(KIcon("draw-bezier-curves"));
     m_ui.widgetPoint->setEnabled(false);
 
-    m_pX = new DragValue(i18n("In"), 0, 3, -1, QString(), false, this);
-    m_pX->setRange(0, 1);
+    m_pX = new DragValue(i18n("In"), 0, 3, 0, 1, -1, QString(), false, this);
     m_pX->setStep(0.001);
-    m_pY = new DragValue(i18n("Out"), 0, 3, -1, QString(), false, this);
-    m_pY->setRange(0, 1);
+    m_pY = new DragValue(i18n("Out"), 0, 3, 0, 1, -1, QString(), false, this);
     m_pY->setStep(0.001);
-    m_h1X = new DragValue(i18n("X"), 0, 3, -1, QString(), false, this);
-    m_h1X->setRange(-2, 2);
+    m_h1X = new DragValue(i18n("X"), 0, 3, -2, 2, -1, QString(), false, this);
     m_h1X->setStep(0.001);
-    m_h1Y = new DragValue(i18n("Y"), 0, 3, -1, QString(), false, this);
-    m_h1Y->setRange(-2, 2);
+    m_h1Y = new DragValue(i18n("Y"), 0, 3, -2, 2, -1, QString(), false, this);
     m_h1Y->setStep(0.001);
-    m_h2X = new DragValue(i18n("X"), 0, 3, -1, QString(), false, this);
-    m_h2X->setRange(-2, 2);
+    m_h2X = new DragValue(i18n("X"), 0, 3, -2, 2, -1, QString(), false, this);
     m_h2X->setStep(0.001);
-    m_h2Y = new DragValue(i18n("Y"), 0, 3, -1, QString(), false, this);
-    m_h2Y->setRange(-2, 2);
+    m_h2Y = new DragValue(i18n("Y"), 0, 3, -2, 2, -1, QString(), false, this);
     m_h2Y->setStep(0.001);
 
     m_ui.layoutP->addWidget(m_pX);
index b65eca5e3568b1cd8b997bcc9163d8145dbb0525..1ce7d165bb88db66b84e3e32ec821ff43c49ad68 100644 (file)
@@ -6318,10 +6318,15 @@ QStringList CustomTrackView::extractTransitionsLumas()
         if (itemList.at(i)->type() == TRANSITIONWIDGET) {
             transitionitem = static_cast <Transition*>(itemList.at(i));
             transitionXml = transitionitem->toXML();
+            // luma files in transitions can be in "resource" or "luma" property
             QString luma = EffectsList::parameter(transitionXml, "luma");
-            if (!luma.isEmpty()) urls << luma;
+            if (luma.isEmpty()) luma = EffectsList::parameter(transitionXml, "resource");
+            if (!luma.isEmpty()) urls << KUrl(luma).path();
         }
     }
+#if QT_VERSION >= 0x040500
+    urls.removeDuplicates();
+#endif
     return urls;
 }
 
index 896a13822e40fe54530b0471c97c1a54db3bff55..342fe5f791b066ca3e3380f83e74c9a297ba8bd7 100644 (file)
 #include <QSpinBox>
 #include <QToolButton>
 
+#include <KDebug>
 #include <KIcon>
 #include <KLocalizedString>
 
 
-DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, int id, const QString suffix, QWidget *parent) :
+DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString suffix, int decimals, QWidget *parent) :
         QWidget(parent),
         m_commentLabel(NULL)
 {
@@ -39,9 +40,7 @@ DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int
     layout->setContentsMargins(0, 0, 0, 0);
     layout->setSpacing(0);
     
-    m_dragVal = new DragValue(name, defaultValue, 0, id, suffix, this);
-    m_dragVal->setRange(min, max);
-    m_dragVal->setPrecision(0);
+    m_dragVal = new DragValue(name, defaultValue, decimals, min, max, id, suffix, this);
     layout->addWidget(m_dragVal, 0, 1);
 
     if (!comment.isEmpty()) {
index 31ef445d28ea1f4991135928d003fcd9502049eb..52bad2101c8c47d9bdc266f143de892c02a8bfbb 100644 (file)
@@ -50,7 +50,7 @@ public:
     * @param comment A comment explaining the parameter. Will be shown for the tooltip.
     * @param suffix (optional) Suffix to display in spinbox
     * @param parent (optional) Parent Widget */
-    DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, int id, const QString suffix = QString(), QWidget* parent = 0);
+    DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString suffix = QString(), int decimals = 0, QWidget* parent = 0);
 
     /** @brief Gets the parameter's value. */
     int getValue();
index dd4b3cd59e5e8083d12f2a7208051bf5d485f12a..8ef11178385b3a6a31eae3c02137951befc040c0 100644 (file)
 #include <QPainter>
 #include <QStyle>
 
+#include <KDebug>
 #include <KIcon>
 #include <KLocalizedString>
 #include <KGlobalSettings>
 
 
-DragValue::DragValue(const QString &label, double defaultValue, int decimals, int id, const QString suffix, bool showSlider, QWidget* parent) :
+DragValue::DragValue(const QString &label, double defaultValue, int decimals, double min, double max, int id, const QString suffix, bool showSlider, QWidget* parent) :
         QWidget(parent),
-        m_maximum(100),
-        m_minimum(0),
+        m_maximum(max),
+        m_minimum(min),
         m_decimals(decimals),
         m_default(defaultValue),
         m_id(id),
@@ -60,11 +61,10 @@ DragValue::DragValue(const QString &label, double defaultValue, int decimals, in
     QHBoxLayout *l = new QHBoxLayout;
     l->setSpacing(0);
     l->setContentsMargins(0, 0, 0, 0);
-    m_label = new CustomLabel(label, showSlider, decimals, this);
-    m_label->setCursor(Qt::PointingHandCursor);
-    m_label->setRange(m_minimum, m_maximum);
+    m_label = new CustomLabel(label, showSlider, this);
     l->addWidget(m_label);
     if (decimals == 0) {
+        m_label->setStep(m_label->maximum() / (max - min));
         m_intEdit = new QSpinBox(this);
         m_intEdit->setObjectName("dragBox");
         if (!suffix.isEmpty()) m_intEdit->setSuffix(suffix);
@@ -87,12 +87,13 @@ DragValue::DragValue(const QString &label, double defaultValue, int decimals, in
         m_doubleEdit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
         m_doubleEdit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
         m_doubleEdit->setRange(m_minimum, m_maximum);
+        m_doubleEdit->setSingleStep((m_maximum - m_minimum) / 100.0);
         l->addWidget(m_doubleEdit);
         connect(m_doubleEdit, SIGNAL(valueChanged(double)), this, SLOT(slotSetValue(double)));
         connect(m_doubleEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
     }
     
-    connect(m_label, SIGNAL(valueChanged(double,bool)), this, SLOT(setValue(double,bool)));
+    connect(m_label, SIGNAL(valueChanged(double,bool)), this, SLOT(setValueFromProgress(double,bool)));
     connect(m_label, SIGNAL(resetValue()), this, SLOT(slotReset()));
     setLayout(l);
     if (m_intEdit) m_label->setMaximumHeight(m_intEdit->sizeHint().height());
@@ -179,7 +180,6 @@ qreal DragValue::value() const
 void DragValue::setMaximum(qreal max)
 {
     m_maximum = max;
-    m_label->setRange(m_minimum, m_maximum);
     if (m_intEdit) m_intEdit->setRange(m_minimum, m_maximum);
     else m_doubleEdit->setRange(m_minimum, m_maximum);
 }
@@ -187,7 +187,6 @@ void DragValue::setMaximum(qreal max)
 void DragValue::setMinimum(qreal min)
 {
     m_minimum = min;
-    m_label->setRange(m_minimum, m_maximum);
     if (m_intEdit) m_intEdit->setRange(m_minimum, m_maximum);
     else m_doubleEdit->setRange(m_minimum, m_maximum);
 }
@@ -196,7 +195,6 @@ void DragValue::setRange(qreal min, qreal max)
 {
     m_maximum = max;
     m_minimum = min;
-    m_label->setRange(m_minimum, m_maximum);
     if (m_intEdit) m_intEdit->setRange(m_minimum, m_maximum);
     else m_doubleEdit->setRange(m_minimum, m_maximum);
 }
@@ -213,7 +211,6 @@ void DragValue::setPrecision(int /*precision*/)
 
 void DragValue::setStep(qreal step)
 {
-    m_label->setStep(step);
     if (m_intEdit)
         m_intEdit->setSingleStep(step);
     else
@@ -234,12 +231,12 @@ void DragValue::slotReset()
         m_doubleEdit->blockSignals(false);
         emit valueChanged(m_default, true);
     }
-    m_label->setProgressValue(m_default);
+    m_label->setProgressValue((m_default - m_minimum) / (m_maximum - m_minimum) * m_label->maximum());
 }
 
 void DragValue::slotSetValue(int value)
 {
-    setValue(value, KdenliveSettings::dragvalue_directupdate());
+   setValue(value, KdenliveSettings::dragvalue_directupdate());
 }
 
 void DragValue::slotSetValue(double value)
@@ -247,6 +244,13 @@ void DragValue::slotSetValue(double value)
     setValue(value, KdenliveSettings::dragvalue_directupdate());
 }
 
+void DragValue::setValueFromProgress(double value, bool final)
+{
+    value = m_minimum + value * (m_maximum - m_minimum) / m_label->maximum();
+    if (m_decimals == 0) setValue((int) (value + 0.5), final);
+    else setValue(value, final);
+}
+
 void DragValue::setValue(double value, bool final)
 {
     value = qBound(m_minimum, value, m_maximum);
@@ -262,7 +266,8 @@ void DragValue::setValue(double value, bool final)
         m_doubleEdit->blockSignals(false);
         emit valueChanged(value, final);
     }
-    m_label->setProgressValue(value);
+
+    m_label->setProgressValue((value - m_minimum) / (m_maximum - m_minimum) * m_label->maximum());
 }
 
 void DragValue::focusInEvent(QFocusEvent* e)
@@ -333,18 +338,20 @@ void DragValue::setInTimelineProperty(bool intimeline)
     
 }
 
-CustomLabel::CustomLabel(const QString &label, bool showSlider, int precision, QWidget* parent) :
+CustomLabel::CustomLabel(const QString &label, bool showSlider, QWidget* parent) :
     QProgressBar(parent),
     m_dragMode(false),
-    m_step(1.0),
     m_showSlider(showSlider),
-    m_precision(pow(10, precision)),
-    m_value(0)
+    m_step(10.0)
+    //m_precision(pow(10, precision)),
 {
     setFont(KGlobalSettings::toolBarFont());
     setFormat(" " + label);
     setFocusPolicy(Qt::ClickFocus);
+    setCursor(Qt::PointingHandCursor);
     setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
+    setRange(0, 1000);
+    
     if (!showSlider) {
         QSize sh;
         const QFontMetrics &fm = fontMetrics();
@@ -388,12 +395,12 @@ void CustomLabel::mouseMoveEvent(QMouseEvent* e)
                 if (KdenliveSettings::dragvalue_mode() == 2)
                     diff = (diff > 0 ? 1 : -1) * pow(diff, 2);
 
-                double nv = m_value + diff * m_step;
-                if (nv != m_value) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
+                double nv = value() + diff * m_step;
+                if (nv != value()) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
             }
             else {
                 double nv = minimum() + ((double) maximum() - minimum()) / width() * e->pos().x();
-                if (nv != m_value) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
+                if (nv != value()) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
             }
             m_dragLastPosition = e->pos();
             e->accept();
@@ -414,12 +421,12 @@ void CustomLabel::mouseReleaseEvent(QMouseEvent* e)
         return;
     }
     if (m_dragMode) {
-        setNewValue(m_value, true);
+        setNewValue(value(), true);
         m_dragLastPosition = m_dragStartPosition;
         e->accept();
     }
     else if (m_showSlider) {
-        setNewValue((minimum() + ((double)maximum() - minimum()) / width() * e->pos().x()), true);
+        setNewValue((double) maximum() * e->pos().x() / width(), true);
         m_dragLastPosition = m_dragStartPosition;
         e->accept();
     }
@@ -429,13 +436,13 @@ void CustomLabel::mouseReleaseEvent(QMouseEvent* e)
 void CustomLabel::wheelEvent(QWheelEvent* e)
 {
     if (e->delta() > 0) {
-        if (e->modifiers() == Qt::ControlModifier) slotValueInc(m_step * 10);
-        else if (e->modifiers() == Qt::AltModifier) slotValueInc(m_step / m_precision);
+        if (e->modifiers() == Qt::ControlModifier) slotValueInc(10);
+        else if (e->modifiers() == Qt::AltModifier) slotValueInc(0.1);
         else slotValueInc();
     }
     else {
-        if (e->modifiers() == Qt::ControlModifier) slotValueDec(m_step * 10);
-        else if (e->modifiers() == Qt::AltModifier) slotValueDec(m_step / m_precision);
+        if (e->modifiers() == Qt::ControlModifier) slotValueDec(10);
+        else if (e->modifiers() == Qt::AltModifier) slotValueDec(0.1);
         else slotValueDec();
     }
     e->accept();
@@ -443,25 +450,23 @@ void CustomLabel::wheelEvent(QWheelEvent* e)
 
 void CustomLabel::slotValueInc(double factor)
 {
-    setNewValue(m_value + m_step * factor, true);
+    setNewValue(value() + m_step * factor, true);
 }
 
 void CustomLabel::slotValueDec(double factor)
 {
-    setNewValue(m_value - m_step * factor, true);
+    setNewValue(value() - m_step * factor, true);
 }
 
 void CustomLabel::setProgressValue(double value)
 {
-    m_value = value;
-    setValue((int) value);
+    setValue((int) (value + 0.5));
 }
 
 void CustomLabel::setNewValue(double value, bool update)
 {
-    m_value = value;
-    setValue(value);
-    emit valueChanged(value, update);
+    setValue((int) (value + 0.5));
+    emit valueChanged((int) (value + 0.5), update);
 }
 
 void CustomLabel::setStep(double step)
index 53adb2b8b3e639c2785584eb463e2283807ef50f..5033f50b3c499d7d35cbccb0a200422601360f63 100644 (file)
@@ -38,7 +38,7 @@ class CustomLabel : public QProgressBar
 {
     Q_OBJECT
 public:
-    CustomLabel(const QString &label, bool showSlider = true, int precision = 0, QWidget *parent = 0);
+    CustomLabel(const QString &label, bool showSlider = true, QWidget *parent = 0);
     void setProgressValue(double value);
     void setStep(double step);
     
@@ -54,10 +54,8 @@ private:
     QPoint m_dragStartPosition;
     QPoint m_dragLastPosition;
     bool m_dragMode;
-    double m_step;
     bool m_showSlider;
-    double m_precision;
-    double m_value;
+    double m_step;
     void slotValueInc(double factor = 1);
     void slotValueDec(double factor = 1);
     void setNewValue(double, bool);
@@ -77,7 +75,18 @@ class DragValue : public QWidget
     Q_OBJECT
 
 public:
-    DragValue(const QString &label, double defaultValue, int decimals, int id, const QString suffix, bool showSlider = true, QWidget* parent = 0);
+    /**
+    * @brief Default constructor.
+    * @param label The label that will be displayed in the progress bar
+    * @param defaultValue The default value
+    * @param decimals The number of decimals for the parameter. 0 means it is an integer
+    * @param min The minimum value
+    * @param max The maximum value
+    * @param id Used to identify this widget. If this parameter is set, "Show in Timeline" will be available in context menu.
+    * @param suffix The suffix that will be displayed in the spinbox (for example '%')
+    * @param showSlider If disabled, user can still drag on the label but no progress bar is shown
+    */    
+    DragValue(const QString &label, double defaultValue, int decimals, double min = 0, double max = 100, int id = -1, const QString suffix = QString(), bool showSlider = true, QWidget* parent = 0);
     virtual ~DragValue();
 
     /** @brief Returns the precision = number of decimals */
@@ -110,6 +119,7 @@ public:
 public slots:
     /** @brief Sets the value (forced to be in the valid range) and emits valueChanged. */
     void setValue(double value, bool final = true);
+    void setValueFromProgress(double value, bool final);
     /** @brief Resets to default value */
     void slotReset();
 
index 0b1621e64b5250af1bf020d15df50d93395403e6..ad4df484dca03fa0cf5e70f9cb5164e1941ce38e 100644 (file)
@@ -259,19 +259,19 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool
         /** See effects/README for info on the different types */
 
         if (type == "double" || type == "constant") {
-            int min;
-            int max;
+            double min;
+            double max;
             if (pa.attribute("min").startsWith('%'))
-                min = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
+                min = ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
             else
-                min = pa.attribute("min").toInt();
+                min = pa.attribute("min").toDouble();
             if (pa.attribute("max").startsWith('%'))
-                max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
+                max = ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
             else
-                max = pa.attribute("max").toInt();
+                max = pa.attribute("max").toDouble();
 
-            DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, (int)(value.toDouble() + 0.5), min, max,
-                    pa.attribute("default").toInt(), comment, -1, pa.attribute("suffix"), this);
+            DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, value.toDouble(), min, max,
+                    pa.attribute("default").toDouble(), comment, -1, pa.attribute("suffix"), pa.attribute("decimals").toInt(), this);
             m_vbox->addWidget(doubleparam);
             m_valueItems[paramName] = doubleparam;
             connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
index 88688c75981d819415397768a66e42717acf39f4..d27705984ba75cc3ea56bb1178629ebd13e8391c 100644 (file)
@@ -57,6 +57,8 @@ public:
     void setFrameSize(QPoint p);
     /** @brief Tells the parameters to update their timecode format according to KdenliveSettings. */
     void updateTimecodeFormat();
+    /** @brief Returns true if this effect wants to keep track of current position in clip. */
+    bool effectNeedsSyncPosition() const;
 
 private:
     /** @brief Deletes all parameter widgets. */
index b34c9747d84cad2aeb4a2ec76dc43c4ca6b9ff9c..18cfe5cb72ed85fddefdbf219c788519ca9d0a88 100644 (file)
@@ -92,20 +92,16 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe()));
     connect(m_ui.buttonSync,      SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
 
-    m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -1, QString(), false, this);
-    m_spinX->setRange(-99000, 99000);
+    m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this);
     m_ui.horizontalLayout->addWidget(m_spinX);
     
-    m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -1, QString(), false, this);
-    m_spinY->setRange(-99000, 99000);
+    m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this);
     m_ui.horizontalLayout->addWidget(m_spinY);
     
-    m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, -1, QString(), false, this);
-    m_spinWidth->setRange(1, 99000);
+    m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this);
     m_ui.horizontalLayout->addWidget(m_spinWidth);
     
-    m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, -1, QString(), false, this);
-    m_spinHeight->setRange(1, 99000);
+    m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this);
     m_ui.horizontalLayout->addWidget(m_spinHeight);
 
     QMenu *menu = new QMenu(this);
@@ -175,25 +171,21 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     m_ui.horizontalLayout->addLayout(alignLayout);
     m_ui.horizontalLayout->addStretch(10);
     
-    m_spinSize = new DragValue(i18n("Size"), 100, 2, -1, i18n("%"), false, this);
-    m_spinSize->setRange(1, 99000);
+    m_spinSize = new DragValue(i18n("Size"), 100, 2, 1, 99000, -1, i18n("%"), false, this);
     m_ui.horizontalLayout2->addWidget(m_spinSize);
     
-    m_opacity = new DragValue(i18n("Opacity"), 100, 0, -1, i18n("%"), true, this);
+    m_opacity = new DragValue(i18n("Opacity"), 100, 0, 0, 100, -1, i18n("%"), true, this);
     m_ui.horizontalLayout2->addWidget(m_opacity);
 
 
     if (showRotation) {
-        m_rotateX = new DragValue(i18n("Rotate X"), 0, 0, -1, QString(), true, this);
-        m_rotateX->setRange(-1800, 1800);
+        m_rotateX = new DragValue(i18n("Rotate X"), 0, 0, -1800, 1800, -1, QString(), true, this);
         m_rotateX->setObjectName("rotate_x");
         m_ui.horizontalLayout3->addWidget(m_rotateX);
-        m_rotateY = new DragValue(i18n("Rotate Y"), 0, 0, -1, QString(), true, this);
-        m_rotateY->setRange(-1800, 1800);
+        m_rotateY = new DragValue(i18n("Rotate Y"), 0, 0, -1800, 1800,  -1, QString(), true, this);
         m_rotateY->setObjectName("rotate_y");
         m_ui.horizontalLayout3->addWidget(m_rotateY);
-        m_rotateZ = new DragValue(i18n("Rotate Z"), 0, 0, -1, QString(), true, this);
-        m_rotateZ->setRange(-1800, 1800);
+        m_rotateZ = new DragValue(i18n("Rotate Z"), 0, 0, -1800, 1800,  -1, QString(), true, this);
         m_rotateZ->setObjectName("rotate_z");
         m_ui.horizontalLayout3->addWidget(m_rotateZ);
         connect(m_rotateX,            SIGNAL(valueChanged(int)), this, SLOT(slotUpdateGeometry()));
index 938e25f26b19d827e0d4133c1266c6d0bf810ba7..0da445dd76c72233b077da59763bec654689cb8d 100644 (file)
@@ -616,9 +616,8 @@ QDomDocument initEffects::createDescriptionFromMlt(Mlt::Repository* repository,
                     params.setAttribute("type", "constant");
                 if (QString(paramdesc.get("type")) == "float") {
                     params.setAttribute("type", "constant");
-                    params.setAttribute("factor", "1000");
-                    if (paramdesc.get("maximum")) params.setAttribute("max", QString(paramdesc.get("maximum")).toFloat() * 1000.0);
-                    if (paramdesc.get("minimum")) params.setAttribute("min", QString(paramdesc.get("minimum")).toFloat() * 1000.0);
+                    // param type is float, set default decimals to 3
+                    params.setAttribute("decimals", "3");
                 }
                 if (QString(paramdesc.get("type")) == "boolean")
                     params.setAttribute("type", "bool");
index 317cd90c818927bfce327fd4f04ea5cf1d4e95f1..8ecbbd120c688d9bed2efae9d223679fccebd52a 100644 (file)
@@ -116,8 +116,8 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
     keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName));
 
     DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, 0,
-            m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt(),
-            m_params.at(columnId).attribute("default").toInt(), comment, columnId, m_params.at(columnId).attribute("suffix"), this);
+            m_params.at(columnId).attribute("min").toDouble(), m_params.at(columnId).attribute("max").toDouble(),
+            m_params.at(columnId).attribute("default").toDouble(), comment, columnId, m_params.at(columnId).attribute("suffix"), m_params.at(columnId).attribute("decimals").toInt(), this);
     connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
     connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
     connect(doubleparam, SIGNAL(setInTimeline(int)), this, SLOT(slotUpdateVisibleParameter(int)));