]> git.sesse.net Git - kdenlive/commitdiff
Fix title clip thumbnails
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 30 Jul 2009 20:46:57 +0000 (20:46 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 30 Jul 2009 20:46:57 +0000 (20:46 +0000)
svn path=/trunk/kdenlive/; revision=3788

src/clipitem.cpp
src/kthumb.cpp
src/mainwindow.cpp

index c03356452ac27db01501bf9ef9228a703d4eec56..388f9c75534b93a61d75f5ccc257730d0cee33fa 100644 (file)
@@ -104,6 +104,10 @@ ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, i
         setBrush(QColor(colour.left(7)));
     } else if (m_clipType == IMAGE || m_clipType == TEXT) {
         setBrush(QColor(141, 166, 215));
+        if (m_clipType == TEXT) {
+            connect(this, SIGNAL(getThumb(int, int)), clip->thumbProducer(), SLOT(extractImage(int, int)));
+            connect(clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
+        }
         //m_startPix = KThumb::getImage(KUrl(clip->getProperty("resource")), (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio()), KdenliveSettings::trackheight());
     } else if (m_clipType == AUDIO) {
         setBrush(QColor(141, 215, 166));
@@ -452,7 +456,7 @@ void ClipItem::refreshClip(bool checkDuration)
 
 void ClipItem::slotFetchThumbs()
 {
-    if (m_clipType == IMAGE || m_clipType == TEXT) {
+    if (m_clipType == IMAGE) {
         if (m_startPix.isNull()) {
             m_startPix = KThumb::getImage(KUrl(m_clip->getProperty("resource")), (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio()), KdenliveSettings::trackheight());
             update();
@@ -460,6 +464,11 @@ void ClipItem::slotFetchThumbs()
         return;
     }
 
+    if (m_clipType == TEXT) {
+        if (m_startPix.isNull()) slotGetStartThumb();
+        return;
+    }
+
     if (m_endPix.isNull() && m_startPix.isNull()) {
         m_startThumbRequested = true;
         m_endThumbRequested = true;
@@ -668,26 +677,24 @@ void ClipItem::paint(QPainter *painter,
     if (KdenliveSettings::videothumbnails() && !isAudioOnly()) {
         QPen pen = painter->pen();
         pen.setColor(QColor(255, 255, 255, 150));
+        const QRectF source(0.0, 0.0, (double) m_startPix.width(), (double) m_startPix.height());
         painter->setPen(pen);
         if ((m_clipType == IMAGE || m_clipType == TEXT) && !m_startPix.isNull()) {
             double left = itemWidth - m_startPix.width() * vscale / scale;
-            QRectF pixrect(left, 0.0, m_startPix.width() * vscale / scale, m_startPix.height());
-            QRectF source(0.0, 0.0, (double) m_startPix.width(), (double) m_startPix.height());
+            const QRectF pixrect(left, 0.0, m_startPix.width() * vscale / scale, m_startPix.height());
             painter->drawPixmap(pixrect, m_startPix, source);
             QLineF l2(left, 0, left, m_startPix.height());
             painter->drawLine(l2);
         } else if (!m_endPix.isNull()) {
             double left = itemWidth - m_endPix.width() * vscale / scale;
-            QRectF pixrect(left, 0.0, m_endPix.width() * vscale / scale, m_endPix.height());
-            QRectF source(0.0, 0.0, (double) m_endPix.width(), (double) m_endPix.height());
+            const QRectF pixrect(left, 0.0, m_endPix.width() * vscale / scale, m_endPix.height());
             painter->drawPixmap(pixrect, m_endPix, source);
             QLineF l2(left, 0, left, m_startPix.height());
             painter->drawLine(l2);
         }
         if (!m_startPix.isNull()) {
             double right = m_startPix.width() * vscale / scale;
-            QRectF pixrect(0.0, 0.0, right, m_startPix.height());
-            QRectF source(0.0, 0.0, (double) m_startPix.width(), (double) m_startPix.height());
+            const QRectF pixrect(0.0, 0.0, right, m_startPix.height());
             painter->drawPixmap(pixrect, m_startPix, source);
             QLineF l2(right, 0, right, m_startPix.height());
             painter->drawLine(l2);
@@ -739,8 +746,7 @@ void ClipItem::paint(QPainter *painter,
     QList < CommentedTime >::Iterator it = markers.begin();
     GenTime pos;
     double framepos;
-    QBrush markerBrush;
-    markerBrush = QBrush(QColor(120, 120, 0, 140));
+    QBrush markerBrush(QColor(120, 120, 0, 140));
     QPen pen = painter->pen();
     pen.setColor(QColor(255, 255, 255, 200));
     pen.setStyle(Qt::DotLine);
index ffbeec995b9abd5b02e4edf7f3091227e4201d27..1ffdb231a79cd0d1fbd1abf6305478351affec95 100644 (file)
@@ -185,7 +185,7 @@ QPixmap KThumb::getImage(KUrl url, int width, int height)
 void KThumb::extractImage(int frame, int frame2)
 {
     // kDebug() << "//extract thumb: " << frame << ", " << frame2;
-    if (m_url.isEmpty() || !KdenliveSettings::videothumbnails() || m_producer == NULL) return;
+    if (!KdenliveSettings::videothumbnails() || m_producer == NULL) return;
 
     const int twidth = (int)(KdenliveSettings::trackheight() * m_dar);
     const int theight = KdenliveSettings::trackheight();
index 8dde1eb817556b477f45f4872ce574051d78b8f5..8d4fab3f2b9afef9918babc73c828886ccfea243 100644 (file)
@@ -2301,6 +2301,7 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
             newprops.insert("frame_size", QString::number(rect.width()) + 'x' + QString::number(rect.height()));
             EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
             m_activeDocument->commandStack()->push(command);
+            m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
             m_activeDocument->setModified(true);
         }
         delete dia_ui;
@@ -2311,13 +2312,13 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
     ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
     connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
     if (dia.exec() == QDialog::Accepted) {
-        EditClipCommand *command = new EditClipCommand(m_projectList, dia.clipId(), clip->properties(), dia.properties(), true);
+        EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true);
         m_activeDocument->commandStack()->push(command);
 
         //m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
         if (dia.needsTimelineRefresh()) {
             // update clip occurences in timeline
-            m_activeTimeline->projectView()->slotUpdateClip(dia.clipId());
+            m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
         }
     }
 }