]> git.sesse.net Git - kdenlive/blobdiff - src/stopmotion/stopmotion.cpp
Cleanup: remove duplicate monitor code, allow fullscreen for record monitor
[kdenlive] / src / stopmotion / stopmotion.cpp
index f76f9c2976442a85c66a90dd55c53e2982661f6f..5611f2d41a10efbf511d0f9a23b04810dc532f7e 100644 (file)
  ***************************************************************************/
 
 #include "stopmotion.h"
-#include "../blackmagic/devices.h"
-#if !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD)
-#include "../v4l/v4lcapture.h"
+#ifdef USE_BLACKMAGIC
+#include "blackmagic/devices.h"
 #endif
-#include "../slideshowclip.h"
-#include "../profilesdialog.h"
-#include "../mltdevicecapture.h"
-#include "../recmonitor.h"
-#include "../monitormanager.h"
+#ifdef USE_V4L
+#include "v4l/v4lcapture.h"
+#endif
+#include "slideshowclip.h"
+#include "profilesdialog.h"
+#include "mltdevicecapture.h"
+#include "recmonitor.h"
+#include "monitormanager.h"
 #include "ui_smconfig_ui.h"
 #include "kdenlivesettings.h"
 
-
 #include <KDebug>
 #include <KGlobalSettings>
 #include <KFileDialog>
@@ -92,8 +93,8 @@ void MyLabel::paintEvent(QPaintEvent* event)
 }
 
 
-StopmotionMonitor::StopmotionMonitor(QWidget *parent) :
-    AbstractMonitor(parent),
+StopmotionMonitor::StopmotionMonitor(MonitorManager *manager, QWidget *parent) :
+    AbstractMonitor(Kdenlive::stopmotionMonitor, manager, parent),
     m_captureDevice(NULL)
 {
 }
@@ -102,6 +103,10 @@ StopmotionMonitor::~StopmotionMonitor()
 {
 }
 
+void StopmotionMonitor::slotSwitchFullScreen()
+{
+}
+
 void StopmotionMonitor::setRender(MltDeviceCapture *render)
 {
     m_captureDevice = render;
@@ -112,9 +117,9 @@ AbstractRender *StopmotionMonitor::abstractRender()
     return m_captureDevice;
 }
 
-const QString StopmotionMonitor::name() const
+Kdenlive::MONITORID StopmotionMonitor::id() const
 {
-    return QString("stopmotion");
+    return Kdenlive::stopmotionMonitor;
 }
 
 
@@ -128,6 +133,22 @@ void StopmotionMonitor::start()
 {
 }
 
+void StopmotionMonitor::pause()
+{
+}
+
+void StopmotionMonitor::unpause()
+{
+}
+
+void StopmotionMonitor::slotPlay()
+{
+}
+
+void StopmotionMonitor::slotMouseSeek(int /*eventDelta*/, bool /*fast*/)
+{
+}
+
 StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, QList< QAction* > actions, QWidget* parent) :
     QDialog(parent)
     , Ui::Stopmotion_UI()
@@ -137,7 +158,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     , m_animatedIndex(-1)
     , m_animate(false)
     , m_manager(manager)
-    , m_monitor(new StopmotionMonitor(this))
+    , m_monitor(new StopmotionMonitor(manager, this))
 {
     //setAttribute(Qt::WA_DeleteOnClose);
     //HACK: the monitor widget is hidden, it is just used to control the capturedevice from monitormanager
@@ -245,19 +266,17 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     QVBoxLayout *layout = new QVBoxLayout;
     layout->setContentsMargins(0, 0, 0, 0);
     layout->setSpacing(0);
-    m_videoBox = new VideoPreviewContainer();
-    m_videoBox->setContentsMargins(0, 0, 0, 0);
-    m_videoBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-    //m_videoBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+    m_videoBox = new VideoContainer(m_monitor);
     m_videoBox->setLineWidth(4);
     layout->addWidget(m_videoBox);
 
-
+#ifdef USE_BLACKMAGIC
     if (BMInterface::getBlackMagicDeviceList(capture_device)) {
         // Found a BlackMagic device
     }
+#endif
     if (QFile::exists(KdenliveSettings::video4vdevice())) {
-#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD)
+#ifdef USE_V4L
         // Video 4 Linux device detection
         for (int i = 0; i < 10; i++) {
             QString path = "/dev/video" + QString::number(i);
@@ -271,7 +290,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
                 }
             }
         }
-#endif
+#endif /* USE_V4L */
     }
 
     connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDeviceHandler()));
@@ -400,7 +419,7 @@ void StopmotionWidget::slotUpdateDeviceHandler()
     }
     m_layout->removeWidget(m_frame_preview);
     if (data == "v4l") {
-#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD)
+#ifdef USE_V4L
         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
@@ -491,7 +510,7 @@ void StopmotionWidget::slotLive(bool isOn)
             connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &)));
         }
 
-        m_manager->activateMonitor("stopmotion");
+        m_manager->activateMonitor(Kdenlive::stopmotionMonitor);
         QString producer = createProducer(profile, service, resource);
         if (m_captureDevice->slotStartPreview(producer, true)) {
             if (m_showOverlay->isChecked()) {
@@ -883,6 +902,7 @@ void StopmotionWidget::slotSwitchMirror(bool isOn)
     if (m_captureDevice) m_captureDevice->mirror(isOn);
 }
 
+
 const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString &service, const QString &resource)
 {
     Q_UNUSED(profile)