From: Jean-Baptiste Mardelle Date: Thu, 30 Jul 2009 20:46:57 +0000 (+0000) Subject: Fix title clip thumbnails X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e491edd0421444f8e58c7bfc22b799b5987d0661;p=kdenlive Fix title clip thumbnails svn path=/trunk/kdenlive/; revision=3788 --- diff --git a/src/clipitem.cpp b/src/clipitem.cpp index c0335645..388f9c75 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -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); diff --git a/src/kthumb.cpp b/src/kthumb.cpp index ffbeec99..1ffdb231 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -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(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8dde1eb8..8d4fab3f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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()); } } }