X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fabstractmonitor.h;h=537f5d74d470ccedc3db9158b0de880698f424f4;hb=de93dc84bc5f050272e4e736c3afa6ad5f3c6654;hp=2f56ac4d4629f9fc2477b40c0bd69f433499172c;hpb=ac5f5c9f6d4bdffeb76f3f2098b80f27bc532606;p=kdenlive diff --git a/src/abstractmonitor.h b/src/abstractmonitor.h index 2f56ac4d..537f5d74 100644 --- a/src/abstractmonitor.h +++ b/src/abstractmonitor.h @@ -20,69 +20,119 @@ #ifndef ABSTRACTMONITOR_H #define ABSTRACTMONITOR_H +#include "definitions.h" + #include #include #include #include -#include #include -class VideoPreviewContainer : public QFrame -{ - Q_OBJECT -public: - VideoPreviewContainer(QWidget *parent = 0); - - void setImage(QImage img); - -protected: - virtual void paintEvent(QPaintEvent */*event*/); - -private: - QImage *m_image; -}; - +#include +class MonitorManager; +class VideoContainer; class AbstractRender: public QObject { Q_OBJECT public: /** @brief Build an abstract MLT Renderer - * @param rendererName A unique identifier for this renderer + * @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(QWidget *parent = 0):QObject(parent),sendFrameForAnalysis(false) {}; + 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; + + /** @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; +private: + QString m_name; + 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(QVector, int, int, 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