]> git.sesse.net Git - kdenlive/blobdiff - src/abstractmonitor.h
Cleanup: remove duplicate monitor code, allow fullscreen for record monitor
[kdenlive] / src / abstractmonitor.h
index 85469a13b5194de681594e96c2b89b57edaa6975..33154d40d969dad3dfad2921a3af32766aa255fe 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef ABSTRACTMONITOR_H
 #define ABSTRACTMONITOR_H
 
+#include "definitions.h"
+
 #include <QObject>
 #include <QVector>
 #include <QWidget>
 
 #include <stdint.h>
 
-class VideoPreviewContainer : public QFrame
-{
-    Q_OBJECT
-public:
-    VideoPreviewContainer(QWidget *parent = 0);
-    ~VideoPreviewContainer();
-    void setImage(QImage img);
-    void start();
-    void stop();
-
-protected:
-    virtual void paintEvent(QPaintEvent */*event*/);
-
-private:
-    QList <QImage *> m_imageQueue;
-    QTimer m_refreshTimer;
-};
-
+class MonitorManager;
 
 
 class AbstractRender: public QObject
@@ -58,7 +43,7 @@ Q_OBJECT public:
      *  @param name A unique identifier for this renderer
      *  @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
      *  @param profile The MLT profile used for the renderer (default one will be used if empty). */
-    AbstractRender(const QString &name, QWidget *parent = 0):QObject(parent), sendFrameForAnalysis(false), m_name(name) {};
+    AbstractRender(Kdenlive::MONITORID name, QWidget *parent = 0):QObject(parent), sendFrameForAnalysis(false), m_name(name) {};
 
     /** @brief Destroy the MLT Renderer. */
     virtual ~AbstractRender() {};
@@ -66,6 +51,9 @@ Q_OBJECT public:
     /** @brief This property is used to decide if the renderer should convert it's frames to QImage for use in other Kdenlive widgets. */
     bool sendFrameForAnalysis;
     
+    /** @brief This property is used to decide if the renderer should send audio data for monitoring. */
+    bool analyseAudio;
+    
     const QString &name() const {return m_name;};
 
     /** @brief Someone needs us to send again a frame. */
@@ -79,21 +67,51 @@ signals:
     void frameUpdated(QImage);
 
     /** @brief This signal contains the audio of the current frame. */
-    void audioSamplesSignal(QVector<int16_t>, int, int, int);
+    void audioSamplesSignal(QVector<int16_t>,int,int,int);
 };
 
 class AbstractMonitor : public QWidget
 {
     Q_OBJECT
 public:
-    AbstractMonitor(QWidget *parent = 0): QWidget(parent) {};
+    AbstractMonitor(Kdenlive::MONITORID id, MonitorManager *manager, QWidget *parent = 0);
+    Kdenlive::MONITORID id() {return m_id;};
     virtual ~AbstractMonitor() {};
     virtual AbstractRender *abstractRender() = 0;
-    virtual const QString name() const = 0;
-
+    virtual void pause() = 0;
+    virtual void unpause() = 0;
+    bool isActive() const;
+    
 public slots:
     virtual void stop() = 0;
     virtual void start() = 0;
+    virtual void slotPlay() = 0;
+    virtual void slotMouseSeek(int eventDelta, bool fast) = 0;
+    bool slotActivateMonitor();
+    virtual void slotSwitchFullScreen() = 0;
+
+protected:
+    Kdenlive::MONITORID m_id;
+    MonitorManager *m_monitorManager;
+};
+
+class VideoContainer : public QFrame
+{
+    Q_OBJECT
+public:
+    VideoContainer(AbstractMonitor *monitor, QWidget *parent = 0);
+    void switchFullScreen();
+
+protected:
+    virtual void mouseDoubleClickEvent(QMouseEvent * event);
+    virtual void mouseReleaseEvent(QMouseEvent *event);
+    void keyPressEvent(QKeyEvent *event);
+    virtual void wheelEvent(QWheelEvent * event);
+
+private:
+    Qt::WindowFlags m_baseFlags;
+    AbstractMonitor *m_monitor;
 };
 
+
 #endif