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 ***************************************************************************/
17 #include "ui_vectorscope_ui.h"
23 enum PAINT_MODE { GREEN = 0, ORIG = 1, CHROMA = 2 };
25 class Vectorscope : public QWidget, public Ui::Vectorscope_UI {
29 Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0);
33 void paintEvent(QPaintEvent *);
34 void resizeEvent(QResizeEvent *event);
35 void mousePressEvent(QMouseEvent *);
36 void mouseMoveEvent(QMouseEvent *event);
39 Monitor *m_projMonitor;
40 Monitor *m_clipMonitor;
41 Render *m_activeRender;
43 /** How to represent the pixels on the scope (green, original color, ...) */
49 QPoint mapToCanvas(QRect inside, QPointF point);
54 /** Updates the dimension. Only necessary when the widget has been resized. */
55 void updateDimensions();
56 bool initialDimensionUpdateDone;
61 /** The vectorscope color distribution.
62 Class variable as calculated by a thread. */
65 void calculateScope();
66 QFuture<void> m_scopeCalcThread;
68 /** Prods the Scope calculation thread. If it is running, do nothing. If it is not,
70 Returns true if a new thread has been started. */
71 bool prodCalcThread();
73 /** Counts the number of frames that have been rendered in one of the monitors.
74 The frame number will be reset when the vectorscope starts calculating the
77 /** Counts the number of other changes that should cause the vectorscope to be
78 recalculated. This is for example a resizeEvent. In this case, no new frames
79 are generated, but the scope has to be updated in any case (also if auto-update
81 QAtomicInt newChanges;
84 void signalScopeCalculationFinished();
87 void slotMagnifyChanged();
88 void slotActiveMonitorChanged(bool isClipMonitor);
89 void slotRenderZoneUpdated();
90 void slotScopeCalculationFinished();
91 void slotUpdateScope();
95 #endif // VECTORSCOPE_H