]> git.sesse.net Git - kdenlive/blobdiff - src/abstractscopewidget.h
Color scopes now using the common abstract scope as well. --> Common functions, more...
[kdenlive] / src / abstractscopewidget.h
index 2d38c30ef3d7bdcd4498cabb29357d8a7066a9c0..bee68863a02725d13f078122e5fe8d163d756393 100644 (file)
@@ -40,9 +40,6 @@
   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.
 
 class QMenu;
 
-class Monitor;
-class Render;
-
 class AbstractScopeWidget : public QWidget
 {
     Q_OBJECT
 
 public:
-    AbstractScopeWidget(Monitor *projMonitor, Monitor *clipMonitor, bool trackMouse = false, QWidget *parent = 0);
+    AbstractScopeWidget(bool trackMouse = false, QWidget *parent = 0);
     virtual ~AbstractScopeWidget(); // Must be virtual because of inheritance, to avoid memory leaks
     QPalette m_scopePalette;
 
     /** Initializes widget settings (reads configuration).
       Has to be called in the implementing object. */
-    void init();
+    virtual void init();
 
     /** Does this scope have auto-refresh enabled */
     bool autoRefreshEnabled();
@@ -83,21 +77,18 @@ public:
     static const QPen penThick;
     static const QPen penThin;
     static const QPen penLight;
+    static const QPen penLightDots;
     static const QPen penDark;
+    static const QPen penDarkDots;
 
 protected:
     ///// Variables /////
 
-    Monitor *m_projMonitor;
-    Monitor *m_clipMonitor;
-    Render *m_activeRender;
-
-
     /** The context menu. Feel free to add new entries in your implementation. */
     QMenu *m_menu;
 
     /** Enables auto refreshing of the scope.
-        This is when a new frame is shown on the active monitor.
+        This is when fresh data is incoming.
         Resize events always force a recalculation. */
     QAction *m_aAutoRefresh;
 
@@ -153,13 +144,13 @@ protected:
     /** @brief Scope renderer. Must emit signalScopeRenderingFinished()
         when calculation has finished, to allow multi-threading.
         accelerationFactor hints how much faster than usual the calculation should be accomplished, if possible. */
-    virtual QImage renderScope(uint accelerationFactor, QImage) = 0;
+    virtual QImage renderScope(uint accelerationFactor) = 0;
     /** @brief Background renderer. Must emit signalBackgroundRenderingFinished(). @see renderScope */
     virtual QImage renderBackground(uint accelerationFactor) = 0;
 
-    /** Must return true if the HUD layer depends on the input monitor.
+    /** Must return true if the HUD layer depends on the input data.
         If it does not, then it does not need to be re-calculated when
-        a new frame from the monitor is incoming. */
+        fresh data is incoming. */
     virtual bool isHUDDependingOnInput() const = 0;
     /** @see isHUDDependingOnInput() */
     virtual bool isScopeDependingOnInput() const = 0;
@@ -190,11 +181,11 @@ protected slots:
     void forceUpdateHUD();
     void forceUpdateScope();
     void forceUpdateBackground();
-    void slotAutoRefreshToggled(bool);
+    virtual void slotAutoRefreshToggled(bool);
 
 signals:
     /** mseconds represent the time taken for the calculation,
-        accelerationFactor is the acceleration factor that has been used. */
+        accelerationFactor is the acceleration factor that has been used for this calculation. */
     void signalHUDRenderingFinished(uint mseconds, uint accelerationFactor);
     void signalScopeRenderingFinished(uint mseconds, uint accelerationFactor);
     void signalBackgroundRenderingFinished(uint mseconds, uint accelerationFactor);
@@ -208,8 +199,8 @@ signals:
 
 private:
 
-    /** Counts the number of frames that have been rendered in the active monitor.
-      The frame number will be reset when the calculation starts for the current frame. */
+    /** Counts the number of data frames that have been rendered in the active monitor.
+      The frame number will be reset when the calculation starts for the current data set. */
     QAtomicInt m_newHUDFrames;
     QAtomicInt m_newScopeFrames;
     QAtomicInt m_newBackgroundFrames;
@@ -222,7 +213,7 @@ private:
 
     /** The semaphores ensure that the QFutures for the HUD/Scope/Background threads cannot
       be assigned a new thread while it is still running. (Could cause deadlocks and other
-      nasty things known from parallelism. */
+      nasty things known from parallelism.) */
     QSemaphore m_semaphoreHUD;
     QSemaphore m_semaphoreScope;
     QSemaphore m_semaphoreBackground;
@@ -231,27 +222,24 @@ private:
     QFuture<QImage> m_threadScope;
     QFuture<QImage> m_threadBackground;
 
+    bool initialDimensionUpdateDone;
+    bool m_requestForcedUpdate;
+
     QImage m_scopeImage;
 
     QString m_widgetName;
 
-    bool initialDimensionUpdateDone;
     void prodHUDThread();
     void prodScopeThread();
     void prodBackgroundThread();
 
-
-private slots:
-    /** @brief Must be called when the active monitor has shown a new frame.
-      This slot must be connected in the implementing class, it is *not*
-      done in this abstract class. */
-    void slotActiveMonitorChanged(bool isClipMonitor);
+protected slots:
     void customContextMenuRequested(const QPoint &pos);
     /** To be called when a new frame has been received.
       The scope then decides whether and when it wants to recalculate the scope, depending
       on whether it is currently visible and whether a calculation thread is already running. */
     void slotRenderZoneUpdated();
-    void slotRenderZoneUpdated(QImage);
+    void slotRenderZoneUpdated(QImage);//TODO remove
     /** The following slots are called when rendering of a component has finished. They e.g. update
       the widget and decide whether to immediately restart the calculation thread. */
     void slotHUDRenderingFinished(uint mseconds, uint accelerationFactor);