File indexing completed on 2024-04-28 04:52:21

0001 /*
0002     SPDX-FileCopyrightText: 2010 Simon Andreas Eugster <simon.eu@gmail.com>
0003     This file is part of kdenlive. See www.kdenlive.org.
0004 
0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #include "abstractgfxscopewidget.h"
0009 #include "monitor/monitormanager.h"
0010 
0011 #include <QMouseEvent>
0012 
0013 // Uncomment for debugging.
0014 //#define DEBUG_AGSW
0015 
0016 #ifdef DEBUG_AGSW
0017 #endif
0018 
0019 AbstractGfxScopeWidget::AbstractGfxScopeWidget(bool trackMouse, QWidget *parent)
0020     : AbstractScopeWidget(trackMouse, parent)
0021 {
0022 }
0023 
0024 AbstractGfxScopeWidget::~AbstractGfxScopeWidget() = default;
0025 
0026 QImage AbstractGfxScopeWidget::renderScope(uint accelerationFactor)
0027 {
0028     QMutexLocker lock(&m_mutex);
0029     return renderGfxScope(accelerationFactor, m_scopeImage);
0030 }
0031 
0032 void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event)
0033 {
0034     AbstractScopeWidget::mouseReleaseEvent(event);
0035     Q_EMIT signalFrameRequest(widgetName());
0036 }
0037 
0038 ///// Slots /////
0039 
0040 void AbstractGfxScopeWidget::slotRenderZoneUpdated(const QImage &frame)
0041 {
0042     QMutexLocker lock(&m_mutex);
0043     m_scopeImage = frame;
0044     AbstractScopeWidget::slotRenderZoneUpdated();
0045 }
0046 
0047 void AbstractGfxScopeWidget::slotAutoRefreshToggled(bool autoRefresh)
0048 {
0049     if (autoRefresh) {
0050         Q_EMIT signalFrameRequest(widgetName());
0051     }
0052 }
0053 
0054 #ifdef DEBUG_AGSW
0055 #undef DEBUG_AGSW
0056 #endif