]> git.sesse.net Git - kdenlive/commitdiff
- Use a frame image from the consumer-frame-show event handler as monitor scene backg...
authorTill Theato <root@ttill.de>
Tue, 10 Aug 2010 09:27:23 +0000 (09:27 +0000)
committerTill Theato <root@ttill.de>
Tue, 10 Aug 2010 09:27:23 +0000 (09:27 +0000)
- Fix crash when monitor scene is open while quiting kdenlive

svn path=/trunk/kdenlive/; revision=4699

effects/frei0r_alphaspot.xml
src/geometrywidget.cpp
src/monitor.cpp
src/monitorscene.cpp
src/monitorscene.h

index edc5215f22def1155c268ab66a57186bda4dc30e..ff5c4718d2aa22cdd6a48c34b5d1451d355c2ef6 100644 (file)
@@ -6,7 +6,7 @@
         
         
         <parameter type="list" name="Shape" default="0.0" paramlist="0.0,0.38,0.62,1.0"
-                   paramlistdisplay="Rectangle,Round,Triangle,Diamond">
+                   paramlistdisplay="Rectangle,Ellipse,Triangle,Diamond">
                 <name>Shape</name>
         </parameter>
         
index 79bf0331dd2c5fbbeaec0954d40e312e19f8805a..ae87807ff0bee561596ad2ea1f50a56e5146f9cd 100644 (file)
@@ -74,10 +74,9 @@ GeometryWidget::GeometryWidget(Monitor* monitor, int clipPos, QWidget* parent ):
 
 GeometryWidget::~GeometryWidget()
 {
-    if (m_monitor)
-        m_monitor->slotEffectScene(false);
-    delete m_rect;
+    m_scene->removeItem(m_rect);
     delete m_geometry;
+    m_monitor->slotEffectScene(false);
 }
 
 QString GeometryWidget::getValue() const
@@ -119,6 +118,7 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
 
 void GeometryWidget::slotCheckPosition(int renderPos)
 {
+    qDebug() << m_clipPos << m_inPoint << m_outPoint;
     if (renderPos >= m_clipPos && renderPos <= m_clipPos + m_outPoint - m_inPoint) {
         if (!m_scene->views().at(0)->isVisible())
             m_monitor->slotEffectScene(true);
index 89ebe859009ae15f201e88e1b791e4a651662c01..b9f1ed262a33c8eb83b385476018e2a5ddbab155 100644 (file)
@@ -843,7 +843,7 @@ void Monitor::slotEffectScene(bool show)
         m_monitorRefresh->setVisible(!show);
         m_effectView->setVisible(show);
         if (show)
-            m_effectScene->slotUpdateBackground();
+            m_effectScene->slotUpdateBackground(true);
     }
 }
 
index 57fdefdd4e05fcfaff79a054bf7beae45da23579..96c7b7f511ef02a25d19acb6fa003965ccb27fd8 100644 (file)
@@ -33,7 +33,8 @@ MonitorScene::MonitorScene(Render *renderer, QObject* parent) :
         m_view(NULL),
         m_selectedItem(NULL),
         m_resizeMode(NoResize),
-        m_clickPoint(0, 0)
+        m_clickPoint(0, 0),
+        m_backgroundImage(QImage())
 {
     setBackgroundBrush(QBrush(QColor(KdenliveSettings::window_background().name())));
 
@@ -56,8 +57,8 @@ MonitorScene::MonitorScene(Render *renderer, QObject* parent) :
     m_background->setPixmap(bg);
     addItem(m_background);
 
-    connect(m_renderer, SIGNAL(rendererPosition(int)), this, SLOT(slotUpdateBackground()));
-    connect(m_renderer, SIGNAL(frameUpdated(int)), this, SLOT(slotUpdateBackground()));
+    //connect(m_renderer, SIGNAL(rendererPosition(int)), this, SLOT(slotUpdateBackground()));
+    connect(m_renderer, SIGNAL(frameUpdated(QImage)), this, SLOT(slotSetBackgroundImage(QImage)));
 }
 
 void MonitorScene::setUp()
@@ -66,21 +67,29 @@ void MonitorScene::setUp()
         m_view = views().at(0);
     else
         m_view = NULL;
-    slotUpdateBackground();
+    slotUpdateBackground(true);
 }
 
-void MonitorScene::slotUpdateBackground()
+void MonitorScene::slotUpdateBackground(bool fit)
 {
     if (m_view && m_view->isVisible()) {
         if (m_lastUpdate.elapsed() > 200) {
-            m_background->setPixmap(QPixmap::fromImage(m_renderer->extractFrame(m_renderer->seekFramePosition())));
-            m_view->fitInView(m_frameBorder, Qt::KeepAspectRatio);
-            m_view->centerOn(m_frameBorder);
+            m_background->setPixmap(QPixmap::fromImage(m_backgroundImage));
+            if (fit) {
+                m_view->fitInView(m_frameBorder, Qt::KeepAspectRatio);
+                m_view->centerOn(m_frameBorder);
+            }
             m_lastUpdate.start();
         }
     }
 }
 
+void MonitorScene::slotSetBackgroundImage(QImage image)
+{
+    m_backgroundImage = image;
+    slotUpdateBackground();
+}
+
 resizeModes MonitorScene::getResizeMode(QGraphicsRectItem *item, QPoint pos)
 {
     if(!m_view)
index fe39c68f591beeee0b45f32db0204ed581ffcee4..29698e21a6382d26c695d7d42dccadc97dcc89a2 100644 (file)
@@ -41,7 +41,10 @@ protected:
     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
 public slots:
-    void slotUpdateBackground();
+    void slotUpdateBackground(bool fit = false);
+
+private slots:
+    void slotSetBackgroundImage(QImage image);
 
 private:
     resizeModes getResizeMode(QGraphicsRectItem *item, QPoint pos);
@@ -54,6 +57,7 @@ private:
     QGraphicsItem *m_selectedItem;
     resizeModes m_resizeMode;
     QPointF m_clickPoint;
+    QImage m_backgroundImage;
 
 signals:
     void actionFinished();