X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitor.h;h=c598dffc247527acb4e8310b76c446d824453aaa;hb=103332c5aca11094694b6dc160d845f7f06343d4;hp=978e080d01d9ec944d5b3cf37d22b919ef97a75b;hpb=2950bfaa74c8dbc91e72634a8c2efbc107f571ae;p=kdenlive diff --git a/src/monitor.h b/src/monitor.h index 978e080d..c598dffc 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -17,7 +17,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ - #ifndef MONITOR_H #define MONITOR_H @@ -30,7 +29,8 @@ #include "gentime.h" #include "ui_monitor_ui.h" -#ifdef Q_WS_MAC +#include "timecodedisplay.h" +#if defined(Q_WS_MAC) || defined(USE_OPEN_GL) #include "videoglwidget.h" #endif @@ -38,13 +38,19 @@ class MonitorManager; class Render; class SmallRuler; class DocClipBase; +class MonitorScene; +class AbstractClipItem; +class Transition; +class ClipItem; +class QGraphicsView; +class QGraphicsPixmapItem; class MonitorRefresh : public QWidget { Q_OBJECT public: - MonitorRefresh(QWidget* parent); - virtual void paintEvent(QPaintEvent * event); + MonitorRefresh(QWidget *parent = 0); + virtual void paintEvent(QPaintEvent *event); void setRenderer(Render* render); private: @@ -56,7 +62,6 @@ class Overlay : public QLabel Q_OBJECT public: Overlay(QWidget* parent); - virtual void paintEvent(QPaintEvent * event); void setOverlayText(const QString &, bool isZone = true); private: @@ -76,25 +81,32 @@ public: 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); + MonitorScene *getEffectScene(); 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; @@ -110,18 +122,28 @@ 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; -#ifdef Q_WS_MAC + MonitorScene *m_effectScene; + QGraphicsView *m_effectView; + /** 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(QVBoxLayout *rendererBox, const QString profile); #endif + GenTime getSnapForPos(bool previous); - bool m_frametimecode; private slots: void seekCursor(int pos); @@ -139,8 +161,7 @@ private slots: public slots: void slotOpenFile(const QString &); - void slotSetXml(DocClipBase *clip, const int position = -1); - void initMonitor(); + void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1); void refreshMonitor(bool visible = true); void slotSeek(int pos); void stop(); @@ -149,6 +170,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); @@ -165,6 +188,14 @@ 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); signals: void renderPosition(int); @@ -173,7 +204,9 @@ signals: 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