]> git.sesse.net Git - kdenlive/blobdiff - src/stopmotion/stopmotion.cpp
use const'ref
[kdenlive] / src / stopmotion / stopmotion.cpp
index 1201eca687f838f40b4f977a69a812c4b5f12d3f..572664a96dfd12541591b59f4401bcd400057da9 100644 (file)
@@ -16,9 +16,6 @@
  ***************************************************************************/
 
 #include "stopmotion.h"
-#ifdef USE_BLACKMAGIC
-#include "blackmagic/devices.h"
-#endif
 #ifdef USE_V4L
 #include "v4l/v4lcapture.h"
 #endif
@@ -53,7 +50,7 @@ MyLabel::MyLabel(QWidget* parent) :
 {
 }
 
-void MyLabel::setImage(QImage img)
+void MyLabel::setImage(const QImage& img)
 {
     m_img = img;
 }
@@ -97,6 +94,7 @@ StopmotionMonitor::StopmotionMonitor(MonitorManager *manager, QWidget *parent) :
     AbstractMonitor(Kdenlive::stopmotionMonitor, manager, parent),
     m_captureDevice(NULL)
 {
+    createVideoSurface();
 }
 
 StopmotionMonitor::~StopmotionMonitor()
@@ -141,7 +139,7 @@ void StopmotionMonitor::slotMouseSeek(int /*eventDelta*/, bool /*fast*/)
 {
 }
 
-StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, QList< QAction* > actions, QWidget* parent) :
+StopmotionWidget::StopmotionWidget(MonitorManager *manager, const KUrl &projectFolder, const QList<QAction *> &actions, QWidget* parent) :
     QDialog(parent)
     , Ui::Stopmotion_UI()
     , m_projectFolder(projectFolder)
@@ -251,7 +249,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     config_button->setIcon(KIcon("configure"));
     config_button->setMenu(confMenu);
 
-    connect(sequence_name, SIGNAL(textChanged(const QString&)), this, SLOT(sequenceNameChanged(const QString&)));
+    connect(sequence_name, SIGNAL(textChanged(QString)), this, SLOT(sequenceNameChanged(QString)));
     connect(sequence_name, SIGNAL(currentIndexChanged(int)), live_button, SLOT(setFocus()));
 
     // Video widget holder
@@ -261,11 +259,10 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     m_monitor->videoBox->setLineWidth(4);
     layout->addWidget(m_monitor->videoBox);
 
-#ifdef USE_BLACKMAGIC
-    if (BMInterface::getBlackMagicDeviceList(capture_device)) {
+    if (KdenliveSettings::decklink_device_found()) {
         // Found a BlackMagic device
     }
-#endif
+
     if (QFile::exists(KdenliveSettings::video4vdevice())) {
 #ifdef USE_V4L
         // Video 4 Linux device detection
@@ -286,7 +283,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
 
     connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDeviceHandler()));
     /*if (m_bmCapture) {
-        connect(m_bmCapture, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &)));
+        connect(m_bmCapture, SIGNAL(frameSaved(QString)), this, SLOT(slotNewThumb(QString)));
         connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage)));
     } else live_button->setEnabled(false);*/
 
@@ -313,7 +310,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this);
     m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion();
     m_monitor->setRender(m_captureDevice);
-    connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &)));
+    connect(m_captureDevice, SIGNAL(frameSaved(QString)), this, SLOT(slotNewThumb(QString)));
 
     live_button->setChecked(false);
     button_addsequence->setEnabled(false);
@@ -322,7 +319,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     connect(preview_button, SIGNAL(clicked(bool)), this, SLOT(slotPlayPreview(bool)));
     connect(frame_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotShowSelectedFrame()));
     connect(frame_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotShowSelectedFrame()));
-    connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));
+    connect(this, SIGNAL(doCreateThumbs(QImage,int)), this, SLOT(slotCreateThumbs(QImage,int)));
 
     frame_list->addAction(removeCurrent);
     frame_list->setContextMenuPolicy(Qt::ActionsContextMenu);
