]> git.sesse.net Git - kdenlive/blob - src/monitor.h
First steps to implement 3 points editing (Using v to insert-overwrite)
[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 #ifdef Q_WS_MAC
34 #include "videoglwidget.h"
35 #endif
36
37 class MonitorManager;
38 class Render;
39 class SmallRuler;
40 class DocClipBase;
41
42 class MonitorRefresh : public QWidget
43 {
44     Q_OBJECT
45 public:
46     MonitorRefresh(QWidget* parent);
47     virtual void paintEvent(QPaintEvent * event);
48     void setRenderer(Render* render);
49
50 private:
51     Render *m_renderer;
52 };
53
54 class Overlay : public QLabel
55 {
56     Q_OBJECT
57 public:
58     Overlay(QWidget* parent);
59     virtual void paintEvent(QPaintEvent * event);
60     void setOverlayText(const QString &, bool isZone = true);
61
62 private:
63     bool m_isZone;
64 };
65
66 class Monitor : public QWidget
67 {
68     Q_OBJECT
69
70 public:
71     Monitor(QString name, MonitorManager *manager, QString profile = QString(), QWidget *parent = 0);
72     virtual ~Monitor();
73     Render *render;
74     void resetProfile(const QString profile);
75     QString name() const;
76     void resetSize();
77     bool isActive() const;
78     void pause();
79     void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL);
80     const QString sceneList();
81     DocClipBase *activeClip();
82     GenTime position();
83     void checkOverlay();
84     void updateTimecodeFormat();
85     void updateMarkers(DocClipBase *source);
86
87 protected:
88     virtual void mousePressEvent(QMouseEvent * event);
89     virtual void mouseReleaseEvent(QMouseEvent * event);
90     virtual void wheelEvent(QWheelEvent * event);
91     virtual void mouseMoveEvent(QMouseEvent *event);
92     virtual QStringList mimeTypes() const;
93     /*    virtual void dragMoveEvent(QDragMoveEvent * event);
94         virtual Qt::DropActions supportedDropActions() const;*/
95
96 //    virtual void resizeEvent(QResizeEvent * event);
97 //    virtual void paintEvent(QPaintEvent * event);
98
99 private:
100     Ui::Monitor_UI m_ui;
101     QString m_name;
102     MonitorManager *m_monitorManager;
103     DocClipBase *m_currentClip;
104     SmallRuler *m_ruler;
105     Overlay *m_overlay;
106     bool m_isActive;
107     double m_scale;
108     int m_length;
109     bool m_dragStarted;
110     MonitorRefresh *m_monitorRefresh;
111     KIcon m_playIcon;
112     KIcon m_pauseIcon;
113     KRestrictedLine *m_timePos;
114     QAction *m_playAction;
115     QMenu *m_contextMenu;
116     QMenu *m_configMenu;
117     QMenu *m_playMenu;
118     QMenu *m_markerMenu;
119     QPoint m_DragStartPosition;
120 #ifdef Q_WS_MAC
121     VideoGLWidget *m_glWidget;
122 #endif
123     GenTime getSnapForPos(bool previous);
124     bool m_frametimecode;
125
126 private slots:
127     void seekCursor(int pos);
128     void rendererStopped(int pos);
129     void slotExtractCurrentFrame();
130     void slotSetThumbFrame();
131     void slotSetSizeOneToOne();
132     void slotSetSizeOneToTwo();
133     void slotSaveZone();
134     void slotSeek();
135     void setClipZone(QPoint pos);
136     void slotSwitchMonitorInfo(bool show);
137     void slotSwitchDropFrames(bool show);
138     void slotGoToMarker(QAction *action);
139
140 public slots:
141     void slotOpenFile(const QString &);
142     void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
143     void initMonitor();
144     void refreshMonitor(bool visible = true);
145     void slotSeek(int pos);
146     void stop();
147     void start();
148     void activateMonitor();
149     void slotPlay();
150     void slotPlayZone();
151     void slotLoopZone();
152     void slotForward(double speed = 0);
153     void slotRewind(double speed = 0);
154     void slotRewindOneFrame(int diff = 1);
155     void slotForwardOneFrame(int diff = 1);
156     void saveSceneList(QString path, QDomElement info = QDomElement());
157     void slotStart();
158     void slotEnd();
159     void slotSetZoneStart();
160     void slotSetZoneEnd();
161     void slotZoneStart();
162     void slotZoneEnd();
163     void slotZoneMoved(int start, int end);
164     void slotSeekToNextSnap();
165     void slotSeekToPreviousSnap();
166     void adjustRulerSize(int length);
167     void setTimePos(const QString &pos);
168     QStringList getZoneInfo() const;
169
170 signals:
171     void renderPosition(int);
172     void durationChanged(int);
173     void refreshClipThumbnail(const QString &);
174     void adjustMonitorSize();
175     void zoneUpdated(QPoint);
176     void saveZone(Render *, QPoint);
177     void blockMonitors();
178 };
179
180 #endif