]> git.sesse.net Git - kdenlive/blobdiff - src/vectorscope.cpp
Fix keyframe move in geometry widgets
[kdenlive] / src / vectorscope.cpp
index 329e127add8f59b03a06c7e1f952450885c1b135..6f45d63a46283be12e07ee0806078000e509fec0 100644 (file)
@@ -34,16 +34,10 @@ const QPointF YUV_Cy(.147, -.615);
 const QPointF YUV_Mg(.289,  .515);
 const QPointF YUV_Yl(-.437,  .100);
 
-const QPen penThick(QBrush(QColor(250,250,250)), 2, Qt::SolidLine);
-const QPen penThin(QBrush(QColor(250,250,250)), 1, Qt::SolidLine);
-const QPen penLight(QBrush(QColor(200,200,250,150)), 1, Qt::SolidLine);
-const QPen penDark(QBrush(QColor(0,0,20,250)), 1, Qt::SolidLine);
-
 
 Vectorscope::Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent) :
     AbstractScopeWidget(projMonitor, clipMonitor, parent),
-    m_gain(1),
-    m_circleEnabled(false)
+    m_gain(1)
 {
     ui = new Ui::Vectorscope_UI();
     ui->setupUi(this);
@@ -70,6 +64,7 @@ Vectorscope::Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *pa
     b &= connect(ui->backgroundMode, SIGNAL(currentIndexChanged(int)), this, SLOT(slotBackgroundChanged()));
     b &= connect(ui->sliderGain, SIGNAL(valueChanged(int)), this, SLOT(slotGainChanged(int)));
     b &= connect(ui->paintMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceUpdateScope()));
+    b &= connect(this, SIGNAL(signalMousePositionChanged()), this, SLOT(forceUpdateHUD()));
     ui->sliderGain->setValue(0);
 
 
@@ -93,8 +88,7 @@ Vectorscope::Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *pa
 
     Q_ASSERT(b);
 
-
-    this->setMouseTracking(true);
+    // To make the 1.0x text show
     slotGainChanged(ui->sliderGain->value());
 
     init();
@@ -125,6 +119,7 @@ void Vectorscope::readConfig()
     m_aAxisEnabled->setChecked(scopeConfig.readEntry("axis", false));
     ui->backgroundMode->setCurrentIndex(scopeConfig.readEntry("backgroundmode").toInt());
     ui->paintMode->setCurrentIndex(scopeConfig.readEntry("paintmode").toInt());
+    ui->sliderGain->setValue(scopeConfig.readEntry("gain", 1));
 }
 
 void Vectorscope::writeConfig()
@@ -134,7 +129,8 @@ void Vectorscope::writeConfig()
     scopeConfig.writeEntry("75PBox", m_a75PBox->isChecked());
     scopeConfig.writeEntry("axis", m_aAxisEnabled->isChecked());
     scopeConfig.writeEntry("backgroundmode", ui->backgroundMode->currentIndex());
-    scopeConfig.writeEntry("paintMode", ui->paintMode->currentIndex());
+    scopeConfig.writeEntry("paintmode", ui->paintMode->currentIndex());
+    scopeConfig.writeEntry("gain", ui->sliderGain->value());
     scopeConfig.sync();
 }
 
@@ -175,7 +171,7 @@ QImage Vectorscope::renderHUD(uint)
 
     QImage hud;
 
-    if (m_circleEnabled) {
+    if (m_mouseWithinWidget) {
         // Mouse moved: Draw a circle over the scope
 
         hud = QImage(m_scopeRect.size(), QImage::Format_ARGB32);
@@ -211,7 +207,7 @@ QImage Vectorscope::renderHUD(uint)
         float angle = copysign(acos(dx/r)*180/M_PI, dy);
         davinci.drawText(QPoint(10, m_scopeRect.height()), i18n("%1°", QString::number(angle, 'f', 1)));
 
-        m_circleEnabled = false;
+//        m_circleEnabled = false;
     } else {
         hud = QImage(0, 0, QImage::Format_ARGB32);
     }
@@ -393,26 +389,3 @@ void Vectorscope::slotBackgroundChanged()
     }
     forceUpdateBackground();
 }
-
-
-
-///// Events /////
-
-void Vectorscope::mouseMoveEvent(QMouseEvent *event)
-{
-    // Draw a circle around the center,
-    // showing percentage number of the radius length
-
-    m_circleEnabled = true;
-    m_mousePos = event->pos();
-    forceUpdateHUD();
-}
-
-void Vectorscope::leaveEvent(QEvent *event)
-{
-    // Repaint the HUD without the circle
-
-    m_circleEnabled = false;
-    QWidget::leaveEvent(event);
-    forceUpdateHUD();
-}