]> git.sesse.net Git - kdenlive/blobdiff - src/stopmotion/stopmotion.cpp
Merge branch 'refs/heads/v0.8.2'
[kdenlive] / src / stopmotion / stopmotion.cpp
index 6d4732778210c34edc2367e54c54b6bda8f44ca6..f76f9c2976442a85c66a90dd55c53e2982661f6f 100644 (file)
@@ -17,7 +17,9 @@
 
 #include "stopmotion.h"
 #include "../blackmagic/devices.h"
+#if !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD)
 #include "../v4l/v4lcapture.h"
+#endif
 #include "../slideshowclip.h"
 #include "../profilesdialog.h"
 #include "../mltdevicecapture.h"
@@ -172,10 +174,10 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     intervalCapture->setCheckable(true);
     intervalCapture->setChecked(false);
     capture_interval->setDefaultAction(intervalCapture);
-        
+
     preview_button->setIcon(KIcon("media-playback-start"));
     capture_button->setEnabled(false);
-    
+
 
     // Build config menu
     QMenu* confMenu = new QMenu;
@@ -184,7 +186,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     overlay_button->setDefaultAction(m_showOverlay);
     //confMenu->addAction(m_showOverlay);
 
-    m_effectIndex = KdenliveSettings::stopmotioneffect();    
+    m_effectIndex = KdenliveSettings::stopmotioneffect();
     QMenu* effectsMenu = new QMenu(i18n("Overlay effect"));
     QActionGroup* effectGroup = new QActionGroup(this);
     QAction* noEffect = new QAction(i18n("No Effect"), effectGroup);
@@ -249,13 +251,13 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     //m_videoBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
     m_videoBox->setLineWidth(4);
     layout->addWidget(m_videoBox);
-    
-    
+
+
     if (BMInterface::getBlackMagicDeviceList(capture_device)) {
         // Found a BlackMagic device
     }
     if (QFile::exists(KdenliveSettings::video4vdevice())) {
-#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD)
         // Video 4 Linux device detection
         for (int i = 0; i < 10; i++) {
             QString path = "/dev/video" + QString::number(i);
@@ -274,10 +276,10 @@ 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(const QString &)), this, SLOT(slotNewThumb(const QString &)));
         connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage)));
     } else live_button->setEnabled(false);*/
-    
+
     m_frame_preview = new MyLabel(this);
     connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool)));
     connect(m_frame_preview, SIGNAL(switchToLive()), this, SLOT(slotSwitchLive()));
@@ -297,12 +299,12 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
         // Decklink capture
         profilePath = KdenliveSettings::current_profile();
     }
-    
+
     m_captureDevice = new MltDeviceCapture(profilePath, m_videoBox, 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(const QString &)), this, SLOT(slotNewThumb(const QString &)));
+
     live_button->setChecked(false);
     button_addsequence->setEnabled(false);
     connect(live_button, SIGNAL(toggled(bool)), this, SLOT(slotLive(bool)));
@@ -324,8 +326,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
 
 StopmotionWidget::~StopmotionWidget()
 {
-    /*if (m_bmCapture)
-        m_bmCapture->stopPreview();*/
+    m_manager->removeMonitor(m_monitor);
     if (m_captureDevice) {
         m_captureDevice->stop();
         delete m_captureDevice;
@@ -362,7 +363,7 @@ void StopmotionWidget::slotConfigure()
     ui.sm_prenotify->setChecked(KdenliveSettings::sm_prenotify());
     ui.sm_loop->setChecked(KdenliveSettings::sm_loop());
     ui.sm_framesplayback->setValue(KdenliveSettings::sm_framesplayback());
-    
+
     if (d.exec() == QDialog::Accepted) {
         KdenliveSettings::setSm_loop(ui.sm_loop->isChecked());
         KdenliveSettings::setCaptureinterval(ui.sm_interval->value());
@@ -399,7 +400,7 @@ void StopmotionWidget::slotUpdateDeviceHandler()
     }
     m_layout->removeWidget(m_frame_preview);
     if (data == "v4l") {
-#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD)
         m_bmCapture = new V4lCaptureHandler(m_layout);
         m_bmCapture->setDevice(capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 1).toString(), capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 2).toString());
 #endif
@@ -460,6 +461,7 @@ void StopmotionWidget::slotLive(bool isOn)
     if (isOn) {
         m_frame_preview->setHidden(true);
         m_videoBox->setHidden(false);
+        QLocale locale;
 
         MltVideoProfile profile;
         QString resource;
@@ -486,9 +488,9 @@ void StopmotionWidget::slotLive(bool isOn)
             m_captureDevice = new MltDeviceCapture(profilePath, m_videoBox, 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(const QString &)), this, SLOT(slotNewThumb(const QString &)));
         }
-        
+
         m_manager->activateMonitor("stopmotion");
         QString producer = createProducer(profile, service, resource);
         if (m_captureDevice->slotStartPreview(producer, true)) {
@@ -498,7 +500,7 @@ void StopmotionWidget::slotLive(bool isOn)
             }
             capture_button->setEnabled(true);
             live_button->setChecked(true);
-            log_box->insertItem(-1, i18n("Playing %1x%2 (%3 fps)", profile.width, profile.height, QString::number((double)profile.frame_rate_num/profile.frame_rate_den).rightJustified(2, '0')));
+            log_box->insertItem(-1, i18n("Playing %1x%2 (%3 fps)", profile.width, profile.height, locale.toString((double)profile.frame_rate_num/profile.frame_rate_den).rightJustified(2, '0')));
             log_box->setCurrentIndex(0);
         }
         else {
@@ -519,7 +521,7 @@ void StopmotionWidget::slotLive(bool isOn)
             //m_captureDevice = NULL;
         }
     }
-            
+
     /*
     if (isOn && m_bmCapture) {
         //m_frame_preview->setImage(QImage());
@@ -662,13 +664,13 @@ void StopmotionWidget::slotPreNotify()
 }
 
 
-void StopmotionWidget::slotNewThumb(const QString path)
+void StopmotionWidget::slotNewThumb(const QString &path)
 {
     if (!KdenliveSettings::showstopmotionthumbs()) return;
     m_filesList.append(path);
     if (m_showOverlay->isChecked()) reloadOverlay();
     if (!m_future.isRunning()) m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs);
-    
+
 }
 
 void StopmotionWidget::slotPrepareThumbs()
@@ -720,7 +722,7 @@ void StopmotionWidget::slotShowFrame(const QString& path)
     slotLive(false);
     if (!img.isNull()) {
         //m_videoBox->setHidden(true);
-        
+
         m_frame_preview->setImage(img);
         m_frame_preview->setHidden(false);
         m_frame_preview->update();
@@ -881,9 +883,10 @@ void StopmotionWidget::slotSwitchMirror(bool isOn)
     if (m_captureDevice) m_captureDevice->mirror(isOn);
 }
 
-const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString service, const QString resource)
-{   
-    
+const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString &service, const QString &resource)
+{
+    Q_UNUSED(profile)
+
     QString playlist = "<mlt title=\"capture\"><producer id=\"producer0\" in=\"0\" out=\"99999\"><property name=\"mlt_type\">producer</property><property name=\"length\">100000</property><property name=\"eof\">pause</property><property name=\"resource\">" + resource + "</property><property name=\"mlt_service\">" + service + "</property></producer>";
 
     // overlay track
@@ -897,7 +900,7 @@ const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QS
     playlist.append("<track producer=\"playlist1\"/>");
     playlist.append("</tractor></mlt>");
 
-    
+
     return playlist;
 }