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;
134 VideoGLWidget *m_glWidget;
136 GenTime getSnapForPos(bool previous);
139 void seekCursor(int pos);
140 void rendererStopped(int pos);
141 void slotExtractCurrentFrame();
142 void slotSetThumbFrame();
143 void slotSetSizeOneToOne();
144 void slotSetSizeOneToTwo();
147 void setClipZone(QPoint pos);
148 void slotSwitchMonitorInfo(bool show);
149 void slotSwitchDropFrames(bool show);
150 void slotGoToMarker(QAction *action);
153 void slotOpenFile(const QString &);
154 void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
156 void refreshMonitor(bool visible = true);
157 void slotSeek(int pos);
160 void activateMonitor();
164 void slotForward(double speed = 0);
165 void slotRewind(double speed = 0);
166 void slotRewindOneFrame(int diff = 1);
167 void slotForwardOneFrame(int diff = 1);
168 void saveSceneList(QString path, QDomElement info = QDomElement());
171 void slotSetZoneStart();
172 void slotSetZoneEnd();
173 void slotZoneStart();
175 void slotZoneMoved(int start, int end);
176 void slotSeekToNextSnap();
177 void slotSeekToPreviousSnap();
178 void adjustRulerSize(int length);
179 void setTimePos(const QString &pos);
180 QStringList getZoneInfo() const;
181 void slotEffectScene(bool show = true);
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);