]> git.sesse.net Git - kdenlive/blobdiff - src/monitor.cpp
Force refresh of clip monitor when clip was edited
[kdenlive] / src / monitor.cpp
index d28bd94129a50e8abe361d3ba38e4162eb08e22e..47d09b67e12065783f3673f7a272fded1c33fda0 100644 (file)
@@ -155,7 +155,7 @@ Monitor::Monitor(QString name, MonitorManager *manager, QString profile, QWidget
     createOpenGlWidget(m_videoBox, profile);
     monitorCreated = true;
     //m_glWidget->setFixedSize(width, height);
-#elif defined (USE_OPEN_GL)
+#elif defined(USE_OPENGL)
     if (KdenliveSettings::openglmonitors()) {
         monitorCreated = createOpenGlWidget(m_videoBox, profile);
     }
@@ -169,7 +169,7 @@ Monitor::Monitor(QString name, MonitorManager *manager, QString profile, QWidget
         render = new Render(m_name, (int) m_monitorRefresh->winId(), profile, this);
         m_monitorRefresh->setRenderer(render);
     }
-#if defined (USE_OPEN_GL)
+#ifdef USE_OPENGL
     else if (m_glWidget) {
         lay->addWidget(m_glWidget);
         m_videoBox->setLayout(lay);
@@ -180,6 +180,7 @@ Monitor::Monitor(QString name, MonitorManager *manager, QString profile, QWidget
     connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
     connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
     connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
+    connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
 
     if (name != "clip") {
         connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
@@ -229,7 +230,7 @@ const QString Monitor::name() const
     return m_name;
 }
 
-#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
+#ifdef USE_OPENGL
 bool Monitor::createOpenGlWidget(QWidget *parent, const QString profile)
 {
     render = new Render(m_name, 0, profile, this);
@@ -502,9 +503,9 @@ void Monitor::mouseMoveEvent(QMouseEvent *event)
         data.append(list.join(";").toUtf8());
         mimeData->setData("kdenlive/clip", data);
         drag->setMimeData(mimeData);
-        QPixmap pix = m_currentClip->thumbnail();
+        /*QPixmap pix = m_currentClip->thumbnail();
         drag->setPixmap(pix);
-        drag->setHotSpot(QPoint(0, 50));
+        drag->setHotSpot(QPoint(0, 50));*/
         drag->start(Qt::MoveAction);
 
         //Qt::DropAction dropAction;
@@ -731,7 +732,6 @@ void Monitor::adjustRulerSize(int length)
 
 void Monitor::stop()
 {
-    disconnect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
     if (render) render->stop();
 }
 
@@ -739,7 +739,6 @@ void Monitor::start()
 {
     if (!isVisible()) return;
     if (render) render->start();
-    connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
 }
 
 void Monitor::refreshMonitor(bool visible)
@@ -817,7 +816,7 @@ void Monitor::updateClipProducer(Mlt::Producer *prod)
    render->setProducer(prod, render->seekFramePosition());
 }
 
-void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, int position)
+void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpdate, int position)
 {
     if (render == NULL) return;
     if (clip == NULL && m_currentClip != NULL) {
@@ -828,7 +827,7 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, int position)
         return;
     }
     
-    if (clip != m_currentClip) {
+    if (clip != m_currentClip || forceUpdate) {
         m_currentClip = clip;
         if (m_currentClip) activateMonitor();
         updateMarkers(clip);
@@ -877,7 +876,10 @@ void Monitor::resetProfile(const QString &profile)
 {
     m_timePos->updateTimeCode(m_monitorManager->timecode());
     if (render == NULL) return;
-    render->resetProfile(profile);
+    if (!render->hasProfile(profile)) {
+        activateMonitor();
+        render->resetProfile(profile);
+    }
     if (m_effectWidget)
         m_effectWidget->resetProfile(render);
 }
@@ -912,7 +914,7 @@ void Monitor::slotSwitchMonitorInfo(bool show)
         if (m_overlay) return;
         if (m_monitorRefresh == NULL) {
             // Using OpenGL display
-#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
+#ifdef USE_OPENGL
             if (m_glWidget->layout()) delete m_glWidget->layout();
             m_overlay = new Overlay();
             connect(m_overlay, SIGNAL(editMarker()), this, SLOT(slotEditMarker()));
@@ -992,7 +994,7 @@ void Monitor::slotEffectScene(bool show)
         if (m_monitorRefresh) {
             m_monitorRefresh->setVisible(!show);
         } else {
-#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
+#ifdef USE_OPENGL
             m_glWidget->setVisible(!show);
 #endif
         }
@@ -1001,8 +1003,8 @@ void Monitor::slotEffectScene(bool show)
         emit requestFrameForAnalysis(show);
         if (show) {
             m_effectWidget->getScene()->slotZoomFit();
-            render->doRefresh();
         }
+        render->doRefresh();
     }
 }