1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
28 #include <KRestrictedLine>
29 #include <QDomElement>
32 #include "ui_monitor_ui.h"
33 #include "timecodedisplay.h"
35 #include "videoglwidget.h"
43 class MonitorRefresh : public QWidget
47 MonitorRefresh(QWidget* parent);
48 virtual void paintEvent(QPaintEvent * event);
49 void setRenderer(Render* render);
55 class Overlay : public QLabel
59 Overlay(QWidget* parent);
60 void setOverlayText(const QString &, bool isZone = true);
66 class Monitor : public QWidget
71 Monitor(QString name, MonitorManager *manager, QString profile = QString(), QWidget *parent = 0);
74 void resetProfile(const QString profile);
77 bool isActive() const;
79 void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL);
80 const QString sceneList();
81 DocClipBase *activeClip();
84 void updateTimecodeFormat();
85 void updateMarkers(DocClipBase *source);
88 virtual void mousePressEvent(QMouseEvent * event);
89 virtual void mouseReleaseEvent(QMouseEvent * event);
91 /** @brief Move to another position on mouse wheel event.
93 * Moves towards the end of the clip/timeline on mouse wheel down/back, the
94 * opposite on mouse wheel up/forward.
95 * Ctrl + wheel moves by a second, without Ctrl it moves by a single frame. */
96 virtual void wheelEvent(QWheelEvent * event);
97 virtual void mouseMoveEvent(QMouseEvent *event);
98 virtual QStringList mimeTypes() const;
99 /*virtual void dragMoveEvent(QDragMoveEvent * event);
100 virtual Qt::DropActions supportedDropActions() const;*/
102 //virtual void resizeEvent(QResizeEvent * event);
103 //virtual void paintEvent(QPaintEvent * event);
108 MonitorManager *m_monitorManager;
109 DocClipBase *m_currentClip;
116 MonitorRefresh *m_monitorRefresh;
119 TimecodeDisplay *m_timePos;
120 QAction *m_playAction;
121 QMenu *m_contextMenu;
125 QPoint m_DragStartPosition;
127 VideoGLWidget *m_glWidget;
129 GenTime getSnapForPos(bool previous);
132 void seekCursor(int pos);
133 void rendererStopped(int pos);
134 void slotExtractCurrentFrame();
135 void slotSetThumbFrame();
136 void slotSetSizeOneToOne();
137 void slotSetSizeOneToTwo();
140 void setClipZone(QPoint pos);
141 void slotSwitchMonitorInfo(bool show);
142 void slotSwitchDropFrames(bool show);
143 void slotGoToMarker(QAction *action);
146 void slotOpenFile(const QString &);
147 void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
149 void refreshMonitor(bool visible = true);
150 void slotSeek(int pos);
153 void activateMonitor();
157 void slotForward(double speed = 0);
158 void slotRewind(double speed = 0);
159 void slotRewindOneFrame(int diff = 1);
160 void slotForwardOneFrame(int diff = 1);
161 void saveSceneList(QString path, QDomElement info = QDomElement());
164 void slotSetZoneStart();
165 void slotSetZoneEnd();
166 void slotZoneStart();
168 void slotZoneMoved(int start, int end);
169 void slotSeekToNextSnap();
170 void slotSeekToPreviousSnap();
171 void adjustRulerSize(int length);
172 void setTimePos(const QString &pos);
173 QStringList getZoneInfo() const;
176 void renderPosition(int);
177 void durationChanged(int);
178 void refreshClipThumbnail(const QString &);
179 void adjustMonitorSize();
180 void zoneUpdated(QPoint);
181 void saveZone(Render *, QPoint);