]> git.sesse.net Git - kdenlive/blobdiff - src/customtrackview.cpp
Correctly focus clips / folders when they are created:
[kdenlive] / src / customtrackview.cpp
index a04365ea1d29fc425268d7450ca5bd9e90ccf6c4..61bcf6bdd04ab298828e6c517d571b6baefdc2e6 100644 (file)
@@ -213,7 +213,7 @@ void CustomTrackView::checkTrackHeight()
             item = (ClipItem*) itemList.at(i);
             item->setRect(0, 0, item->rect().width(), m_tracksHeight - 1);
             item->setPos((qreal) item->startPos().frames(m_document->fps()), (qreal) item->track() * m_tracksHeight + 1);
-            item->resetThumbs();
+            item->resetThumbs(true);
         } else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
             transitionitem = (Transition*) itemList.at(i);
             transitionitem->setRect(0, 0, transitionitem->rect().width(), m_tracksHeight / 3 * 2 - 1);
@@ -1868,7 +1868,7 @@ void CustomTrackView::addTrack(TrackInfo type, int ix)
     }
     m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
     setSceneRect(0, 0, sceneRect().width(), maxHeight);
-    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged(false)));
+    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
     viewport()->update();
     //setFixedHeight(50 * m_tracksCount);
 }
@@ -1933,7 +1933,7 @@ void CustomTrackView::removeTrack(int ix)
     }
     m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
     setSceneRect(0, 0, sceneRect().width(), maxHeight);
-    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged(false)));
+    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
     viewport()->update();
 }
 
@@ -1942,7 +1942,7 @@ void CustomTrackView::changeTrack(int ix, TrackInfo type)
     int tracknumber = m_document->tracksCount() - ix;
     m_document->setTrackType(tracknumber - 1, type);
     m_document->renderer()->mltChangeTrackState(tracknumber, m_document->trackInfoAt(tracknumber - 1).isMute, m_document->trackInfoAt(tracknumber - 1).isBlind);
-    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged(false)));
+    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
     viewport()->update();
 }
 
@@ -2991,6 +2991,8 @@ void CustomTrackView::addClip(QDomElement xml, const QString &clipId, ItemInfo i
     }
     m_document->setModified(true);
     m_document->renderer()->doRefresh();
+    m_waitingThumbs.append(item);
+    m_thumbsTimer.start();
 }
 
 void CustomTrackView::slotUpdateClip(const QString &clipId)
@@ -3193,7 +3195,7 @@ void CustomTrackView::moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> sta
         bool snap = KdenliveSettings::snaptopoints();
         KdenliveSettings::setSnaptopoints(false);
 
-        m_selectionGroup->moveBy(offset.frames(m_document->fps()), trackOffset * (qreal) m_tracksHeight);
+        m_selectionGroup->moveBy(offset.frames(m_document->fps()), trackOffset *(qreal) m_tracksHeight);
 
         kDebug() << "%% GRP NEW POS: " << m_selectionGroup->scenePos().x();
 
@@ -3332,7 +3334,7 @@ void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end)
         bool success = m_document->renderer()->mltResizeClipCrop(clipinfo, end.cropStart - start.cropStart);
         if (success) {
             item->setCropStart(end.cropStart);
-            item->resetThumbs();
+            item->resetThumbs(true);
         }
     }
     m_document->renderer()->doRefresh();
@@ -3726,8 +3728,6 @@ void CustomTrackView::setScale(double scaleFactor, double verticalScale)
     QMatrix matrix;
     matrix = matrix.scale(scaleFactor, verticalScale);
     m_scene->setScale(scaleFactor, verticalScale);
-    kDebug() << "// Set SCALE: " << scaleFactor << "," << verticalScale;
-    //scale(scaleFactor, 1);
     m_animationTimer->stop();
     delete m_visualTip;
     m_visualTip = NULL;
@@ -3767,10 +3767,10 @@ void CustomTrackView::drawBackground(QPainter * painter, const QRectF &rect)
     QColor lockedColor = scheme.background(KColorScheme::NegativeBackground).color();
     QColor audioColor = palette().alternateBase().color();
     QColor base = scheme.background(KColorScheme::NormalBackground).color();
-    for (uint i = 0; i < max;i++) {
+    for (uint i = 0; i < max; i++) {
         if (m_document->trackInfoAt(max - i - 1).isLocked == true) painter->fillRect(r.left(), m_tracksHeight * i + 1, r.right() - r.left() + 1, m_tracksHeight - 1, QBrush(lockedColor));
         else if (m_document->trackInfoAt(max - i - 1).type == AUDIOTRACK) painter->fillRect(r.left(), m_tracksHeight * i + 1, r.right() - r.left() + 1, m_tracksHeight - 1, QBrush(audioColor));
-        painter->drawLine(r.left(), m_tracksHeight * (i + 1), r.right(), m_tracksHeight * (i + 1));
+        painter->drawLine(r.left(), m_tracksHeight *(i + 1), r.right(), m_tracksHeight *(i + 1));
     }
     int lowerLimit = m_tracksHeight * m_document->tracksCount() + 1;
     if (height() > lowerLimit)
@@ -4108,14 +4108,13 @@ void CustomTrackView::slotUpdateAllThumbs()
     for (int i = 0; i < itemList.count(); i++) {
         if (itemList.at(i)->type() == AVWIDGET) {
             item = static_cast <ClipItem *>(itemList.at(i));
-            if (item->clipType() != COLOR) {
+            if (item->clipType() != COLOR && item->clipType() != AUDIO) {
                 // Check if we have a cached thumbnail
-                if (item->clipType() == IMAGE || item->clipType() == TEXT || item->clipType() == AUDIO) {
+                if (item->clipType() == IMAGE || item->clipType() == TEXT) {
                     QString thumb = thumbBase + item->baseClip()->getClipHash() + "_0.png";
                     if (QFile::exists(thumb)) {
                         QPixmap pix(thumb);
                         item->slotSetStartThumb(pix);
-                        item->slotSetEndThumb(pix);
                     }
                 } else {
                     QString startThumb = thumbBase + item->baseClip()->getClipHash() + '_';