#include <kdeversion.h>
#include <KNotification>
+#ifdef QIMAGEBLITZ
+#include <qimageblitz/qimageblitz.h>
+#endif
+
#include <QtConcurrentRun>
#include <QInputDialog>
#include <QComboBox>
#include <QPainter>
#include <QAction>
#include <QWheelEvent>
+#include <QMenu>
MyLabel::MyLabel(QWidget *parent) :
QLabel(parent)
//virtual
void MyLabel::wheelEvent(QWheelEvent * event)
{
- if (event->delta() > 0) emit seek(true);
+ if(event->delta() > 0) emit seek(true);
else emit seek(false);
}
int pictureHeight = height();
int pictureWidth = width();
int calculatedWidth = aspect_ratio * height();
- if (calculatedWidth > width()) pictureHeight = width() / aspect_ratio;
+ if(calculatedWidth > width()) pictureHeight = width() / aspect_ratio;
else {
int calculatedHeight = width() / aspect_ratio;
- if (calculatedHeight > height()) pictureWidth = height() * aspect_ratio;
+ if(calculatedHeight > height()) pictureWidth = height() * aspect_ratio;
}
p.drawImage(QRect((width() - pictureWidth) / 2, (height() - pictureHeight) / 2, pictureWidth, pictureHeight), m_img, QRect(0, 0, m_img.width(), m_img.height()));
p.end();
setFont(KGlobalSettings::toolBarFont());
live_button->setIcon(KIcon("camera-photo"));
- frameoverlay_button->setIcon(KIcon("edit-paste"));
m_captureAction = new QAction(KIcon("media-record"), i18n("Capture frame"), this);
m_captureAction->setShortcut(QKeySequence(Qt::Key_Space));
connect(m_captureAction, SIGNAL(triggered()), this, SLOT(slotCaptureFrame()));
capture_button->setDefaultAction(m_captureAction);
preview_button->setIcon(KIcon("media-playback-start"));
- removelast_button->setIcon(KIcon("edit-delete"));
- frameoverlay_button->setEnabled(false);
- removelast_button->setEnabled(false);
capture_button->setEnabled(false);
+ // Build config menu
+ QMenu *confMenu = new QMenu;
+ m_showOverlay = new QAction(KIcon("edit-paste"), i18n("Show last frame over video"), this);
+ m_showOverlay->setCheckable(true);
+ m_showOverlay->setChecked(false);
+ connect(m_showOverlay, SIGNAL(triggered(bool)), this, SLOT(slotShowOverlay(bool)));
+ confMenu->addAction(m_showOverlay);
+
+#ifdef QIMAGEBLITZ
+ m_effectIndex = KdenliveSettings::blitzeffect();
+ QMenu *effectsMenu = new QMenu(i18n("Overlay effect"));
+ QActionGroup *effectGroup = new QActionGroup(this);
+ QAction *noEffect = new QAction(i18n("No Effect"), effectGroup);
+ noEffect->setData(1);
+ QAction *contrastEffect = new QAction(i18n("Contrast"), effectGroup);
+ contrastEffect->setData(2);
+ QAction *edgeEffect = new QAction(i18n("Edge detect"), effectGroup);
+ edgeEffect->setData(3);
+ QAction *brightEffect = new QAction(i18n("Brighten"), effectGroup);
+ brightEffect->setData(4);
+ QAction *invertEffect = new QAction(i18n("Invert"), effectGroup);
+ invertEffect->setData(5);
+ QAction *thresEffect = new QAction(i18n("Threshold"), effectGroup);
+ thresEffect->setData(6);
+
+ effectsMenu->addAction(noEffect);
+ effectsMenu->addAction(contrastEffect);
+ effectsMenu->addAction(edgeEffect);
+ effectsMenu->addAction(brightEffect);
+ effectsMenu->addAction(invertEffect);
+ effectsMenu->addAction(thresEffect);
+ QList <QAction *> list = effectsMenu->actions();
+ for(int i = 0; i < list.count(); i++) {
+ list.at(i)->setCheckable(true);
+ if(list.at(i)->data().toInt() == m_effectIndex) {
+ list.at(i)->setChecked(true);
+ }
+ }
+ connect(effectsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotUpdateOverlayEffect(QAction*)));
+ confMenu->addMenu(effectsMenu);
+#endif
+
+ QAction *showThumbs = new QAction(KIcon("image-x-generic"), i18n("Show sequence thumbnails"), this);
+ showThumbs->setCheckable(true);
+ showThumbs->setChecked(KdenliveSettings::showstopmotionthumbs());
+ connect(showThumbs, SIGNAL(triggered(bool)), this, SLOT(slotShowThumbs(bool)));
+
+ QAction *removeCurrent = new QAction(KIcon("edit-delete"), i18n("Delete current frame"), this);
+ //TODO: implement frame deletion
+ //connect(removeCurrent, SIGNAL(triggered()), this, SLOT(slotRemoveFrame()));
+
+ QAction *capInterval = new QAction(KIcon(), i18n("Set capture interval"), this);
+ connect(capInterval, SIGNAL(triggered()), this, SLOT(slotSetCaptureInterval()));
+
+ confMenu->addAction(showThumbs);
+ confMenu->addAction(capInterval);
+ confMenu->addAction(removeCurrent);
+ config_button->setIcon(KIcon("configure"));
+ config_button->setMenu(confMenu);
+
+ // Build capture menu
+ QMenu *capMenu = new QMenu;
+ m_intervalCapture = new QAction(KIcon("edit-redo"), i18n("Interval capture"), this);
+ m_intervalCapture->setCheckable(true);
+ m_intervalCapture->setChecked(false);
+ connect(m_intervalCapture, SIGNAL(triggered(bool)), this, SLOT(slotIntervalCapture(bool)));
+ capMenu->addAction(m_intervalCapture);
+ capture_button->setMenu(capMenu);
+
connect(sequence_name, SIGNAL(textChanged(const QString &)), this, SLOT(sequenceNameChanged(const QString &)));
m_layout = new QVBoxLayout;
- if (BMInterface::getBlackMagicDeviceList(capture_device, NULL)) {
+ if(BMInterface::getBlackMagicDeviceList(capture_device, NULL)) {
// Found a BlackMagic device
m_bmCapture = new BmdCaptureHandler(m_layout);
connect(m_bmCapture, SIGNAL(gotMessage(const QString &)), this, SLOT(slotGotHDMIMessage(const QString &)));
}
- if (QFile::exists(KdenliveSettings::video4vdevice())) {
- if (m_bmCapture == NULL) m_bmCapture = new V4lCaptureHandler(m_layout);
+ if(QFile::exists(KdenliveSettings::video4vdevice())) {
+ if(m_bmCapture == NULL) m_bmCapture = new V4lCaptureHandler(m_layout);
capture_device->addItem(KdenliveSettings::video4vdevice(), "v4l");
}
+
+ connect(m_bmCapture, SIGNAL(frameSaved(const QString)), this, SLOT(slotNewThumb(const QString)));
connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateHandler()));
m_frame_preview = new MyLabel(this);
connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool)));
m_frame_preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
video_preview->setLayout(m_layout);
live_button->setChecked(false);
- frameoverlay_button->setChecked(false);
button_addsequence->setEnabled(false);
connect(live_button, SIGNAL(clicked(bool)), this, SLOT(slotLive(bool)));
- connect(frameoverlay_button, SIGNAL(clicked(bool)), this, SLOT(slotShowOverlay(bool)));
- connect(frame_number, SIGNAL(valueChanged(int)), this, SLOT(slotShowFrame(int)));
connect(button_addsequence, SIGNAL(clicked(bool)), this, SLOT(slotAddSequence()));
connect(preview_button, SIGNAL(clicked(bool)), this, SLOT(slotPlayPreview()));
connect(frame_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotShowSelectedFrame()));
connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));
+ frame_list->setHidden(!KdenliveSettings::showstopmotionthumbs());
parseExistingSequences();
}
m_bmCapture->stopPreview();
}
+void StopmotionWidget::slotUpdateOverlayEffect(QAction *act)
+{
+#ifdef QIMAGEBLITZ
+ if(act) m_effectIndex = act->data().toInt();
+ KdenliveSettings::setBlitzeffect(m_effectIndex);
+ if(m_showOverlay->isChecked()) slotUpdateOverlay();
+#endif
+}
+
+void StopmotionWidget::closeEvent(QCloseEvent *e)
+{
+ slotLive(false);
+ live_button->setChecked(false);
+ QDialog::closeEvent(e);
+}
+
+void StopmotionWidget::slotSetCaptureInterval()
+{
+ int interval = QInputDialog::getInteger(this, i18n("Set Capture Interval"), i18n("Interval (in seconds)"), KdenliveSettings::captureinterval(), 1);
+ if(interval > 0 && interval != KdenliveSettings::captureinterval())
+ KdenliveSettings::setCaptureinterval(interval);
+}
+
+void StopmotionWidget::slotShowThumbs(bool show)
+{
+ KdenliveSettings::setShowstopmotionthumbs(show);
+ kDebug() << "SHOW THUMBS: " << show;
+ if(show) {
+ frame_list->clear();
+ sequenceNameChanged(sequence_name->currentText());
+ } else {
+ m_filesList.clear();
+ frame_list->clear();
+ }
+ frame_list->setHidden(!show);
+}
+
+void StopmotionWidget::slotIntervalCapture(bool capture)
+{
+ if(capture) slotCaptureFrame();
+}
+
+
void StopmotionWidget::slotUpdateHandler()
{
QString data = capture_device->itemData(capture_device->currentIndex()).toString();
m_bmCapture->stopPreview();
delete m_bmCapture;
m_layout->removeWidget(m_frame_preview);
- if (data == "v4l") {
+ if(data == "v4l") {
m_bmCapture = new V4lCaptureHandler(m_layout);
} else {
m_bmCapture = new BmdCaptureHandler(m_layout);
void StopmotionWidget::slotLive(bool isOn)
{
- if (isOn) {
+ if(isOn) {
m_frame_preview->setImage(QImage());
m_frame_preview->setHidden(true);
m_bmCapture->startPreview(KdenliveSettings::hdmi_capturedevice(), KdenliveSettings::hdmi_capturemode());
void StopmotionWidget::slotShowOverlay(bool isOn)
{
- if (isOn) {
- if (live_button->isChecked() && m_sequenceFrame > 0) {
+ if(isOn) {
+ if(live_button->isChecked() && m_sequenceFrame > 0) {
slotUpdateOverlay();
}
} else {
void StopmotionWidget::slotUpdateOverlay()
{
QString path = getPathForFrame(m_sequenceFrame - 1);
- if (!QFile::exists(path)) return;
+ if(!QFile::exists(path)) return;
QImage img(path);
- if (img.isNull()) {
+ if(img.isNull()) {
QTimer::singleShot(1000, this, SLOT(slotUpdateOverlay()));
return;
}
+
+#ifdef QIMAGEBLITZ
+ //img = Blitz::convolveEdge(img, 0, Blitz::Low);
+ switch(m_effectIndex) {
+ case 2:
+ img = Blitz::contrast(img, true);
+ break;
+ case 3:
+ img = Blitz::edge(img);
+ break;
+ case 4:
+ img = Blitz::intensity(img, 0.5);
+ break;
+ case 5:
+ Blitz::invert(img);
+ break;
+ case 6:
+ img = Blitz::threshold(img, 200, Blitz::Grayscale, qRgba(255, 0, 0, 255), qRgba(0, 0, 0, 0));
+ break;
+ default:
+ break;
+
+ }
+#endif
m_bmCapture->showOverlay(img);
}
m_filesList.clear();
m_future.waitForFinished();
frame_list->clear();
- if (name.isEmpty()) {
+ if(name.isEmpty()) {
button_addsequence->setEnabled(false);
- frame_number->blockSignals(true);
- frame_number->setValue(m_sequenceFrame);
- frame_number->blockSignals(false);
- frameoverlay_button->setEnabled(false);
- removelast_button->setEnabled(false);
} else {
// Check if we are editing an existing sequence
QString pattern = SlideshowClip::selectedPath(getPathForFrame(0, sequence_name->currentText()), false, QString(), &m_filesList);
- m_sequenceFrame = m_filesList.size();
- frame_number->blockSignals(true);
- frame_number->setValue(0);
- frame_number->blockSignals(false);
- m_currentIndex = 0;
- if (!m_filesList.isEmpty()) {
+ m_sequenceFrame = m_filesList.isEmpty() ? 0 : SlideshowClip::getFrameNumberFromPath(m_filesList.last()) + 1;
+ if(!m_filesList.isEmpty()) {
m_sequenceName = sequence_name->currentText();
connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));
m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
button_addsequence->setEnabled(true);
- frameoverlay_button->setEnabled(true);
} else {
+ // new sequence
+ connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));
button_addsequence->setEnabled(false);
- frameoverlay_button->setEnabled(false);
}
- frame_number->setRange(0, m_sequenceFrame);
- capture_button->setEnabled(true);
+ capture_button->setEnabled(live_button->isChecked());
}
}
void StopmotionWidget::slotCaptureFrame()
{
- if (sequence_name->currentText().isEmpty()) {
+ if(sequence_name->currentText().isEmpty()) {
QString seqName = QInputDialog::getText(this, i18n("Create New Sequence"), i18n("Enter sequence name"));
- if (seqName.isEmpty()) return;
+ if(seqName.isEmpty()) return;
sequence_name->blockSignals(true);
sequence_name->setItemText(sequence_name->currentIndex(), seqName);
sequence_name->blockSignals(false);
}
- if (m_sequenceName != sequence_name->currentText()) {
+ if(m_sequenceName != sequence_name->currentText()) {
m_sequenceName = sequence_name->currentText();
m_sequenceFrame = 0;
}
- capture_button->setEnabled(false);
- m_bmCapture->captureFrame(getPathForFrame(m_sequenceFrame));
+ //capture_button->setEnabled(false);
+ QString currentPath = getPathForFrame(m_sequenceFrame);
+ kDebug() << "Capture FRame NB: " << m_sequenceFrame;
+ m_bmCapture->captureFrame(currentPath);
KNotification::event("FrameCaptured");
- frameoverlay_button->setEnabled(true);
m_sequenceFrame++;
- frame_number->setRange(0, m_sequenceFrame);
- frame_number->blockSignals(true);
- frame_number->setValue(m_sequenceFrame);
- frame_number->blockSignals(false);
button_addsequence->setEnabled(true);
- //if (frameoverlay_button->isChecked()) QTimer::singleShot(1000, this, SLOT(slotUpdateOverlay()));
- QTimer::singleShot(1000, this, SLOT(slotUpdateFrameList()));
+ if(m_intervalCapture->isChecked()) QTimer::singleShot(KdenliveSettings::captureinterval() * 1000, this, SLOT(slotCaptureFrame()));
+}
+
+
+void StopmotionWidget::slotNewThumb(const QString path)
+{
+ if(!KdenliveSettings::showstopmotionthumbs()) return;
+ m_filesList.append(path);
+ if(m_showOverlay->isChecked()) slotUpdateOverlay();
+ if(!m_future.isRunning()) m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
}
void StopmotionWidget::slotPrepareThumbs()
{
- if (m_filesList.isEmpty()) return;
+ if(m_filesList.isEmpty()) return;
QString path = m_filesList.takeFirst();
emit doCreateThumbs(QImage(path), SlideshowClip::getFrameNumberFromPath(path));
void StopmotionWidget::slotCreateThumbs(QImage img, int ix)
{
- if (img.isNull()) {
+ if(img.isNull()) {
m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
return;
}
QString nb = QString::number(ix);
QPainter p(&pix);
QFontInfo finfo(font());
- p.fillRect(0, 0, finfo.pixelSize() * nb.count() + 6, finfo.pixelSize() + 6, QColor(0, 0, 0, 150));
+ p.fillRect(0, 0, finfo.pixelSize() * nb.count() + 6, finfo.pixelSize() + 6, QColor(80, 80, 80, 150));
p.setPen(Qt::white);
p.drawText(QPoint(3, finfo.pixelSize() + 3), nb);
p.end();
m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
}
-void StopmotionWidget::slotUpdateFrameList(int ix)
-{
- kDebug() << "// GET FRAME: " << ix;
- if (ix == -1) ix = m_sequenceFrame - 1;
- QString path = getPathForFrame(ix);
- if (!QFile::exists(path)) {
- capture_button->setEnabled(true);
- return;
- }
- QImage img(path);
- if (img.isNull()) {
- if (ix == m_sequenceFrame - 1) QTimer::singleShot(1000, this, SLOT(slotUpdateFrameList()));
- return;
- }
- int height = 90;
- int width = height * img.width() / img.height();
- frame_list->setIconSize(QSize(width, height));
- QPixmap pix = QPixmap::fromImage(img).scaled(width, height);
- QString nb = QString::number(ix);
- QPainter p(&pix);
- QFontInfo finfo(font());
- p.fillRect(0, 0, finfo.pixelSize() * nb.count() + 6, finfo.pixelSize() + 6, QColor(0, 0, 0, 150));
- p.setPen(Qt::white);
- p.drawText(QPoint(3, finfo.pixelSize() + 3), nb);
- p.end();
- QIcon icon(pix);
- QListWidgetItem *item = new QListWidgetItem(icon, QString(), frame_list);
- item->setData(Qt::UserRole, ix);
- frame_list->blockSignals(true);
- frame_list->setCurrentItem(item);
- frame_list->blockSignals(true);
- capture_button->setEnabled(true);
-}
-
QString StopmotionWidget::getPathForFrame(int ix, QString seqName)
{
- if (seqName.isEmpty()) seqName = m_sequenceName;
+ if(seqName.isEmpty()) seqName = m_sequenceName;
return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + "_" + QString::number(ix).rightJustified(4, '0', false) + ".png";
}
void StopmotionWidget::slotShowFrame(int ix)
{
- if (m_sequenceFrame == 0) {
+ if(m_sequenceFrame == 0) {
//there are no images in sequence
return;
}
- frameoverlay_button->blockSignals(true);
- frameoverlay_button->setChecked(false);
- frameoverlay_button->blockSignals(false);
- if (ix < m_sequenceFrame) {
+ if(ix < m_sequenceFrame) {
// Show previous frame
slotLive(false);
live_button->setChecked(false);
QImage img(getPathForFrame(ix));
capture_button->setEnabled(false);
- if (!img.isNull()) {
+ if(!img.isNull()) {
//m_bmCapture->showOverlay(img, false);
m_bmCapture->hidePreview(true);
m_frame_preview->setImage(img);
void StopmotionWidget::slotShowSelectedFrame()
{
QListWidgetItem *item = frame_list->currentItem();
- if (item) {
- int ix = item->data(Qt::UserRole).toInt();
- //frame_number->blockSignals(true);
- frame_number->setValue(ix);
- //frame_number->blockSignals(false);
+ if(item) {
+ int ix = item->data(Qt::UserRole).toInt();;
//slotShowFrame(ix);
}
}
void StopmotionWidget::slotPlayPreview()
{
- if (m_animatedIndex != -1) {
+ if(m_animatedIndex != -1) {
// stop animation
m_animatedIndex = -1;
return;
}
QListWidgetItem *item = frame_list->currentItem();
- if (item) {
+ if(item) {
m_animatedIndex = item->data(Qt::UserRole).toInt();
}
QTimer::singleShot(200, this, SLOT(slotAnimate()));
{
slotShowFrame(m_animatedIndex);
m_animatedIndex++;
- if (m_animatedIndex < m_sequenceFrame) QTimer::singleShot(200, this, SLOT(slotAnimate()));
+ if(m_animatedIndex < m_sequenceFrame) QTimer::singleShot(200, this, SLOT(slotAnimate()));
else m_animatedIndex = -1;
}
{
QListWidgetItem *item = NULL;
int pos = ix;
- if (ix >= frame_list->count()) {
+ if(ix >= frame_list->count()) {
pos = frame_list->count() - 1;
}
- if (ix < 0) pos = 0;
+ if(ix < 0) pos = 0;
item = frame_list->item(pos);
int value = item->data(Qt::UserRole).toInt();
- if (value == ix) return item;
- else if (value < ix) {
+ if(value == ix) return item;
+ else if(value < ix) {
pos++;
- while (pos < frame_list->count()) {
+ while(pos < frame_list->count()) {
item = frame_list->item(pos);
value = item->data(Qt::UserRole).toInt();
- if (value == ix) return item;
+ if(value == ix) return item;
pos++;
}
} else {
pos --;
- while (pos >= 0) {
+ while(pos >= 0) {
item = frame_list->item(pos);
value = item->data(Qt::UserRole).toInt();
- if (value == ix) return item;
+ if(value == ix) return item;
pos --;
}
}
{
frame_list->blockSignals(true);
QListWidgetItem *item = getFrameFromIndex(ix);
- if (!item) return;
+ if(!item) return;
frame_list->setCurrentItem(item);
frame_list->blockSignals(false);
}
void StopmotionWidget::slotSeekFrame(bool forward)
{
int ix = frame_list->currentRow();
- if (forward) {
- if (ix < frame_list->count() - 1) frame_list->setCurrentRow(ix + 1);
- } else if (ix > 0) frame_list->setCurrentRow(ix - 1);
+ if(forward) {
+ if(ix < frame_list->count() - 1) frame_list->setCurrentRow(ix + 1);
+ } else if(ix > 0) frame_list->setCurrentRow(ix - 1);
}
class MyLabel : public QLabel
{
- Q_OBJECT
+ Q_OBJECT
public:
MyLabel(QWidget *parent = 0);
void setImage(QImage img);
protected:
- virtual void paintEvent( QPaintEvent * event);
+ virtual void paintEvent(QPaintEvent * event);
virtual void wheelEvent(QWheelEvent * event);
private:
StopmotionWidget(KUrl projectFolder, QWidget *parent = 0);
virtual ~StopmotionWidget();
-
protected:
-
+ virtual void closeEvent(QCloseEvent *e);
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;
-
- /** @brief Holds the name of the current sequence.
- * Files will be saved in project folder with name: sequence001.png */
- QString m_sequenceName;
-
- /** @brief Holds the frame number of the current sequence. */
- int m_sequenceFrame;
-
- QAction *m_captureAction;
-
- /** @brief Holds the index of the frame to be displayed in the frame preview mode. */
- int m_animatedIndex;
-
- /** @brief Find all stopmotion sequences in current project folder. */
- void parseExistingSequences();
-
- /** @brief Select a frame in the list. */
- void selectFrame(int ix);
-
- /** @brief This widget will hold the frame preview. */
- MyLabel *m_frame_preview;
-
- /** @brief The list of files in the sequence to create thumbnails. */
- QStringList m_filesList;
-
- /** @brief The index of currently created thumbnail. */
- int m_currentIndex;
-
- /** @brief Holds the state of the threaded thumbnail generation. */
- QFuture<void> m_future;
-
- /** @brief Get the frame number ix. */
- QListWidgetItem *getFrameFromIndex(int ix);
-
+ /** @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;
+
+ /** @brief Holds the name of the current sequence.
+ * Files will be saved in project folder with name: sequence001.png */
+ QString m_sequenceName;
+
+ /** @brief Holds the frame number of the current sequence. */
+ int m_sequenceFrame;
+
+ QAction *m_captureAction;
+
+ /** @brief Holds the index of the frame to be displayed in the frame preview mode. */
+ int m_animatedIndex;
+
+ /** @brief Find all stopmotion sequences in current project folder. */
+ void parseExistingSequences();
+
+ /** @brief Select a frame in the list. */
+ void selectFrame(int ix);
+
+ /** @brief This widget will hold the frame preview. */
+ MyLabel *m_frame_preview;
+
+ /** @brief The list of files in the sequence to create thumbnails. */
+ QStringList m_filesList;
+
+ /** @brief Holds the state of the threaded thumbnail generation. */
+ QFuture<void> m_future;
+
+ /** @brief Get the frame number ix. */
+ QListWidgetItem *getFrameFromIndex(int ix);
+
+ /** @brief The action triggering interval capture. */
+ QAction *m_intervalCapture;
+
+ /** @brief The action triggering display of last frame over current live video feed. */
+ QAction *m_showOverlay;
+
+#ifdef QIMAGEBLITZ
+ int m_effectIndex;
+#endif
+
private slots:
- /** @brief Display the live feed from capture device.
- @param isOn enable or disable the feature */
- void slotLive(bool isOn);
+ /** @brief Display the live feed from capture device.
+ @param isOn enable or disable the feature */
+ void slotLive(bool isOn);
+
+ /** @brief Display the last captured frame over current live feed.
+ @param isOn enable or disable the feature */
+ void slotShowOverlay(bool isOn);
+
+ /** @brief Display the last captured frame over current live feed. */
+ void slotUpdateOverlay();
+
+ /** @brief User changed the capture name. */
+ void sequenceNameChanged(const QString &name);
+
+ /** @brief Grab a frame from current capture feed. */
+ void slotCaptureFrame();
+
+ /** @brief Display a previous frame in monitor. */
+ void slotShowFrame(int);
+
+ /** @brief Get full path for a frame in the sequence.
+ * @param ix the frame number.
+ * @param seqName (optional) the name of the sequence. */
+ QString getPathForFrame(int ix, QString seqName = QString());
+
+ /** @brief Add sequence to current project. */
+ void slotAddSequence();
- /** @brief Display the last captured frame over current live feed.
- @param isOn enable or disable the feature */
- void slotShowOverlay(bool isOn);
+ /** @brief Display selected fram in monitor. */
+ void slotShowSelectedFrame();
- /** @brief Display the last captured frame over current live feed. */
- void slotUpdateOverlay();
+ /** @brief Start animation preview mode. */
+ void slotPlayPreview();
- /** @brief User changed the capture name. */
- void sequenceNameChanged(const QString &name);
+ /** @brief Simulate animation. */
+ void slotAnimate();
- /** @brief Grab a frame from current capture feed. */
- void slotCaptureFrame();
+ /** @brief Seek to previous or next captured frame.
+ * @param forward set to true for next frame, false for previous one. */
+ void slotSeekFrame(bool forward);
- /** @brief Display a previous frame in monitor. */
- void slotShowFrame(int);
+ /** @brief Display warning / error message from capture backend. */
+ void slotGotHDMIMessage(const QString &message);
- /** @brief Get full path for a frame in the sequence.
- * @param ix the frame number.
- * @param seqName (optional) the name of the sequence. */
- QString getPathForFrame(int ix, QString seqName = QString());
+ /** @brief Create thumbnails for existing sequence frames. */
+ void slotCreateThumbs(QImage img, int ix);
- /** @brief Add sequence to current project. */
- void slotAddSequence();
+ /** @brief Prepare thumbnails creation. */
+ void slotPrepareThumbs();
- /** @brief Update the frame list widget with newly created frame. */
- void slotUpdateFrameList(int ix = -1);
-
- /** @brief Display selected fram in monitor. */
- void slotShowSelectedFrame();
+ /** @brief Called when user switches the video capture backend. */
+ void slotUpdateHandler();
- /** @brief Start animation preview mode. */
- void slotPlayPreview();
-
- /** @brief Simulate animation. */
- void slotAnimate();
-
- /** @brief Seek to previous or next captured frame.
- * @param forward set to true for next frame, false for previous one. */
- void slotSeekFrame(bool forward);
+ /** @brief Show / hide sequence thumbnails. */
+ void slotShowThumbs(bool show);
- /** @brief Display warning / error message from capture backend. */
- void slotGotHDMIMessage(const QString &message);
+ /** @brief Capture one frame every interval time. */
+ void slotIntervalCapture(bool capture);
- /** @brief Create thumbnails for existing sequence frames. */
- void slotCreateThumbs(QImage img, int ix);
+ /** @brief Set the interval between each capture (in seconds). */
+ void slotSetCaptureInterval();
- /** @brief Prepare thumbnails creation. */
- void slotPrepareThumbs();
+ /** @brief Prepare to crete thumb for newly captured frame. */
+ void slotNewThumb(const QString path);
- /** @brief Called when user switches the video capture backend. */
- void slotUpdateHandler();
+ /** @brief Set the effect to be applied to overlay frame. */
+ void slotUpdateOverlayEffect(QAction *act);
signals:
- /** @brief Ask to add sequence to current project. */
- void addOrUpdateSequence(const QString);
+ /** @brief Ask to add sequence to current project. */
+ void addOrUpdateSequence(const QString);
- void doCreateThumbs(QImage, int);
+ void doCreateThumbs(QImage, int);
};
#endif
<rect>
<x>0</x>
<y>0</y>
- <width>643</width>
- <height>395</height>
+ <width>671</width>
+ <height>406</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="11">
+ <item row="0" column="0" colspan="13">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</widget>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QToolButton" name="live_button">
+ <item row="1" column="7">
+ <widget class="KComboBox" name="sequence_name">
<property name="toolTip">
- <string>Live view</string>
- </property>
- <property name="whatsThis">
- <string/>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
+ <string>Sequence name</string>
</property>
- <property name="autoRaise">
+ <property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QToolButton" name="frameoverlay_button">
+ <item row="1" column="9">
+ <widget class="KComboBox" name="capture_device">
<property name="toolTip">
- <string>Overlay last frame</string>
+ <string>Capture device</string>
</property>
<property name="whatsThis">
<string/>
</property>
- <property name="text">
- <string>...</string>
+ </widget>
+ </item>
+ <item row="1" column="10">
+ <widget class="KComboBox" name="log_box">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="checkable">
- <bool>true</bool>
+ <property name="maxCount">
+ <number>10</number>
</property>
- <property name="autoRaise">
- <bool>true</bool>
+ <property name="frame">
+ <bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="2">
+ <item row="1" column="11">
+ <widget class="QPushButton" name="button_addsequence">
+ <property name="text">
+ <string>Add to project</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="5">
<widget class="QToolButton" name="preview_button">
<property name="toolTip">
<string>Preview sequence</string>
</property>
</widget>
</item>
- <item row="1" column="4">
- <widget class="QSpinBox" name="frame_number">
- <property name="toolTip">
- <string>Frame number</string>
- </property>
- <property name="whatsThis">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="5">
- <widget class="QToolButton" name="capture_button">
+ <item row="1" column="2">
+ <widget class="QToolButton" name="config_button">
<property name="toolTip">
- <string>Capture frame</string>
+ <string>Overlay last frame</string>
</property>
<property name="whatsThis">
<string/>
<property name="text">
<string>...</string>
</property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
</widget>
</item>
- <item row="1" column="6">
- <widget class="QToolButton" name="removelast_button">
+ <item row="1" column="3">
+ <widget class="QToolButton" name="live_button">
<property name="toolTip">
- <string>Remove current frame</string>
+ <string>Live view</string>
</property>
<property name="whatsThis">
<string/>
<property name="text">
<string>...</string>
</property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
</widget>
</item>
- <item row="1" column="7">
- <widget class="KComboBox" name="capture_device">
+ <item row="1" column="4">
+ <widget class="QToolButton" name="capture_button">
<property name="toolTip">
- <string>Capture device</string>
+ <string>Capture frame</string>
</property>
<property name="whatsThis">
<string/>
</property>
- </widget>
- </item>
- <item row="1" column="9">
- <widget class="QPushButton" name="button_addsequence">
<property name="text">
- <string>Add to project</string>
- </property>
- </widget>
- </item>
- <item row="1" column="10">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <string>...</string>
</property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
+ <property name="popupMode">
+ <enum>QToolButton::MenuButtonPopup</enum>
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="KComboBox" name="sequence_name">
- <property name="toolTip">
+ <item row="1" column="6">
+ <widget class="QLabel" name="label">
+ <property name="text">
<string>Sequence name</string>
</property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="8">
- <widget class="KComboBox" name="log_box">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maxCount">
- <number>10</number>
- </property>
- <property name="frame">
- <bool>false</bool>
- </property>
</widget>
</item>
</layout>
</customwidget>
</customwidgets>
<resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>Stopmotion_UI</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>Stopmotion_UI</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>