]> git.sesse.net Git - kdenlive/blobdiff - src/stopmotion/stopmotion.h
Cleaning code style of Definitions.
[kdenlive] / src / stopmotion / stopmotion.h
index dbefc944734e2c146bccb53a0e528fd9a92292ec..1c1ff876ed02f1564465333a3c82f1f2a3d5c369 100644 (file)
 #define STOPMOTION_H
 
 #include "ui_stopmotion_ui.h"
-#include "../blackmagic/capture.h"
+#include "definitions.h"
 
 #include <KUrl>
 #include <QLabel>
 #include <QFuture>
 #include <QVBoxLayout>
+#include <QTimer>
+#include <abstractmonitor.h>
+
+class MltDeviceCapture;
+class MonitorManager;
+class MltVideoProfile;
 
 class MyLabel : public QLabel
 {
     Q_OBJECT
 public:
-    MyLabel(QWidget *parent = 0);
-    void setImage(QImage img);
+    explicit MyLabel(QWidget* parent = 0);
+    void setImage(const QImage &img);
 
 protected:
-    virtual void paintEvent(QPaintEvent * event);
-    virtual void wheelEvent(QWheelEvent * event);
+    void paintEvent(QPaintEvent* event);
+    void wheelEvent(QWheelEvent* event);
+    void mousePressEvent(QMouseEvent*);
 
 private:
     QImage m_img;
@@ -44,9 +51,38 @@ signals:
     /** @brief Seek to next or previous frame.
      *  @param forward set to true to go to next frame, fals to go to previous frame */
     void seek(bool forward);
+
+    /** @brief Switch to live view. */
+    void switchToLive();
+};
+
+
+class StopmotionMonitor : public AbstractMonitor
+{
+    Q_OBJECT
+public:
+    StopmotionMonitor(MonitorManager *manager, QWidget *parent);
+    ~StopmotionMonitor();
+    AbstractRender *abstractRender();
+    Kdenlive::MonitorId id() const;
+    void setRender(MltDeviceCapture *render);
+
+private:
+    MltDeviceCapture *m_captureDevice;
+
+public slots:
+    void stop();
+    void start();
+    void slotPlay();
+    void slotMouseSeek(int eventDelta, bool fast);
+    void slotSwitchFullScreen();
+
+signals:
+    void stopCapture();
 };
 
