X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitor.h;h=ff959c809c2d9d688ecb4ffc82c6f50022a0fdea;hb=e7089c5e5a36a9b12cc79c0b25f0c28f4078637f;hp=2cffb9498dc72a68f191226852fd693d189da7e4;hpb=6e179022124ff68b658451accce90c58931905dc;p=kdenlive diff --git a/src/monitor.h b/src/monitor.h index 2cffb949..ff959c80 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -17,47 +17,93 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ - #ifndef MONITOR_H #define MONITOR_H + +#include "gentime.h" +#include "timecodedisplay.h" +#if defined(Q_WS_MAC) || defined(USE_OPEN_GL) +#include "videoglwidget.h" +#endif + #include +#include +#include +#include #include #include #include -#include -#include "gentime.h" -#include "ui_monitor_ui.h" class MonitorManager; class Render; class SmallRuler; class DocClipBase; +class AbstractClipItem; +class Transition; +class ClipItem; +class MonitorEditWidget; + +class Monitor; + +class VideoContainer : public QFrame +{ + Q_OBJECT +public: + VideoContainer(Monitor *parent = 0); + void switchFullScreen(); + +protected: + virtual void mouseDoubleClickEvent(QMouseEvent * event); + virtual void mousePressEvent(QMouseEvent * event); + virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event); + void keyPressEvent(QKeyEvent *event); + virtual void wheelEvent(QWheelEvent * event); + +private: + Qt::WindowFlags m_baseFlags; + Monitor *m_monitor; +}; class MonitorRefresh : public QWidget { Q_OBJECT public: - MonitorRefresh(QWidget* parent); - virtual void paintEvent(QPaintEvent * event); + MonitorRefresh(QWidget *parent = 0); void setRenderer(Render* render); +protected: + virtual void paintEvent(QPaintEvent *event); + private: Render *m_renderer; + +signals: + void switchFullScreen(); + void switchPlay(); + void mouseSeek(int, bool); }; class Overlay : public QLabel { Q_OBJECT public: - Overlay(QWidget* parent); - virtual void paintEvent(QPaintEvent * event); + Overlay(QWidget* parent = 0); void setOverlayText(const QString &, bool isZone = true); private: bool m_isZone; + +protected: + virtual void mouseDoubleClickEvent ( QMouseEvent * event ); + virtual void mousePressEvent ( QMouseEvent * event ); + virtual void mouseReleaseEvent ( QMouseEvent * event ); + +signals: + void editMarker(); }; class Monitor : public QWidget @@ -65,34 +111,44 @@ class Monitor : public QWidget Q_OBJECT public: - Monitor(QString name, MonitorManager *manager, QWidget *parent = 0); + Monitor(QString name, MonitorManager *manager, QString profile = QString(), QWidget *parent = 0); virtual ~Monitor(); Render *render; - void resetProfile(); + void resetProfile(const QString profile); QString name() const; void resetSize(); bool isActive() const; void pause(); - void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL); + void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL, QAction *loopClip = NULL); const QString sceneList(); DocClipBase *activeClip(); GenTime position(); void checkOverlay(); + void updateTimecodeFormat(); + void updateMarkers(DocClipBase *source); + MonitorEditWidget *getEffectEdit(); + QWidget *container(); + QFrame *m_volumePopup; protected: virtual void mousePressEvent(QMouseEvent * event); virtual void mouseReleaseEvent(QMouseEvent * event); + + /** @brief Move to another position on mouse wheel event. + * + * Moves towards the end of the clip/timeline on mouse wheel down/back, the + * opposite on mouse wheel up/forward. + * Ctrl + wheel moves by a second, without Ctrl it moves by a single frame. */ virtual void wheelEvent(QWheelEvent * event); virtual void mouseMoveEvent(QMouseEvent *event); virtual QStringList mimeTypes() const; - /* virtual void dragMoveEvent(QDragMoveEvent * event); - virtual Qt::DropActions supportedDropActions() const;*/ + /*virtual void dragMoveEvent(QDragMoveEvent * event); + virtual Qt::DropActions supportedDropActions() const;*/ -// virtual void resizeEvent(QResizeEvent * event); -// virtual void paintEvent(QPaintEvent * event); + //virtual void resizeEvent(QResizeEvent * event); + //virtual void paintEvent(QPaintEvent * event); private: - Ui::Monitor_UI m_ui; QString m_name; MonitorManager *m_monitorManager; DocClipBase *m_currentClip; @@ -105,13 +161,33 @@ private: MonitorRefresh *m_monitorRefresh; KIcon m_playIcon; KIcon m_pauseIcon; - KRestrictedLine *m_timePos; + TimecodeDisplay *m_timePos; QAction *m_playAction; + /** Has to be available so we can enable and disable it. */ + QAction *m_loopClipAction; QMenu *m_contextMenu; QMenu *m_configMenu; QMenu *m_playMenu; + QMenu *m_markerMenu; QPoint m_DragStartPosition; + MonitorEditWidget *m_effectWidget; + VideoContainer *m_videoBox; + /** Selected clip/transition in timeline. Used for looping it. */ + AbstractClipItem *m_selectedClip; + /** true if selected clip is transition, false = selected clip is clip. + * Necessary because sometimes we get two signals, e.g. we get a clip and we get selected transition = NULL. */ + bool m_loopClipTransition; +#if defined(Q_WS_MAC) || defined(USE_OPEN_GL) + VideoGLWidget *m_glWidget; + bool createOpenGlWidget(QWidget *parent, const QString profile); +#endif + GenTime getSnapForPos(bool previous); + Qt::WindowFlags m_baseFlags; + QToolBar *m_toolbar; + QWidget *m_volumeWidget; + QSlider *m_audioSlider; + QAction *m_editMarker; private slots: void seekCursor(int pos); @@ -125,12 +201,16 @@ private slots: void setClipZone(QPoint pos); void slotSwitchMonitorInfo(bool show); void slotSwitchDropFrames(bool show); + void slotGoToMarker(QAction *action); + void slotSetVolume(int volume); + void slotShowVolume(); + void slotEditMarker(); public slots: void slotOpenFile(const QString &); - void slotSetXml(DocClipBase *clip, const int position = -1); - void initMonitor(); - void refreshMonitor(bool visible = true); + void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1); + void refreshMonitor(bool visible); + void refreshMonitor(); void slotSeek(int pos); void stop(); void start(); @@ -138,6 +218,8 @@ public slots: void slotPlay(); void slotPlayZone(); void slotLoopZone(); + /** @brief Loops the selected item (clip or transition). */ + void slotLoopClip(); void slotForward(double speed = 0); void slotRewind(double speed = 0); void slotRewindOneFrame(int diff = 1); @@ -154,15 +236,27 @@ public slots: void slotSeekToPreviousSnap(); void adjustRulerSize(int length); void setTimePos(const QString &pos); + QStringList getZoneInfo() const; + void slotEffectScene(bool show = true); + bool effectSceneDisplayed(); + + /** @brief Sets m_selectedClip to @param item. Used for looping it. */ + void slotSetSelectedClip(AbstractClipItem *item); + void slotSetSelectedClip(ClipItem *item); + void slotSetSelectedClip(Transition *item); + void slotMouseSeek(int eventDelta, bool fast); + void slotSwitchFullScreen(); signals: void renderPosition(int); void durationChanged(int); - void refreshClipThumbnail(const QString &); + void refreshClipThumbnail(const QString &, bool); void adjustMonitorSize(); void zoneUpdated(QPoint); void saveZone(Render *, QPoint); - void blockMonitors(); + /** @brief Editing transitions / effects over the monitor requires the renderer to send frames as QImage. + * This causes a major slowdown, so we only enable it if required */ + void requestFrameForAnalysis(bool); }; #endif