X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fabstractmonitor.h;h=6d222b16774e35253abdd5838c415642b1f945cf;hb=c24658bd34221d735f0641c924b890e1a6be7101;hp=c58ae0e0bb104554815734f062c9542d357daf59;hpb=3817a499ed6f10f0bcf1fdd4ae5451c2d0041d26;p=kdenlive diff --git a/src/abstractmonitor.h b/src/abstractmonitor.h index c58ae0e0..6d222b16 100644 --- a/src/abstractmonitor.h +++ b/src/abstractmonitor.h @@ -20,51 +20,18 @@ #ifndef ABSTRACTMONITOR_H #define ABSTRACTMONITOR_H +#include "definitions.h" + #include #include #include #include -#include #include -#include #include -class VideoPreviewContainer : public QFrame -{ - Q_OBJECT -public: - VideoPreviewContainer(QWidget *parent = 0); - ~VideoPreviewContainer(); - /** @brief Set the image to be displayed, will be put in the queue. */ - void setImage(QImage img); - /** @brief Start the display refresh timer. */ - void start(); - /** @brief Stop the display refresh timer. */ - void stop(); - /** @brief Set the display ratio for this display. */ - void setRatio(double ratio); - -protected: - virtual void paintEvent(QPaintEvent */*event*/); - virtual void resizeEvent(QResizeEvent * event); - -private: - /** @brief The display aspect ratio for profile. */ - double m_dar; - /** @brief When true, the whole widget surface will be repainted, useful when resizing widget. */ - bool m_refresh; - /** @brief The rectangle defining the area for painting our image. */ - QRect m_displayRect; - /** @brief The queue of images to be displayed. */ - QList m_imageQueue; - /** @brief We refresh the image with a timer, since this widget is only for preview during capture. */ - QTimer m_refreshTimer; - /** @brief Re-calculate the display zone after a resize or aspect ratio change. */ - void updateDisplayZone(); -}; - - +class MonitorManager; +class VideoContainer; class AbstractRender: public QObject { @@ -74,15 +41,24 @@ 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) {}; + explicit AbstractRender(Kdenlive::MonitorId name, QWidget *parent = 0) + : QObject(parent), + sendFrameForAnalysis(false), + analyseAudio(false), + m_name(name) + { + } /** @brief Destroy the MLT Renderer. */ - virtual ~AbstractRender() {}; + virtual ~AbstractRender() {} /** @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; - const QString &name() const {return m_name;}; + /** @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. */ virtual void sendFrameUpdate() = 0; @@ -92,24 +68,71 @@ private: signals: /** @brief The renderer refreshed the current frame. */ - void frameUpdated(QImage); + void frameUpdated(const QImage &); /** @brief This signal contains the audio of the current frame. */ - void audioSamplesSignal(const QVector&, const int&, const int&, const int&); + void audioSamplesSignal(const QVector&,int,int,int); +}; + + + +class VideoSurface : public QWidget +{ + Q_OBJECT +public: + VideoSurface(QWidget *parent = 0); + +signals: + void refreshMonitor(); + +protected: + virtual void paintEvent ( QPaintEvent * event ); }; + class AbstractMonitor : public QWidget { Q_OBJECT public: - AbstractMonitor(QWidget *parent = 0): QWidget(parent) {}; - virtual ~AbstractMonitor() {}; + 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; - + bool isActive() const; + VideoContainer *videoBox; + VideoSurface *videoSurface; + void createVideoSurface(); + + public slots: virtual void stop() = 0; virtual void start() = 0; + virtual void slotPlay() = 0; + virtual void slotMouseSeek(int eventDelta, bool fast) = 0; + bool slotActivateMonitor(bool forceRefresh = false); + virtual void slotSwitchFullScreen() = 0; + +protected: + Kdenlive::MonitorId m_id; + MonitorManager *m_monitorManager; +}; + +class VideoContainer : public QFrame +{ + Q_OBJECT +public: + explicit 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