-class StopmotionWidget : public QDialog , public Ui::Stopmotion_UI
+
+class StopmotionWidget : public QDialog, public Ui::Stopmotion_UI
 {
     Q_OBJECT
 
@@ -54,22 +90,20 @@ public:
 
     /** @brief Build the stopmotion dialog.
      * @param projectFolder The current project folder, where captured files will be stored.
+     * @param actions The actions for this widget that can have a keyboard shortcut.
      * @param parent (optional) parent widget */
-    StopmotionWidget(KUrl projectFolder, QWidget *parent = 0);
+    StopmotionWidget(MonitorManager *manager, const KUrl &projectFolder, const QList< QAction* > &actions, QWidget* parent = 0);
     virtual ~StopmotionWidget();
 
 protected:
-    virtual void closeEvent(QCloseEvent *e);
+    virtual void closeEvent(QCloseEvente);
 
 private:
-    /** @brief Widget layout holding video and frame preview. */
-    QVBoxLayout *m_layout;
-
     /** @brief Current project folder (where the captured frames will be saved). */
     KUrl m_projectFolder;
 
     /** @brief Capture holder that will handle all video operation. */
-    CaptureHandler *m_bmCapture;
+    MltDeviceCapture *m_captureDevice;
 
     /** @brief Holds the name of the current sequence.
      * Files will be saved in project folder with name: sequence001.png */
@@ -78,7 +112,7 @@ private:
     /** @brief Holds the frame number of the current sequence. */
     int m_sequenceFrame;
 
-    QAction *m_captureAction;
+    QActionm_captureAction;
 
     /** @brief Holds the index of the frame to be displayed in the frame preview mode. */
     int m_animatedIndex;
@@ -90,7 +124,7 @@ private:
     void selectFrame(int ix);
 
     /** @brief This widget will hold the frame preview. */
-    MyLabel *m_frame_preview;
+    MyLabelm_frame_preview;
 
     /** @brief The list of files in the sequence to create thumbnails. */
     QStringList m_filesList;
@@ -99,26 +133,42 @@ private:
     QFuture<void> m_future;
 
     /** @brief Get the frame number ix. */
-    QListWidgetItem *getFrameFromIndex(int ix);
-
-    /** @brief The action triggering interval capture. */
-    QAction *m_intervalCapture;
+    QListWidgetItem* getFrameFromIndex(int ix);
 
     /** @brief The action triggering display of last frame over current live video feed. */
-    QAction *m_showOverlay;
+    QActionm_showOverlay;
 
     /** @brief The list of all frames path. */
     QStringList m_animationList;
+    
+    /** @brief Tells if we are in animation (playback) mode. */
+    bool m_animate;
+    
+    /** @brief Timer for interval capture. */
+    QTimer m_intervalTimer;
+
+    MonitorManager *m_manager;
+
+    /** @brief The monitor is used to control the v4l capture device from the monitormanager class. */
+    StopmotionMonitor *m_monitor;
 
+    /** @brief Create the XML playlist. */
+    const QString createProducer(const MltVideoProfile &profile, const QString &service, const QString &resource);
 
-#ifdef QIMAGEBLITZ
+    /** @brief A new frame arrived, reload overlay. */
+    void reloadOverlay();
+
+    /** @brief Holds the index of the effect to be applied to the video feed. */
     int m_effectIndex;
-#endif
 
-private slots:
+
+public slots:
     /** @brief Display the live feed from capture device.
      @param isOn enable or disable the feature */
-    void slotLive(bool isOn);
+    void slotLive(bool isOn = true);
+    void slotStopCapture();
+
+private slots:
 
     /** @brief Display the last captured frame over current live feed.
      @param isOn enable or disable the feature */
@@ -128,13 +178,13 @@ private slots:
     void slotUpdateOverlay();
 
     /** @brief User changed the capture name. */
-    void sequenceNameChanged(const QString &name);
+    void sequenceNameChanged(const QStringname);
 
     /** @brief Grab a frame from current capture feed. */
     void slotCaptureFrame();
 
     /** @brief Display a previous frame in monitor. */
-    void slotShowFrame(const QString &path);
+    void slotShowFrame(const QStringpath);
 
     /** @brief Get full path for a frame in the sequence.
      *  @param ix the frame number.
@@ -158,37 +208,50 @@ private slots:
     void slotSeekFrame(bool forward);
 
     /** @brief Display warning / error message from capture backend. */
-    void slotGotHDMIMessage(const QString &message);
+    void slotGotHDMIMessage(const QStringmessage);
 
     /** @brief Create thumbnails for existing sequence frames. */
-    void slotCreateThumbs(QImage img, int ix);
+    void slotCreateThumbs(const QImage &img, int ix);
 
     /** @brief Prepare thumbnails creation. */
     void slotPrepareThumbs();
 
     /** @brief Called when user switches the video capture backend. */
-    void slotUpdateHandler();
+    void slotUpdateDeviceHandler();
 
     /** @brief Show / hide sequence thumbnails. */
     void slotShowThumbs(bool show);
 
-    /** @brief Capture one frame every interval time. */
-    void slotIntervalCapture(bool capture);
-
-    /** @brief Set the interval between each capture (in seconds). */
-    void slotSetCaptureInterval();
+    /** @brief Show the config dialog */
+    void slotConfigure();
 
     /** @brief Prepare to crete thumb for newly captured frame. */
-    void slotNewThumb(const QString path);
+    void slotNewThumb(const QString &path);
 
     /** @brief Set the effect to be applied to overlay frame. */
-    void slotUpdateOverlayEffect(QAction *act);
+    void slotUpdateOverlayEffect(QAction* act);
+
+    /** @brief Switch between live view / currently selected frame. */
+    void slotSwitchLive();
+
+    /** @brief Delete current frame from disk. */
+    void slotRemoveFrame();
+    
+    /** @brief Enable / disable frame analysis (in color scopes). */
+    void slotSwitchAnalyse(bool isOn);
+
+    /** @brief Enable / disable horizontal mirror effect. */
+    void slotSwitchMirror(bool isOn);
+    
+    /** @brief Send a notification a few seconds before capturing. */
+    void slotPreNotify();
 
 signals:
     /** @brief Ask to add sequence to current project. */
-    void addOrUpdateSequence(const QString);
+    void addOrUpdateSequence(const QString &);
 
-    void doCreateThumbs(QImage, int);
+    void doCreateThumbs(const QImage&, int);
+    void gotFrame(const QImage&);
 };
 
 #endif