]> git.sesse.net Git - kdenlive/blob - src/vectorscope.h
Auto-Refresh for Vectorscope added.
[kdenlive] / src / vectorscope.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *   This file is part of kdenlive. See www.kdenlive.org.                  *
4  *                                                                         *
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  ***************************************************************************/
10
11 #ifndef VECTORSCOPE_H
12 #define VECTORSCOPE_H
13
14 #include <QtCore>
15 #include "renderer.h"
16 #include "monitor.h"
17 #include "ui_vectorscope_ui.h"
18
19 class Render;
20 class Monitor;
21 class Vectorscope_UI;
22
23 enum PAINT_MODE { GREEN = 0, ORIG = 1, CHROMA = 2 };
24
25 class Vectorscope : public QWidget, public Ui::Vectorscope_UI {
26     Q_OBJECT
27
28 public:
29     Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0);
30     ~Vectorscope();
31
32 protected:
33     void paintEvent(QPaintEvent *);
34     void resizeEvent(QResizeEvent *event);
35     void mousePressEvent(QMouseEvent *);
36     void mouseMoveEvent(QMouseEvent *event);
37
38 private:
39     Monitor *m_projMonitor;
40     Monitor *m_clipMonitor;
41     Render *m_activeRender;
42
43     QImage m_scope;
44     int iPaintMode;
45     float scaling;
46     QPoint mapToCanvas(QRect inside, QPointF point);
47
48     bool circleEnabled;
49     QPoint mousePos;
50
51     void updateDimensions();
52     bool initialDimensionUpdateDone;
53     QRect scopeRect;
54     int cw;
55
56
57     QFuture<void> m_scopeCalcThread;
58     void calculateScope();
59
60     /** Prods the Scope calculation thread. If it is running, do nothing. If it is not,
61       run a new thread.
62       Returns true if a new thread has been started. */
63     bool prodCalcThread();
64
65     /** Counts the number of frames that have been rendered in one of the monitors.
66       The frame number will be reset when the vectorscope starts calculating the
67       current frame. */
68     QAtomicInt newFrames;
69
70 signals:
71     void signalScopeCalculationFinished();
72
73 private slots:
74     void slotPaintModeChanged(int index);
75     void slotMagnifyChanged();
76     void slotActiveMonitorChanged(bool isClipMonitor);
77     void slotRenderZoneUpdated();
78     void slotScopeCalculationFinished();
79
80 };
81
82 #endif // VECTORSCOPE_H