]> git.sesse.net Git - kdenlive/blobdiff - src/abstractscopewidget.h
Progress on stopmotion widget (make it possible to switch between HDMI and V4L)
[kdenlive] / src / abstractscopewidget.h
index 6c31fec57772d73fb795742c376fc31a001304fb..c7f7ac008055901084bfd243485469bea2f60deb 100644 (file)
@@ -64,7 +64,7 @@ class AbstractScopeWidget : public QWidget
     Q_OBJECT
 
 public:
-    AbstractScopeWidget(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0);
+    AbstractScopeWidget(Monitor *projMonitor, Monitor *clipMonitor, bool trackMouse = false, QWidget *parent = 0);
     virtual ~AbstractScopeWidget(); // Must be virtual because of inheritance, to avoid memory leaks
     QPalette m_scopePalette;
 
@@ -72,6 +72,9 @@ public:
       Has to be called in the implementing object. */
     void init();
 
+    /** Does this scope have auto-refresh enabled */
+    bool autoRefreshEnabled();
+
     ///// Unimplemented /////
 
     virtual QString widgetName() const = 0;
@@ -103,6 +106,12 @@ protected:
         how many times faster the scope should be calculated. */
     QAction *m_aRealtime;
 
+    /** The mouse position; Updated when the mouse enters the widget
+        AND mouse tracking has been enabled. */
+    QPoint m_mousePos;
+    /** Knows whether the mouse currently lies within the widget or not.
+        Can e.g. be used for drawing a HUD only when the mouse is in the widget. */
+    bool m_mouseWithinWidget;
 
     /** Offset from the widget's borders */
     const uchar offset;
@@ -144,7 +153,7 @@ 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, const QImage) = 0;
     /** @brief Background renderer. Must emit signalBackgroundRenderingFinished(). @see renderScope */
     virtual QImage renderBackground(uint accelerationFactor) = 0;
 
@@ -166,12 +175,15 @@ protected:
 
     ///// Reimplemented /////
 
+    void mouseMoveEvent(QMouseEvent *);
+    void leaveEvent(QEvent *);
     void mouseReleaseEvent(QMouseEvent *);
     void paintEvent(QPaintEvent *);
     void resizeEvent(QResizeEvent *);
     void showEvent(QShowEvent *); // Called when the widget is activated via the Menu entry
     //    void raise(); // Called only when  manually calling the event -> useless
 
+
 protected slots:
     /** Forces an update of all layers. */
     void forceUpdate(bool doUpdate = true);
@@ -187,6 +199,13 @@ signals:
     void signalScopeRenderingFinished(uint mseconds, uint accelerationFactor);
     void signalBackgroundRenderingFinished(uint mseconds, uint accelerationFactor);
 
+    /** For the mouse position itself see m_mousePos.
+        To check whether the mouse has leaved the widget, see m_mouseWithinWidget. */
+    void signalMousePositionChanged();
+
+    /** Do we need the renderer to send its frames to us? */
+    void requestAutoRefresh(bool);
+
 private:
 
     /** Counts the number of frames that have been rendered in the active monitor.
@@ -212,21 +231,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:
+public 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);
+
+private 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