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 ***************************************************************************/
16 ---------------------------
21 ---------------------------
26 ---------------------------
29 #ifndef ABSTRACTSCOPEWIDGET_H
30 #define ABSTRACTSCOPEWIDGET_H
40 class AbstractScopeWidget : public QWidget
45 AbstractScopeWidget(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0);
46 virtual ~AbstractScopeWidget(); // Must be virtual because of inheritance, to avoid memory leaks
47 QPalette m_scopePalette;
49 virtual QString widgetName() const = 0;
54 Monitor *m_projMonitor;
55 Monitor *m_clipMonitor;
56 Render *m_activeRender;
59 QAction *m_aAutoRefresh;
62 /** Offset from the widget's borders */
68 QImage m_imgBackground;
70 /** Counts the number of frames that have been rendered in the active monitor.
71 The frame number will be reset when the calculation starts for the current frame. */
72 QAtomicInt m_newHUDFrames;
73 QAtomicInt m_newScopeFrames;
74 QAtomicInt m_newBackgroundFrames;
76 /** Counts the number of updates that, unlike new frames, force a recalculation
77 of the scope, like for example a resize event. */
78 QAtomicInt m_newHUDUpdates;
79 QAtomicInt m_newScopeUpdates;
80 QAtomicInt m_newBackgroundUpdates;
82 QFuture<QImage> m_threadHUD;
83 QFuture<QImage> m_threadScope;
84 QFuture<QImage> m_threadBackground;
86 QSemaphore m_semaphoreHUD;
87 QSemaphore m_semaphoreScope;
88 QSemaphore m_semaphoreBackground;
91 ///// Unimplemented Methods /////
93 /** Where on the widget we can paint in */
94 virtual QRect scopeRect() = 0;
96 /** HUD renderer. Must emit signalHUDRenderingFinished(). */
97 virtual QImage renderHUD() = 0;
98 /** Scope renderer. Must emit signalScopeRenderingFinished(). */
99 virtual QImage renderScope() = 0;
100 /** Background renderer. Must emit signalBackgroundRenderingFinished(). */
101 virtual QImage renderBackground() = 0;
105 void mouseReleaseEvent(QMouseEvent *);
106 void paintEvent(QPaintEvent *);
107 void resizeEvent(QResizeEvent *);
111 /** Called when the active monitor has shown a new frame. */
112 void slotRenderZoneUpdated();
113 void slotHUDRenderingFinished();
114 void slotScopeRenderingFinished();
115 void slotBackgroundRenderingFinished();
118 void signalHUDRenderingFinished();
119 void signalScopeRenderingFinished();
120 void signalBackgroundRenderingFinished();
123 void prodScopeThread();
126 void customContextMenuRequested(const QPoint &pos);
127 void slotActiveMonitorChanged(bool isClipMonitor);
131 #endif // ABSTRACTSCOPEWIDGET_H