]> git.sesse.net Git - kdenlive/blobdiff - src/beziercurve/beziersplinewidget.cpp
Const'ref
[kdenlive] / src / beziercurve / beziersplinewidget.cpp
index d29c9d8fac508678d08e98fa241afee14584d3e0..f61e65f9242e5c25b83d5941c2e7516bc56fd528 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);
@@ -80,14 +74,14 @@ BezierSplineWidget::BezierSplineWidget(const QString& spline, QWidget* parent) :
     m_edit.setSpline(s);
 
     connect(&m_edit, SIGNAL(modified()), this, SIGNAL(modified()));
-    connect(&m_edit, SIGNAL(currentPoint(const BPoint&)), this, SLOT(slotUpdatePointEntries(const BPoint&)));
+    connect(&m_edit, SIGNAL(currentPoint(BPoint)), this, SLOT(slotUpdatePointEntries(BPoint)));
 
-    connect(m_pX, SIGNAL(valueChanged(double, bool)), this, SLOT(slotUpdatePointP(double, bool)));
-    connect(m_pY, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP(double, bool)));
-    connect(m_h1X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double, bool)));
-    connect(m_h1Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double, bool)));
-    connect(m_h2X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double, bool)));
-    connect(m_h2Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double, bool)));
+    connect(m_pX, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP(double,bool)));
+    connect(m_pY, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP(double,bool)));
+    connect(m_h1X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double,bool)));
+    connect(m_h1Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double,bool)));
+    connect(m_h2X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double,bool)));
+    connect(m_h2Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double,bool)));
 
     connect(m_ui.buttonLinkHandles, SIGNAL(toggled(bool)), this, SLOT(slotSetHandlesLinked(bool)));
     connect(m_ui.buttonZoomIn, SIGNAL(clicked()), &m_edit, SLOT(slotZoomIn()));
@@ -103,7 +97,7 @@ BezierSplineWidget::BezierSplineWidget(const QString& spline, QWidget* parent) :
     m_ui.buttonShowAllHandles->setChecked(KdenliveSettings::bezier_showallhandles());
 }
 
-QString BezierSplineWidget::spline()
+QString BezierSplineWidget::spline() const
 {
     return m_edit.spline().toString();
 }
@@ -125,14 +119,16 @@ void BezierSplineWidget::slotGridChange()
 
 void BezierSplineWidget::slotShowPixmap(bool show)
 {
-    m_showPixmap = show;
-    KdenliveSettings::setBezier_showpixmap(show);
-    if (show && (int)m_mode < 6)
-        m_edit.setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit.size(), (ColorTools::ColorsRGB)((int)m_mode), 1, palette().background().color().rgb())));
-//     else if (show && m_mode == ModeHue)
-//         m_edit.setPixmap(QPixmap::fromImage(ColorTools::hsvHueShiftPlane(m_edit.size(), 200, 200, 0, 360)));
-    else
-        m_edit.setPixmap(QPixmap());
+    if (m_showPixmap != show) {
+        m_showPixmap = show;
+        KdenliveSettings::setBezier_showpixmap(show);
+        if (show && (int)m_mode < 6)
+            m_edit.setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit.size(), (ColorTools::ColorsRGB)((int)m_mode), 1, palette().background().color().rgb())));
+        else if (show && m_mode == ModeHue)
+            m_edit.setPixmap(QPixmap::fromImage(ColorTools::hsvCurvePlane(m_edit.size(), QColor::fromHsv(200, 200, 200), ColorTools::COM_H, ColorTools::COM_H)));
+        else
+            m_edit.setPixmap(QPixmap());
+    }
 }
 
 void BezierSplineWidget::slotUpdatePointEntries(const BPoint &p)