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 "qtconcurrentrun.h"
13 #include "abstractgfxscopewidget.h"
15 #include "monitormanager.h"
20 #include <QMouseEvent>
23 // Uncomment for debugging.
30 const int REALTIME_FPS = 30;
32 AbstractGfxScopeWidget::AbstractGfxScopeWidget(MonitorManager *manager, bool trackMouse, QWidget *parent) :
33 AbstractScopeWidget(trackMouse, parent),
36 m_activeRender = m_manager->activeRenderer();
39 if (m_activeRender != NULL)
40 b &= connect(m_activeRender, SIGNAL(frameUpdated(QImage)), this, SLOT(slotRenderZoneUpdated(QImage)));
44 AbstractGfxScopeWidget::~AbstractGfxScopeWidget() { }
46 QImage AbstractGfxScopeWidget::renderScope(uint accelerationFactor)
48 return renderGfxScope(accelerationFactor, m_scopeImage);
51 void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event)
53 if (!m_aAutoRefresh->isChecked() && m_activeRender) {
54 m_activeRender->sendFrameUpdate();
56 AbstractScopeWidget::mouseReleaseEvent(event);
62 void AbstractGfxScopeWidget::slotActiveMonitorChanged()
65 bool b = m_activeRender->disconnect(this);
69 m_activeRender = m_manager->activeRenderer();
71 qDebug() << "Active monitor has changed in " << widgetName() << ". Is the clip monitor active now? " << m_activeRender->name();
74 //b &= connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
76 bool b = connect(m_activeRender, SIGNAL(frameUpdated(QImage)), this, SLOT(slotRenderZoneUpdated(QImage)));
80 // Update the scope for the new monitor.
84 void AbstractGfxScopeWidget::slotRenderZoneUpdated(QImage frame)
87 AbstractScopeWidget::slotRenderZoneUpdated();
90 void AbstractGfxScopeWidget::slotAutoRefreshToggled(bool autoRefresh)
92 if (autoRefresh && m_activeRender) {
93 m_activeRender->sendFrameUpdate();