@@ -416,7 +413,7 @@ void StopmotionWidget::slotUpdateDeviceHandler()
 #endif
     } else {
         m_bmCapture = new BmdCaptureHandler(m_layout);
-        if (m_bmCapture) connect(m_bmCapture, SIGNAL(gotMessage(const QString&)), this, SLOT(slotGotHDMIMessage(const QString&)));
+        if (m_bmCapture) connect(m_bmCapture, SIGNAL(gotMessage(QString)), this, SLOT(slotGotHDMIMessage(QString)));
     }
     live_button->setEnabled(m_bmCapture != NULL);
     m_layout->addWidget(m_frame_preview);*/
@@ -437,8 +434,8 @@ void StopmotionWidget::parseExistingSequences()
     //dir.setNameFilters(filters);
     QStringList sequences = dir.entryList(filters, QDir::Files, QDir::Name);
     //kDebug()<<"PF: "<<<<", sm: "<<sequences;
-    foreach(QString sequencename, sequences) {
-        sequence_name->addItem(sequencename.section("_", 0, -2));
+    foreach(const QString &sequencename, sequences) {
+        sequence_name->addItem(sequencename.section('_', 0, -2));
     }
 }
 
@@ -446,16 +443,6 @@ void StopmotionWidget::slotSwitchLive()
 {
     setUpdatesEnabled(false);
     slotLive(!live_button->isChecked());
-    /*if (m_frame_preview->isHidden()) {
-        //if (m_bmCapture) m_bmCapture->hidePreview(true);
-        m_videoBox->setHidden(true);
-        m_frame_preview->setHidden(false);
-    } else {
-        m_frame_preview->setHidden(true);
-        //if (m_bmCapture) m_bmCapture->hidePreview(false);
-        m_videoBox->setHidden(false);
-        capture_button->setEnabled(true);
-    }*/
     setUpdatesEnabled(true);
 }
 
@@ -498,7 +485,7 @@ void StopmotionWidget::slotLive(bool isOn)
             m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this);
             m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion();
             m_monitor->setRender(m_captureDevice);
-            connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &)));
+            connect(m_captureDevice, SIGNAL(frameSaved(QString)), this, SLOT(slotNewThumb(QString)));
         }
 
         m_manager->activateMonitor(Kdenlive::stopmotionMonitor);
@@ -609,7 +596,7 @@ void StopmotionWidget::slotUpdateOverlay()
 void StopmotionWidget::sequenceNameChanged(const QString& name)
 {
     // Get rid of frames from previous sequence
-    disconnect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));
+    disconnect(this, SIGNAL(doCreateThumbs(QImage,int)), this, SLOT(slotCreateThumbs(QImage,int)));
     m_filesList.clear();
     m_future.waitForFinished();
     frame_list->clear();
@@ -621,12 +608,12 @@ void StopmotionWidget::sequenceNameChanged(const QString& name)
         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)));
+            connect(this, SIGNAL(doCreateThumbs(QImage,int)), this, SLOT(slotCreateThumbs(QImage,int)));
             m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
             button_addsequence->setEnabled(true);
         } else {
             // new sequence
-            connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));
+            connect(this, SIGNAL(doCreateThumbs(QImage,int)), this, SLOT(slotCreateThumbs(QImage,int)));
             button_addsequence->setEnabled(false);
         }
         capture_button->setEnabled(live_button->isChecked());
@@ -691,7 +678,7 @@ void StopmotionWidget::slotPrepareThumbs()
 
 }
 
-void StopmotionWidget::slotCreateThumbs(QImage img, int ix)
+void StopmotionWidget::slotCreateThumbs(const QImage &img, int ix)
 {
     if (img.isNull()) {
         m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
@@ -721,7 +708,7 @@ void StopmotionWidget::slotCreateThumbs(QImage img, int ix)
 QString StopmotionWidget::getPathForFrame(int ix, QString seqName)
 {
     if (seqName.isEmpty()) seqName = m_sequenceName;
-    return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + "_" + QString::number(ix).rightJustified(4, '0', false) + ".png";
+    return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + '_' + QString::number(ix).rightJustified(4, '0', false) + ".png";
 }
 
 void StopmotionWidget::slotShowFrame(const QString& path)
@@ -731,8 +718,6 @@ void StopmotionWidget::slotShowFrame(const QString& path)
     capture_button->setEnabled(false);
     slotLive(false);
     if (!img.isNull()) {
-        //m_videoBox->setHidden(true);
-
         m_frame_preview->setImage(img);
         m_frame_preview->setHidden(false);
         m_frame_preview->update();