svn path=/trunk/kdenlive/; revision=3553
+ blockSignals(true);
+ if (m_clipType == VIDEO || m_clipType == AV || m_clipType == SLIDESHOW || m_clipType == PLAYLIST) {
+ disconnect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
+ disconnect(m_clip, SIGNAL(gotAudioData()), this, SLOT(slotGotAudioData()));
+ }
delete m_startThumbTimer;
delete m_endThumbTimer;
delete m_timeLine;
delete m_startThumbTimer;
delete m_endThumbTimer;
delete m_timeLine;
void ClipItem::slotThumbReady(int frame, QPixmap pix)
{
if (scene() == NULL) return;
void ClipItem::slotThumbReady(int frame, QPixmap pix)
{
if (scene() == NULL) return;
- QRectF r = sceneBoundingRect();
- double width = m_startPix.width() / projectScene()->scale();
+ QRectF r = boundingRect();
+ double width = pix.width() / projectScene()->scale();
if (m_startThumbRequested && frame == cropStart().frames(m_fps)) {
m_startPix = pix;
m_startThumbRequested = false;
if (m_startThumbRequested && frame == cropStart().frames(m_fps)) {
m_startPix = pix;
m_startThumbRequested = false;
- double height = r.height();
- update(r.x(), r.y(), width, height);
+ update(r.left(), r.top(), width, pix.height());
} else if (m_endThumbRequested && frame == (cropStart() + cropDuration()).frames(m_fps) - 1) {
m_endPix = pix;
m_endThumbRequested = false;
} else if (m_endThumbRequested && frame == (cropStart() + cropDuration()).frames(m_fps) - 1) {
m_endPix = pix;
m_endThumbRequested = false;
- double height = r.height();
- update(r.right() - width, r.y(), width, height);
+ update(r.right() - width, r.y(), width, pix.height());
QPixmap m_audioPix;
private slots:
QPixmap m_audioPix;
private slots:
- void slotFetchThumbs();
void slotGetStartThumb();
void slotGetEndThumb();
void slotGotAudioData();
void slotGetStartThumb();
void slotGetEndThumb();
void slotGotAudioData();
void slotThumbReady(int frame, QPixmap pix);
public slots:
void slotThumbReady(int frame, QPixmap pix);
public slots:
+ void slotFetchThumbs();
void slotSetStartThumb(const QPixmap pix);
void slotSetEndThumb(const QPixmap pix);
void slotSetStartThumb(const QPixmap pix);
void slotSetEndThumb(const QPixmap pix);
connect(&m_scrollTimer, SIGNAL(timeout()), this, SLOT(slotCheckMouseScrolling()));
m_scrollTimer.setInterval(100);
m_scrollTimer.setSingleShot(true);
connect(&m_scrollTimer, SIGNAL(timeout()), this, SLOT(slotCheckMouseScrolling()));
m_scrollTimer.setInterval(100);
m_scrollTimer.setSingleShot(true);
+
+ connect(&m_thumbsTimer, SIGNAL(timeout()), this, SLOT(slotFetchNextThumbs()));
+ m_thumbsTimer.setInterval(500);
+ m_thumbsTimer.setSingleShot(true);
}
CustomTrackView::~CustomTrackView()
{
qDeleteAll(m_guides);
}
CustomTrackView::~CustomTrackView()
{
qDeleteAll(m_guides);
+ m_waitingThumbs.clear();
}
void CustomTrackView::setDocumentModified()
}
void CustomTrackView::setDocumentModified()
+void CustomTrackView::slotFetchNextThumbs()
+{
+ if (!m_waitingThumbs.isEmpty()) {
+ ClipItem *item = m_waitingThumbs.takeFirst();
+ while ((item == NULL) && !m_waitingThumbs.isEmpty()) {
+ item = m_waitingThumbs.takeFirst();
+ }
+ if (item) item->slotFetchThumbs();
+ if (!m_waitingThumbs.isEmpty()) m_thumbsTimer.start();
+ }
+}
+
void CustomTrackView::slotCheckMouseScrolling()
{
if (m_scrollOffset == 0) {
void CustomTrackView::slotCheckMouseScrolling()
{
if (m_scrollOffset == 0) {
info.startPos = start;
info.endPos = info.startPos + clip->duration();
info.track = (int)(1 / m_tracksHeight);
info.startPos = start;
info.endPos = info.startPos + clip->duration();
info.track = (int)(1 / m_tracksHeight);
- ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0);
+ ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, false);
start += clip->duration();
offsetList.append(start);
m_selectionGroup->addToGroup(item);
item->setFlags(QGraphicsItem::ItemIsSelectable);
start += clip->duration();
offsetList.append(start);
m_selectionGroup->addToGroup(item);
item->setFlags(QGraphicsItem::ItemIsSelectable);
+ m_waitingThumbs.append(item);
}
//TODO: check if we do not overlap another clip when first dropping in timeline
//if (insertPossible(m_selectionGroup, event->pos()))
updateSnapPoints(NULL, offsetList);
scene()->addItem(m_selectionGroup);
}
//TODO: check if we do not overlap another clip when first dropping in timeline
//if (insertPossible(m_selectionGroup, event->pos()))
updateSnapPoints(NULL, offsetList);
scene()->addItem(m_selectionGroup);
event->acceptProposedAction();
event->acceptProposedAction();
} else {
// the drag is not a clip (may be effect, ...)
m_clipDrag = false;
} else {
// the drag is not a clip (may be effect, ...)
m_clipDrag = false;
void CustomTrackView::dragLeaveEvent(QDragLeaveEvent * event)
{
if (m_selectionGroup && m_clipDrag) {
void CustomTrackView::dragLeaveEvent(QDragLeaveEvent * event)
{
if (m_selectionGroup && m_clipDrag) {
+ m_thumbsTimer.stop();
+ m_waitingThumbs.clear();
QList<QGraphicsItem *> items = m_selectionGroup->childItems();
qDeleteAll(items);
scene()->destroyItemGroup(m_selectionGroup);
QList<QGraphicsItem *> items = m_selectionGroup->childItems();
qDeleteAll(items);
scene()->destroyItemGroup(m_selectionGroup);
}
}*/
scene()->removeItem(item);
}
}*/
scene()->removeItem(item);
+ m_waitingThumbs.removeAll(item);
if (m_dragItem == item) m_dragItem = NULL;
delete item;
if (m_dragItem == item) m_dragItem = NULL;
delete item;
m_document->setModified(true);
m_document->renderer()->doRefresh();
}
m_document->setModified(true);
m_document->renderer()->doRefresh();
}
QAction *m_deleteGuide;
QActionGroup *m_clipTypeGroup;
QTimer m_scrollTimer;
QAction *m_deleteGuide;
QActionGroup *m_clipTypeGroup;
QTimer m_scrollTimer;
int m_scrollOffset;
bool m_clipDrag;
int m_scrollOffset;
bool m_clipDrag;
QPoint m_menuPosition;
bool m_blockRefresh;
AbstractGroupItem *m_selectionGroup;
QPoint m_menuPosition;
bool m_blockRefresh;
AbstractGroupItem *m_selectionGroup;
+ QList <ClipItem *> m_waitingThumbs;
/** Get the index of the video track that is just below current track */
int getPreviousVideoTrack(int track);
/** Get the index of the video track that is just below current track */
int getPreviousVideoTrack(int track);
void slotCheckMouseScrolling();
void slotEditTimeLineGuide();
void slotDeleteTimeLineGuide();
void slotCheckMouseScrolling();
void slotEditTimeLineGuide();
void slotDeleteTimeLineGuide();
+ void slotFetchNextThumbs();
signals:
void cursorMoved(int, int);
signals:
void cursorMoved(int, int);