virtual ~AbstractScopeWidget(); // Must be virtual because of inheritance, to avoid memory leaks
QPalette m_scopePalette;
+ ///// Unimplemented /////
+
virtual QString widgetName() const = 0;
protected:
/** Offset from the widget's borders */
const uchar offset;
- /** The rect on the widget we're painting in. */
+ /** The rect on the widget we're painting in.
+ Can be used by the implementing widget, e.g. in the render methods.
+ Is updated when necessary (size changes). */
QRect m_scopeRect;
/** Images storing the calculated layers. Will be used on repaint events. */
QImage m_imgScope;
QImage m_imgBackground;
+ /** The acceleration factors can be accessed also by other renderer tasks,
+ e.g. to display the scope's acceleration factor in the HUD renderer. */
+ int m_accelFactorHUD;
+ int m_accelFactorScope;
+ int m_accelFactorBackground;
+
///// Unimplemented Methods /////
- /** Where on the widget we can paint in */
+ /** Where on the widget we can paint in.
+ May also update other variables that depend on the widget's size. */
virtual QRect scopeRect() = 0;
/** @brief HUD renderer. Must emit signalHUDRenderingFinished(). @see renderScope */
/** @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) = 0;
+ virtual QImage renderScope(uint accelerationFactor, QImage) = 0;
/** @brief Background renderer. Must emit signalBackgroundRenderingFinished(). @see renderScope */
virtual QImage renderBackground(uint accelerationFactor) = 0;
/** @see isHUDDependingOnInput() */
virtual bool isBackgroundDependingOnInput() const = 0;
- ///// Methods /////
+ ///// 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 mouseReleaseEvent(QMouseEvent *);
void paintEvent(QPaintEvent *);
+ void raise();
void resizeEvent(QResizeEvent *);
+ void showEvent(QShowEvent *);
+
+protected slots:
+ /** Forces an update of all layers. */
+ void forceUpdate();
+ void forceUpdateHUD();
+ void forceUpdateScope();
+ void forceUpdateBackground();
+ void slotAutoRefreshToggled(bool);
signals:
/** mseconds represent the time taken for the calculation,
QFuture<QImage> m_threadScope;
QFuture<QImage> m_threadBackground;
- int m_accelFactorHUD;
- int m_accelFactorScope;
- int m_accelFactorBackground;
+ QImage m_scopeImage;
bool initialDimensionUpdateDone;
void prodHUDThread();
void slotActiveMonitorChanged(bool isClipMonitor);
void customContextMenuRequested(const QPoint &pos);
void slotRenderZoneUpdated();
+ void slotRenderZoneUpdated(QImage);
void slotHUDRenderingFinished(uint mseconds, uint accelerationFactor);
void slotScopeRenderingFinished(uint mseconds, uint accelerationFactor);
void slotBackgroundRenderingFinished(uint mseconds, uint accelerationFactor);