]> git.sesse.net Git - kdenlive/blob - src/monitor.h
- Blacklist bluescreen0r (we do not need 3 of them)
[kdenlive] / src / monitor.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef MONITOR_H
22 #define MONITOR_H
23
24 #include <QLabel>
25
26 #include <KIcon>
27 #include <KAction>
28 #include <KRestrictedLine>
29 #include <QDomElement>
30
31 #include "gentime.h"
32 #include "ui_monitor_ui.h"
33 #include "timecodedisplay.h"
34 #ifdef Q_WS_MAC
35 #include "videoglwidget.h"
36 #endif
37
38 class MonitorManager;
39 class Render;
40 class SmallRuler;
41 class DocClipBase;
42 class MonitorScene;
43 class QGraphicsView;
44 class QGraphicsPixmapItem;
45
46 class MonitorRefresh : public QWidget
47 {
48     Q_OBJECT
49 public:
50     MonitorRefresh(QWidget *parent = 0);
51     virtual void paintEvent(QPaintEvent *event);
52     void setRenderer(Render* render);
53
54 private:
55     Render *m_renderer;
56 };
57
58 class Overlay : public QLabel
59 {
60     Q_OBJECT
61 public:
62     Overlay(QWidget* parent);
63     void setOverlayText(const QString &, bool isZone = true);
64
65 private:
66     bool m_isZone;
67 };
68
69 class Monitor : public QWidget
70 {
71     Q_OBJECT
72
73 public:
74     Monitor(QString name, MonitorManager *manager, QString profile = QString(), QWidget *parent = 0);
75     virtual ~Monitor();
76     Render *render;
77     void resetProfile(const QString profile);
78     QString name() const;
79     void resetSize();
80     bool isActive() const;
81     void pause();
82     void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL);
83     const QString sceneList();
84     DocClipBase *activeClip();
85     GenTime position();
86     void checkOverlay();
87     void updateTimecodeFormat();
88     void updateMarkers(DocClipBase *source);
89     MonitorScene *getEffectScene();
90
91 protected:
92     virtual void mousePressEvent(QMouseEvent * event);
93     virtual void mouseReleaseEvent(QMouseEvent * event);
94
95     /** @brief Move to another position on mouse wheel event.
96      *
97      * Moves towards the end of the clip/timeline on mouse wheel down/back, the
98      * opposite on mouse wheel up/forward.
99      * Ctrl + wheel moves by a second, without Ctrl it moves by a single frame. */
100     virtual void wheelEvent(QWheelEvent * event);
101     virtual void mouseMoveEvent(QMouseEvent *event);
102     virtual QStringList mimeTypes() const;
103     /*virtual void dragMoveEvent(QDragMoveEvent * event);
104     virtual Qt::DropActions supportedDropActions() const;*/
105
106     //virtual void resizeEvent(QResizeEvent * event);
107     //virtual void paintEvent(QPaintEvent * event);
108
109 private:
110     Ui::Monitor_UI m_ui;
111     QString m_name;
112     MonitorManager *m_monitorManager;
113     DocClipBase *m_currentClip;
114     SmallRuler *m_ruler;
115     Overlay *m_overlay;
116     bool m_isActive;
117     double m_scale;
118     int m_length;
119     bool m_dragStarted;
120     MonitorRefresh *m_monitorRefresh;
121     KIcon m_playIcon;
122     KIcon m_pauseIcon;
123     TimecodeDisplay *m_timePos;
124     QAction *m_playAction;
125     QMenu *m_contextMenu;
126     QMenu *m_configMenu;
127     QMenu *m_playMenu;
128     QMenu *m_markerMenu;
129     QPoint m_DragStartPosition;
130     MonitorScene *m_effectScene;
131     QGraphicsView *m_effectView;
132 #ifdef Q_WS_MAC
133     VideoGLWidget *m_glWidget;
134 #endif
135     GenTime getSnapForPos(bool previous);
136
137 private slots:
138     void seekCursor(int pos);
139     void rendererStopped(int pos);
140     void slotExtractCurrentFrame();
141     void slotSetThumbFrame();
142     void slotSetSizeOneToOne();
143     void slotSetSizeOneToTwo();
144     void slotSaveZone();
145     void slotSeek();
146     void setClipZone(QPoint pos);
147     void slotSwitchMonitorInfo(bool show);
148     void slotSwitchDropFrames(bool show);
149     void slotGoToMarker(QAction *action);
150
151 public slots:
152     void slotOpenFile(const QString &);
153     void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
154     void initMonitor();
155     void refreshMonitor(bool visible = true);
156     void slotSeek(int pos);
157     void stop();
158     void start();
159     void activateMonitor();
160     void slotPlay();
161     void slotPlayZone();
162     void slotLoopZone();
163     void slotForward(double speed = 0);
164     void slotRewind(double speed = 0);
165     void slotRewindOneFrame(int diff = 1);
166     void slotForwardOneFrame(int diff = 1);
167     void saveSceneList(QString path, QDomElement info = QDomElement());
168     void slotStart();
169     void slotEnd();
170     void slotSetZoneStart();
171     void slotSetZoneEnd();
172     void slotZoneStart();
173     void slotZoneEnd();
174     void slotZoneMoved(int start, int end);
175     void slotSeekToNextSnap();
176     void slotSeekToPreviousSnap();
177     void adjustRulerSize(int length);
178     void setTimePos(const QString &pos);
179     QStringList getZoneInfo() const;
180     void slotEffectScene(bool show = true);
181
182 signals:
183     void renderPosition(int);
184     void durationChanged(int);
185     void refreshClipThumbnail(const QString &);
186     void adjustMonitorSize();
187     void zoneUpdated(QPoint);
188     void saveZone(Render *, QPoint);
189 };
190
191 #endif