]> git.sesse.net Git - kdenlive/blobdiff - src/monitor.cpp
Move mlt interlace and rescale into main menu
[kdenlive] / src / monitor.cpp
index f98551903f8bcc73dab0aeb58a206d2a9fb03e1e..34f1c7bd0d8bb35258eb0c05f3f1bc2230c69488 100644 (file)
@@ -31,6 +31,7 @@
 #include <KFileDialog>
 #include <KApplication>
 #include <KMessageBox>
+#include <KSelectAction>
 
 #include <QMouseEvent>
 #include <QStylePainter>
 
 
 Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profile, QWidget *parent) :
-    AbstractMonitor(id, manager, parent),
-    render(NULL),
-    m_currentClip(NULL),
-    m_overlay(NULL),
-    m_scale(1),
-    m_length(2),
-    m_dragStarted(false),
-    m_contextMenu(NULL),
-    m_effectWidget(NULL),
-    m_selectedClip(NULL),
-    m_loopClipTransition(true),
+    AbstractMonitor(id, manager, parent)
+    , render(NULL)
+    , m_currentClip(NULL)
+    , m_overlay(NULL)
+    , m_scale(1)
+    , m_length(2)
+    , m_dragStarted(false)
+    , m_loopClipAction(NULL)
+    , m_contextMenu(NULL)
+    , m_effectWidget(NULL)
+    , m_selectedClip(NULL)
+    , m_loopClipTransition(true)
 #ifdef USE_OPENGL
-    m_glWidget(NULL),
+    , m_glWidget(NULL)
 #endif
-    m_editMarker(NULL)
+    m_editMarker(NULL)
 {
     QVBoxLayout *layout = new QVBoxLayout;
     layout->setContentsMargins(0, 0, 0, 0);
@@ -293,10 +295,9 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe
     dropFrames->setCheckable(true);
     dropFrames->setChecked(true);
     connect(dropFrames, SIGNAL(toggled(bool)), this, SLOT(slotSwitchDropFrames(bool)));
-
+    
     m_configMenu->addAction(showTips);
     m_configMenu->addAction(dropFrames);
-
 }
 
 void Monitor::slotGoToMarker(QAction *action)
@@ -458,6 +459,7 @@ void Monitor::slotSetZoneEnd()
 // virtual
 void Monitor::mousePressEvent(QMouseEvent * event)
 {
+    if (render) render->setActiveMonitor();
     if (event->button() != Qt::RightButton) {
         if (videoBox->geometry().contains(event->pos()) && (!m_overlay || !m_overlay->underMouse())) {
             m_dragStarted = true;
@@ -870,7 +872,7 @@ void Monitor::slotLoopClip()
 void Monitor::updateClipProducer(Mlt::Producer *prod)
 {
     if (render == NULL) return;
-   render->setProducer(prod, render->seekFramePosition());
+    render->setProducer(prod, render->seekFramePosition());
 }
 
 void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpdate, int position)
@@ -878,7 +880,6 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpda
     if (render == NULL) return;
     if (clip == NULL && m_currentClip != NULL) {
        m_currentClip->lastSeekPosition = render->seekFramePosition();
-        kDebug()<<"// SETTING NULL CLIP MONITOR";
         m_currentClip = NULL;
         m_length = -1;
         render->setProducer(NULL, -1);
@@ -895,7 +896,7 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpda
         if (render->setProducer(prod, position) == -1) {
             // MLT CONSUMER is broken
             kDebug(QtWarningMsg) << "ERROR, Cannot start monitor";
-        }
+        } else start();
     } else {
         if (m_currentClip) {
             slotActivateMonitor();
@@ -1037,10 +1038,10 @@ QStringList Monitor::getZoneInfo() const
 void Monitor::slotSetSelectedClip(AbstractClipItem* item)
 {
     if (item) {
-        m_loopClipAction->setEnabled(true);
+        if (m_loopClipAction) m_loopClipAction->setEnabled(true);
         m_selectedClip = item;
     } else {
-        m_loopClipAction->setEnabled(false);
+        if (m_loopClipAction) m_loopClipAction->setEnabled(false);
     }
 }
 
@@ -1152,7 +1153,7 @@ QString Monitor::getMarkerThumb(GenTime pos)
 {
     if (!m_currentClip) return QString();
     if (!m_currentClip->getClipHash().isEmpty()) {
-       QString url = m_monitorManager->getProjectFolder() + "thumbs/" + m_currentClip->getClipHash() + '#' + QString::number(pos.frames(m_monitorManager->timecode().fps())) + ".png";
+       QString url = m_monitorManager->getProjectFolder() + "thumbs/" + m_currentClip->getClipHash() + '#' + QString::number((int) pos.frames(m_monitorManager->timecode().fps())) + ".png";
         if (QFile::exists(url)) return url;
     }
     return QString();