const QPen AbstractScopeWidget::penThick(QBrush(QColor(250, 250, 250)), 2, Qt::SolidLine);
const QPen AbstractScopeWidget::penThin(QBrush(QColor(250, 250, 250)), 1, Qt::SolidLine);
const QPen AbstractScopeWidget::penLight(QBrush(QColor(200, 200, 250, 150)), 1, Qt::SolidLine);
+const QPen AbstractScopeWidget::penLightDots(QBrush(QColor(200, 200, 250, 150)), 1, Qt::DotLine);
const QPen AbstractScopeWidget::penDark(QBrush(QColor(0, 0, 20, 250)), 1, Qt::SolidLine);
+const QPen AbstractScopeWidget::penDarkDots(QBrush(QColor(0, 0, 20, 250)), 1, Qt::DotLine);
AbstractScopeWidget::AbstractScopeWidget(Monitor *projMonitor, Monitor *clipMonitor, bool trackMouse, QWidget *parent) :
QWidget(parent),
m_semaphoreHUD(1),
m_semaphoreScope(1),
m_semaphoreBackground(1),
- initialDimensionUpdateDone(false)
+ initialDimensionUpdateDone(false),
+ m_requestForcedUpdate(false)
{
m_scopePalette = QPalette();
void AbstractScopeWidget::prodScopeThread()
{
// Only start a new thread if the scope is actually visible
- // and not hidden by another widget on the stack.
- if (this->visibleRegion().isEmpty()) {
+ // and not hidden by another widget on the stack and if user want the scope to update.
+ if (this->visibleRegion().isEmpty() || (!m_aAutoRefresh->isChecked() && !m_requestForcedUpdate)) {
// qDebug() << "Scope " << m_widgetName << " is not visible. Not calculating scope.";
} else {
// Try to acquire the semaphore. This must only succeed if m_threadScope is not running
// See http://doc.qt.nokia.com/latest/qtconcurrentrun.html#run about
// running member functions in a thread
- m_threadScope = QtConcurrent::run(this, &AbstractScopeWidget::renderScope, m_accelFactorScope, m_scopeImage);
+ m_threadScope = QtConcurrent::run(this, &AbstractScopeWidget::renderScope, m_accelFactorScope);
+ m_requestForcedUpdate = false;
// qDebug() << "Scope thread started in " << m_widgetName;
if (!doUpdate) {
return;
}
+ m_requestForcedUpdate = true;
m_newHUDUpdates.fetchAndAddRelaxed(1);
m_newScopeUpdates.fetchAndAddRelaxed(1);
m_newBackgroundUpdates.fetchAndAddRelaxed(1);
void AbstractScopeWidget::forceUpdateScope()
{
m_newScopeUpdates.fetchAndAddRelaxed(1);
+ m_requestForcedUpdate = true;
prodScopeThread();
}
void AbstractScopeWidget::mouseReleaseEvent(QMouseEvent *event)
{
- if (!m_aAutoRefresh->isChecked()) m_activeRender->sendFrameUpdate();
+ if (!m_aAutoRefresh->isChecked()) {
+ m_requestForcedUpdate = true;
+ m_activeRender->sendFrameUpdate();
+ }
prodHUDThread();
prodScopeThread();
prodBackgroundThread();
{
// Update the dimension of the available rect for painting
m_scopeRect = scopeRect();
-
forceUpdate();
QWidget::resizeEvent(event);
if (isVisible()) emit requestAutoRefresh(autoRefresh);
// TODO only if depends on input
if (autoRefresh) {
- forceUpdate();
+ //forceUpdate();
+ m_requestForcedUpdate = true;
+ m_activeRender->sendFrameUpdate();
}
}