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"
28 class MyLabel : public QLabel
32 MyLabel(QWidget *parent = 0);
33 void setImage(QImage img);
36 virtual void paintEvent( QPaintEvent * event);
37 virtual void wheelEvent(QWheelEvent * event);
43 /** @brief Seek to next or previous frame.
44 * @param forward set to true to go to next frame, fals to go to previous frame */
45 void seek(bool forward);
48 class StopmotionWidget : public QDialog , public Ui::Stopmotion_UI
54 /** @brief Build the stopmotion dialog.
55 * @param projectFolder The current project folder, where captured files will be stored.
56 * @param parent (optional) parent widget */
57 StopmotionWidget(KUrl projectFolder, QWidget *parent = 0);
58 virtual ~StopmotionWidget();
65 /** @brief Current project folder (where the captured frames will be saved). */
68 /** @brief Capture holder that will handle all video operation. */
69 CaptureHandler *m_bmCapture;
71 /** @brief Holds the name of the current sequence.
72 * Files will be saved in project folder with name: sequence001.png */
73 QString m_sequenceName;
75 /** @brief Holds the frame number of the current sequence. */
78 QAction *m_captureAction;
80 /** @brief Holds the index of the frame to be displayed in the frame preview mode. */
83 /** @brief Find all stopmotion sequences in current project folder. */
84 void parseExistingSequences();
86 /** @brief Select a frame in the list. */
87 void selectFrame(int ix);
89 /** @brief This widget will hold the frame preview. */
90 MyLabel *m_frame_preview;
92 /** @brief The list of files in the sequence to create thumbnails. */
93 QStringList m_filesList;
95 /** @brief The index of currently created thumbnail. */
98 /** @brief Holds the state of the threaded thumbnail generation. */
99 QFuture<void> m_future;
102 /** @brief Display the live feed from capture device.
103 @param isOn enable or disable the feature */
104 void slotLive(bool isOn);
106 /** @brief Display the last captured frame over current live feed.
107 @param isOn enable or disable the feature */
108 void slotShowOverlay(bool isOn);
110 /** @brief Display the last captured frame over current live feed. */
111 void slotUpdateOverlay();
113 /** @brief User changed the capture name. */
114 void sequenceNameChanged(const QString &name);
116 /** @brief Grab a frame from current capture feed. */
117 void slotCaptureFrame();
119 /** @brief Display a previous frame in monitor. */
120 void slotShowFrame(int);
122 /** @brief Get full path for a frame in the sequence.
123 * @param ix the frame number.
124 * @param seqName (optional) the name of the sequence. */
125 QString getPathForFrame(int ix, QString seqName = QString());
127 /** @brief Add sequence to current project. */
128 void slotAddSequence();
130 /** @brief Update the frame list widget with newly created frame. */
131 void slotUpdateFrameList(int ix = -1);
133 /** @brief Display selected fram in monitor. */
134 void slotShowSelectedFrame();
136 /** @brief Start animation preview mode. */
137 void slotPlayPreview();
139 /** @brief Simulate animation. */
142 /** @brief Seek to previous or next captured frame.
143 * @param forward set to true for next frame, false for previous one. */
144 void slotSeekFrame(bool forward);
146 void slotCreateThumbs(QImage img, int ix);
147 void slotPrepareThumbs();
150 /** @brief Ask to add sequence to current project. */
151 void addOrUpdateSequence(const QString);
153 void doCreateThumbs(QImage, int);