1 /***************************************************************************
2 titlewidget.h - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
21 #include "ui_stopmotion_ui.h"
22 #include "../blackmagic/capture.h"
27 #include <QVBoxLayout>
29 class MyLabel : public QLabel
33 MyLabel(QWidget *parent = 0);
34 void setImage(QImage img);
37 virtual void paintEvent( QPaintEvent * event);
38 virtual void wheelEvent(QWheelEvent * event);
44 /** @brief Seek to next or previous frame.
45 * @param forward set to true to go to next frame, fals to go to previous frame */
46 void seek(bool forward);
49 class StopmotionWidget : public QDialog , public Ui::Stopmotion_UI
55 /** @brief Build the stopmotion dialog.
56 * @param projectFolder The current project folder, where captured files will be stored.
57 * @param parent (optional) parent widget */
58 StopmotionWidget(KUrl projectFolder, QWidget *parent = 0);
59 virtual ~StopmotionWidget();
66 /** @brief Widget layout holding video and frame preview. */
67 QVBoxLayout *m_layout;
69 /** @brief Current project folder (where the captured frames will be saved). */
72 /** @brief Capture holder that will handle all video operation. */
73 CaptureHandler *m_bmCapture;
75 /** @brief Holds the name of the current sequence.
76 * Files will be saved in project folder with name: sequence001.png */
77 QString m_sequenceName;
79 /** @brief Holds the frame number of the current sequence. */
82 QAction *m_captureAction;
84 /** @brief Holds the index of the frame to be displayed in the frame preview mode. */
87 /** @brief Find all stopmotion sequences in current project folder. */
88 void parseExistingSequences();
90 /** @brief Select a frame in the list. */
91 void selectFrame(int ix);
93 /** @brief This widget will hold the frame preview. */
94 MyLabel *m_frame_preview;
96 /** @brief The list of files in the sequence to create thumbnails. */
97 QStringList m_filesList;
99 /** @brief The index of currently created thumbnail. */
102 /** @brief Holds the state of the threaded thumbnail generation. */
103 QFuture<void> m_future;
105 /** @brief Get the frame number ix. */
106 QListWidgetItem *getFrameFromIndex(int ix);
109 /** @brief Display the live feed from capture device.
110 @param isOn enable or disable the feature */
111 void slotLive(bool isOn);
113 /** @brief Display the last captured frame over current live feed.
114 @param isOn enable or disable the feature */
115 void slotShowOverlay(bool isOn);
117 /** @brief Display the last captured frame over current live feed. */
118 void slotUpdateOverlay();
120 /** @brief User changed the capture name. */
121 void sequenceNameChanged(const QString &name);
123 /** @brief Grab a frame from current capture feed. */
124 void slotCaptureFrame();
126 /** @brief Display a previous frame in monitor. */
127 void slotShowFrame(int);
129 /** @brief Get full path for a frame in the sequence.
130 * @param ix the frame number.
131 * @param seqName (optional) the name of the sequence. */
132 QString getPathForFrame(int ix, QString seqName = QString());
134 /** @brief Add sequence to current project. */
135 void slotAddSequence();
137 /** @brief Update the frame list widget with newly created frame. */
138 void slotUpdateFrameList(int ix = -1);
140 /** @brief Display selected fram in monitor. */
141 void slotShowSelectedFrame();
143 /** @brief Start animation preview mode. */
144 void slotPlayPreview();
146 /** @brief Simulate animation. */
149 /** @brief Seek to previous or next captured frame.
150 * @param forward set to true for next frame, false for previous one. */
151 void slotSeekFrame(bool forward);
153 /** @brief Display warning / error message from capture backend. */
154 void slotGotHDMIMessage(const QString &message);
156 /** @brief Create thumbnails for existing sequence frames. */
157 void slotCreateThumbs(QImage img, int ix);
159 /** @brief Prepare thumbnails creation. */
160 void slotPrepareThumbs();
162 /** @brief Called when user switches the video capture backend. */
163 void slotUpdateHandler();
166 /** @brief Ask to add sequence to current project. */
167 void addOrUpdateSequence(const QString);
169 void doCreateThumbs(QImage, int);