1 /***************************************************************************
2 * Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com) *
3 * This file is part of kdenlive. See www.kdenlive.org. *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #include "abstractgfxscopewidget.h"
13 #include "monitormanager.h"
15 #include <QtConcurrentRun>
19 #include <QMouseEvent>
22 // Uncomment for debugging.
29 const int REALTIME_FPS = 30;
31 AbstractGfxScopeWidget::AbstractGfxScopeWidget(MonitorManager *manager, bool trackMouse, QWidget *parent) :
32 AbstractScopeWidget(trackMouse, parent),
35 m_activeRender = m_manager->activeRenderer();
38 if (m_activeRender != NULL)
39 b &= connect(m_activeRender, SIGNAL(frameUpdated(QImage)), this, SLOT(slotRenderZoneUpdated(QImage)));
43 AbstractGfxScopeWidget::~AbstractGfxScopeWidget() { }
45 QImage AbstractGfxScopeWidget::renderScope(uint accelerationFactor)
47 return renderGfxScope(accelerationFactor, m_scopeImage);
50 void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event)
52 if (!m_aAutoRefresh->isChecked() && m_activeRender) {
53 m_activeRender->sendFrameUpdate();
55 AbstractScopeWidget::mouseReleaseEvent(event);
61 void AbstractGfxScopeWidget::slotActiveMonitorChanged()
64 if (m_activeRender == m_manager->activeRenderer()) return;
66 b &= m_activeRender->disconnect(this);
69 m_activeRender = m_manager->activeRenderer();
73 qDebug() << "Active monitor has changed in " << widgetName() << ". Is the clip monitor active now? " << m_activeRender->name();
75 bool b = connect(m_activeRender, SIGNAL(frameUpdated(QImage)), this, SLOT(slotRenderZoneUpdated(QImage)));
79 // Update the scope for the new monitor.
83 void AbstractGfxScopeWidget::slotClearMonitor()
85 m_activeRender = NULL;
88 void AbstractGfxScopeWidget::slotRenderZoneUpdated(QImage frame)
91 AbstractScopeWidget::slotRenderZoneUpdated();
94 void AbstractGfxScopeWidget::slotAutoRefreshToggled(bool autoRefresh)
96 if (autoRefresh && m_activeRender) {
97 m_activeRender->sendFrameUpdate();