- /** Must return true if the HUD layer depends on the input monitor.
- If it does not, then it does not need to be re-calculated when
- a new frame from the monitor is incoming. */
- virtual bool isHUDDependingOnInput() const = 0;
- /** @see isHUDDependingOnInput() */
- virtual bool isScopeDependingOnInput() const = 0;
- /** @see isHUDDependingOnInput() */
- virtual bool isBackgroundDependingOnInput() const = 0;
-
- ///// Can be reimplemented /////
- /** Calculates the acceleration factor to be used by the render thread.
- This method can be refined in the subclass if required. */
- virtual uint calculateAccelFactorHUD(uint oldMseconds, uint oldFactor);
- virtual uint calculateAccelFactorScope(uint oldMseconds, uint oldFactor);
- virtual uint calculateAccelFactorBackground(uint oldMseconds, uint oldFactor);
-
- ///// 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);
- void forceUpdateHUD();
- void forceUpdateScope();
- void forceUpdateBackground();
- void slotAutoRefreshToggled(bool);
-
-signals:
- /** mseconds represent the time taken for the calculation,
- accelerationFactor is the acceleration factor that has been used. */
- void signalHUDRenderingFinished(uint mseconds, uint accelerationFactor);
- 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.
- The frame number will be reset when the calculation starts for the current frame. */
- QAtomicInt m_newHUDFrames;
- QAtomicInt m_newScopeFrames;
- QAtomicInt m_newBackgroundFrames;
-
- /** Counts the number of updates that, unlike new frames, force a recalculation
- of the scope, like for example a resize event. */
- QAtomicInt m_newHUDUpdates;
- QAtomicInt m_newScopeUpdates;
- QAtomicInt m_newBackgroundUpdates;
-
- /** 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.) */
- QSemaphore m_semaphoreHUD;
- QSemaphore m_semaphoreScope;
- QSemaphore m_semaphoreBackground;
-
- QFuture<QImage> m_threadHUD;
- QFuture<QImage> m_threadScope;
- QFuture<QImage> m_threadBackground;
-
- bool initialDimensionUpdateDone;
- bool m_requestForcedUpdate;
-
-// QImage m_scopeImage;
- QVector<int16_t> m_audioFrame; //NEW