]> git.sesse.net Git - kdenlive/blob - src/stopmotion/stopmotion.h
59544c395d3dc7728139ea29863fb411c27bae8e
[kdenlive] / src / stopmotion / stopmotion.h
1 /***************************************************************************
2                           titlewidget.h  -  description
3                              -------------------
4     begin                : Feb 28 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #ifndef STOPMOTION_H
19 #define STOPMOTION_H
20
21 #include "ui_stopmotion_ui.h"
22 #include "../blackmagic/capture.h"
23
24 #include <KUrl>
25 #include <QLabel>
26
27 class MyLabel : public QLabel
28 {
29   Q_OBJECT
30 public:
31     MyLabel(QWidget *parent = 0);
32     void setImage(QImage img);
33
34 protected:
35     virtual void paintEvent( QPaintEvent * event);
36     virtual void wheelEvent(QWheelEvent * event);
37
38 private:
39     QImage m_img;
40
41 signals:
42     /** @brief Seek to next or previous frame.
43      *  @param forward set to true to go to next frame, fals to go to previous frame */
44     void seek(bool forward);
45 };
46
47 class StopmotionWidget : public QDialog , public Ui::Stopmotion_UI
48 {
49     Q_OBJECT
50
51 public:
52
53     /** @brief Build the stopmotion dialog.
54      * @param projectFolder The current project folder, where captured files will be stored.
55      * @param parent (optional) parent widget */
56     StopmotionWidget(KUrl projectFolder, QWidget *parent = 0);
57     virtual ~StopmotionWidget();
58
59
60 protected:
61
62
63 private:
64   /** @brief Current project folder (where the captured frames will be saved). */
65   KUrl m_projectFolder;
66
67   /** @brief Capture holder that will handle all video operation. */
68   CaptureHandler *m_bmCapture;
69
70   /** @brief Holds the name of the current sequence.
71    * Files will be saved in project folder with name: sequence001.png */
72   QString m_sequenceName;
73
74   /** @brief Holds the frame number of the current sequence. */
75   int m_sequenceFrame;
76
77   QAction *m_captureAction;
78   
79   /** @brief Holds the index of the frame to be displayed in the frame preview mode. */
80   int m_animatedIndex;
81
82   /** @brief Find all stopmotion sequences in current project folder. */
83   void parseExistingSequences();
84
85   /** @brief Select a frame in the list. */
86   void selectFrame(int ix);
87
88   /** @brief This widget will hold the frame preview. */
89   MyLabel *m_frame_preview;
90   
91 private slots:
92   /** @brief Display the live feed from capture device.
93    @param isOn enable or disable the feature */
94   void slotLive(bool isOn);
95
96   /** @brief Display the last captured frame over current live feed.
97    @param isOn enable or disable the feature */
98   void slotShowOverlay(bool isOn);
99
100   /** @brief Display the last captured frame over current live feed. */
101   void slotUpdateOverlay();
102
103   /** @brief User changed the capture name. */
104   void sequenceNameChanged(const QString &name);
105
106   /** @brief Grab a frame from current capture feed. */
107   void slotCaptureFrame();
108
109   /** @brief Display a previous frame in monitor. */
110   void slotShowFrame(int);
111
112   /** @brief Get full path for a frame in the sequence.
113    *  @param ix the frame number.
114    *  @param seqName (optional) the name of the sequence. */
115   QString getPathForFrame(int ix, QString seqName = QString());
116
117   /** @brief Add sequence to current project. */
118   void slotAddSequence();
119
120   /** @brief Update the frame list widget with newly created frame. */
121   void slotUpdateFrameList(int ix = -1);
122   
123   /** @brief Display selected fram in monitor. */
124   void slotShowSelectedFrame();
125
126   /** @brief Start animation preview mode. */
127   void slotPlayPreview();
128   
129   /** @brief Simulate animation. */
130   void slotAnimate();
131   
132   /** @brief Seek to previous or next captured frame.
133    *  @param forward set to true for next frame, false for previous one. */
134   void slotSeekFrame(bool forward);
135
136 signals:
137   /** @brief Ask to add sequence to current project. */
138   void addOrUpdateSequence(const QString);
139 };
140
141 #endif