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"
44 class QGraphicsPixmapItem;
46 class MonitorRefresh : public QWidget
50 MonitorRefresh(QWidget *parent = 0);
51 virtual void paintEvent(QPaintEvent *event);
52 void setRenderer(Render* render);
58 class Overlay : public QLabel
62 Overlay(QWidget* parent);
63 void setOverlayText(const QString &, bool isZone = true);
69 class Monitor : public QWidget
74 Monitor(QString name, MonitorManager *manager, QString profile = QString(), QWidget *parent = 0);
77 void resetProfile(const QString profile);
80 bool isActive() const;
82 void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL);
83 const QString sceneList();
84 DocClipBase *activeClip();
87 void updateTimecodeFormat();
88 void updateMarkers(DocClipBase *source);
89 MonitorScene *getEffectScene();
92 virtual void mousePressEvent(QMouseEvent * event);
93 virtual void mouseReleaseEvent(QMouseEvent * event);
95 /** @brief Move to another position on mouse wheel event.
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;*/
106 //virtual void resizeEvent(QResizeEvent * event);
107 //virtual void paintEvent(QPaintEvent * event);
112 MonitorManager *m_monitorManager;
113 DocClipBase *m_currentClip;
120 MonitorRefresh *m_monitorRefresh;
123 TimecodeDisplay *m_timePos;
124 QAction *m_playAction;
125 QMenu *m_contextMenu;
129 QPoint m_DragStartPosition;
130 MonitorScene *m_effectScene;
131 QGraphicsView *m_effectView;
133 VideoGLWidget *m_glWidget;
135 GenTime getSnapForPos(bool previous);
138 void seekCursor(int pos);
139 void rendererStopped(int pos);
140 void slotExtractCurrentFrame();
141 void slotSetThumbFrame();
142 void slotSetSizeOneToOne();
143 void slotSetSizeOneToTwo();
146 void setClipZone(QPoint pos);
147 void slotSwitchMonitorInfo(bool show);
148 void slotSwitchDropFrames(bool show);
149 void slotGoToMarker(QAction *action);
152 void slotOpenFile(const QString &);
153 void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
155 void refreshMonitor(bool visible = true);
156 void slotSeek(int pos);
159 void activateMonitor();
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());
170 void slotSetZoneStart();
171 void slotSetZoneEnd();
172 void slotZoneStart();
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 bool effectSceneDisplayed();
184 void renderPosition(int);
185 void durationChanged(int);
186 void refreshClipThumbnail(const QString &);
187 void adjustMonitorSize();
188 void zoneUpdated(QPoint);
189 void saveZone(Render *, QPoint);
190 /** @brief Editing transitions / effects over the monitor requires thr renderer to send frames as QImage.
191 * This causes a major slowdown, so we only enable it if required */
192 void requestFrameForAnalysis(bool);