]> git.sesse.net Git - kdenlive/commitdiff
AbstractColorItem: disconnecting slots correctly to avoid multiple slots on one signal.
authorSimon A. Eugster <simon.eu@gmail.com>
Mon, 19 Jul 2010 21:30:17 +0000 (21:30 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Mon, 19 Jul 2010 21:30:17 +0000 (21:30 +0000)
svn path=/trunk/kdenlive/; revision=4604

src/abstractscopewidget.cpp
src/abstractscopewidget.h
src/vectorscope.cpp

index e5a0f560aa3f59675cd2f654b40cad4ad2420cd7..de7d4c93c6ee7b5976c890a4894e13c80d157b2b 100644 (file)
@@ -49,6 +49,7 @@ AbstractScopeWidget::AbstractScopeWidget(Monitor *projMonitor, Monitor *clipMoni
     m_aAutoRefresh->setCheckable(true);
     m_aRealtime = new QAction(i18n("Realtime (with precision loss)"), this);
     m_aRealtime->setCheckable(true);
+    m_aRealtime->setEnabled(false);
 
     m_menu = new QMenu(this);
     m_menu->setPalette(m_scopePalette);
@@ -179,17 +180,15 @@ void AbstractScopeWidget::slotBackgroundRenderingFinished(uint)
 void AbstractScopeWidget::slotActiveMonitorChanged(bool isClipMonitor)
 {
     qDebug() << "Active monitor has changed in " << widgetName() << ". Is the clip monitor active now? " << isClipMonitor;
-    if (isClipMonitor) {
-        m_activeRender = m_clipMonitor->render;
-        disconnect(this, SLOT(slotRenderZoneUpdated()));
-        connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
-        qDebug() << "Connected to clip monitor.";
-    } else {
-        m_activeRender = m_projMonitor->render;
-        disconnect(this, SLOT(slotRenderZoneUpdated()));
-        connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
-        qDebug() << "Connected to project monitor.";
-    }
+
+    bool disconnected = m_activeRender->disconnect(this);
+    Q_ASSERT(disconnected);
+
+    m_activeRender = (isClipMonitor) ? m_clipMonitor->render : m_projMonitor->render;
+
+    connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
+    connect(m_activeRender, SIGNAL(rendererPositionBefore0()), this, SLOT(slotRenderZoneUpdated()));
+
     // Update the scope for the new monitor.
     prodHUDThread();
     prodScopeThread();
index 9e07cf70e8126d8923c7f2a2ae4ed9f70c8bc67d..a7684bfde816f49b2574d8c0c304ba547835cfe8 100644 (file)
@@ -40,6 +40,9 @@
   The custom context menu already contains entries, like for enabling auto-
   refresh. It can certainly be extended in the implementation of the widget.
 
+  Note: Widgets deriving from this class should connect slotActiveMonitorChanged
+  to the appropriate signal.
+
   If you intend to write an own widget inheriting from this one, please read
   the comments on the unimplemented methods carefully. They are not only here
   for optical amusement, but also contain important information.
index 9ce725a0f342b028cb11939f08cf48d99b4de15c..95515d5111b7ac5e4752a5f27b677b273f13f9e9 100644 (file)
@@ -82,6 +82,8 @@ Vectorscope::Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *pa
 {
     setupUi(this);
 
+    //TODO don't draw circle when mouseLeaved
+
     m_colorTools = new ColorTools();
     m_colorPlaneExport = new ColorPlaneExport(this);