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"
20 #include <QMouseEvent>
23 const int REALTIME_FPS = 30;
25 AbstractGfxScopeWidget::AbstractGfxScopeWidget(Monitor *projMonitor, Monitor *clipMonitor, bool trackMouse, QWidget *parent) :
26 AbstractScopeWidget(trackMouse, parent),
27 m_clipMonitor(clipMonitor),
28 m_projMonitor(projMonitor)
31 m_activeRender = (m_clipMonitor->isActive()) ? m_clipMonitor->render : m_projMonitor->render;
34 b &= connect(m_activeRender, SIGNAL(frameUpdated(QImage)), this, SLOT(slotRenderZoneUpdated(QImage)));
37 AbstractGfxScopeWidget::~AbstractGfxScopeWidget() { }
39 QImage AbstractGfxScopeWidget::renderScope(uint accelerationFactor)
41 return renderGfxScope(accelerationFactor, m_scopeImage);
44 void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event)
46 if (!m_aAutoRefresh->isChecked()) {
47 m_activeRender->sendFrameUpdate();
49 AbstractScopeWidget::mouseReleaseEvent(event);
55 void AbstractGfxScopeWidget::slotActiveMonitorChanged(bool isClipMonitor)
57 // qDebug() << "Active monitor has changed in " << m_widgetName << ". Is the clip monitor active now? " << isClipMonitor;
59 bool b = m_activeRender->disconnect(this);
62 m_activeRender = (isClipMonitor) ? m_clipMonitor->render : m_projMonitor->render;
64 //b &= connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
65 b &= connect(m_activeRender, SIGNAL(frameUpdated(QImage)), this, SLOT(slotRenderZoneUpdated(QImage)));
68 // Update the scope for the new monitor.
72 void AbstractGfxScopeWidget::slotRenderZoneUpdated(QImage frame)
75 AbstractScopeWidget::slotRenderZoneUpdated();
78 void AbstractGfxScopeWidget::slotAutoRefreshToggled(bool autoRefresh)
81 m_activeRender->sendFrameUpdate();