]> git.sesse.net Git - kdenlive/blobdiff - src/monitor.h
*Allow users to choose between SDL and OpenGL for monitor display
[kdenlive] / src / monitor.h
index 79cb5b69ad889244c5ed3eddf578eab4368e5a8e..7f7a7ba6f1f32a543b28735a971617ca691e6e7b 100644 (file)
@@ -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,20 @@ class MonitorManager;
 class Render;
 class SmallRuler;
 class DocClipBase;
+class MonitorScene;
+class AbstractClipItem;
+class Transition;
+class ClipItem;
+class QGraphicsView;
+class QGraphicsPixmapItem;
+class AudioSignal;
 
 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 +63,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,13 +82,14 @@ 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);
@@ -92,9 +99,7 @@ protected:
      *
      * 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 single frame, without Ctrl it moves by a second.
-     *
-     * See also http://www.kdenlive.org/mantis/view.php?id=265. */
+     * 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;
@@ -106,6 +111,7 @@ protected:
 
 private:
     Ui::Monitor_UI m_ui;
+    AudioSignal *m_audiosignal;
     QString m_name;
     MonitorManager *m_monitorManager;
     DocClipBase *m_currentClip;
@@ -118,18 +124,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);
@@ -148,7 +164,6 @@ private slots:
 public slots:
     void slotOpenFile(const QString &);
     void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
-    void initMonitor();
     void refreshMonitor(bool visible = true);
     void slotSeek(int pos);
     void stop();
@@ -157,6 +172,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);
@@ -174,6 +191,13 @@ public slots:
     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);
@@ -182,6 +206,9 @@ signals:
     void adjustMonitorSize();
     void zoneUpdated(QPoint);
     void saveZone(Render *, QPoint);
+    /** @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