]> git.sesse.net Git - kdenlive/commitdiff
et rid of deprecated KPixmapCache & fix freeze when saving in maximum zoom:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 16 Jun 2011 22:07:38 +0000 (22:07 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 16 Jun 2011 22:07:38 +0000 (22:07 +0000)
http://www.kdenlive.org/mantis/view.php?id=2174

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

src/clipitem.cpp
src/customtrackview.cpp
src/customtrackview.h
src/mainwindow.cpp
src/trackview.cpp
src/trackview.h

index aeda00c815cc16e99c66c7e85c5c4a8c382a89ad..f366ab6304b81e54bf2bfb84413aaec33b29d0ab 100644 (file)
@@ -1722,9 +1722,9 @@ void ClipItem::doGetIntraThumbs(QPainter *painter, const QPointF startPos, int o
     }
     QPixmap p;
     for (int i = start; i <= end; i++) {
-        if (!view->m_pixmapCache->find(m_clip->fileURL().path() + "%" + QString::number(i), p)) {
+        if (!view->m_pixmapCache->findPixmap(m_clip->fileURL().path() + "%" + QString::number(i), &p)) {
             p = m_clip->thumbProducer()->extractImage(i, twidth, theight);
-            view->m_pixmapCache->insert(m_clip->fileURL().path() + "%" + QString::number(i), p);
+            view->m_pixmapCache->insertPixmap(m_clip->fileURL().path() + "%" + QString::number(i), p);
         }
         painter->drawPixmap(startPos + QPointF(twidth *(i - offset), 0), p);
     }
index 90e1ac8d0884debc86da0beabee15178fc3cd871..23d85c7b131a5521632f9426c9f23423abc656dc 100644 (file)
@@ -142,7 +142,7 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscen
 
     m_activeTrackBrush = KStatefulBrush(KColorScheme::View, KColorScheme::ActiveBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
 
-    m_pixmapCache = new KPixmapCache("kdenlive-thumbs");
+    m_pixmapCache = new KImageCache("kdenlive-thumbs", 1000000);
 
     m_animationTimer = new QTimeLine(800);
     m_animationTimer->setFrameRange(0, 5);
@@ -6710,15 +6710,3 @@ void CustomTrackView::adjustEffects(ClipItem* item, ItemInfo oldInfo, QUndoComma
 }
 
 
-void CustomTrackView::saveTimelinePreview(const QString path)
-{
-    QRect viewrect = viewport()->rect();
-    QImage img(viewrect.width(), viewrect.height(), QImage::Format_ARGB32_Premultiplied);
-    img.fill(palette().base().color().rgb());
-    QPainter painter(&img);
-    render(&painter);
-    painter.end();
-    img = img.scaledToWidth(600, Qt::SmoothTransformation);
-    img.save(path);
-}
-
index f862dee7f58aec501fd6b028e68c4605961d8e29..99482e9ec0e0d167e0b230dc39d02095d67be16d 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef CUSTOMTRACKVIEW_H
 #define CUSTOMTRACKVIEW_H
 
-#include <KPixmapCache>
+#include <KImageCache>
 #include <KColorScheme>
 
 #include <QGraphicsView>
@@ -43,7 +43,6 @@ class AbstractClipItem;
 class AbstractGroupItem;
 class Transition;
 
-
 class CustomTrackView : public QGraphicsView
 {
     Q_OBJECT
@@ -179,7 +178,7 @@ public:
     void clearSelection();
     void editItemDuration();
     void buildGuidesMenu(QMenu *goMenu) const;
-    KPixmapCache* m_pixmapCache;
+    KImageCache* m_pixmapCache;
     /** update the timeline objects when palette changes */
     void updatePalette();
     /** @brief Returns true if a track has audio data on it.
@@ -269,8 +268,6 @@ public slots:
     * @param offsetList The list of points that should also snap (for example when movin a clip, start and end points should snap
     * @param skipSelectedItems if true, the selected item start and end points will not be added to snap list */
     void updateSnapPoints(AbstractClipItem *selected, QList <GenTime> offsetList = QList <GenTime> (), bool skipSelectedItems = false);
-    /** @brief Save a snapshot image of current timeline view */
-    void saveTimelinePreview(const QString path);
 
 protected:
     virtual void drawBackground(QPainter * painter, const QRectF & rect);
index 5b7cedf62f9fb84dcd06c160fc8501896e56f587..d6d4363cf1ba30d6f45a7439814aafd06ef08928 100644 (file)
@@ -2469,7 +2469,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 
     connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
     connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
-    connect(doc, SIGNAL(saveTimelinePreview(const QString)), trackView->projectView(), SLOT(saveTimelinePreview(const QString)));
+    connect(doc, SIGNAL(saveTimelinePreview(const QString)), trackView, SLOT(slotSaveTimelinePreview(const QString)));
     
     connect(m_notesWidget, SIGNAL(textChanged()), doc, SLOT(setModified()));
 
index 9b187f05e3210682b714e69700c57c99e6e9bb74..b5b2b9efd173d318e5b0a7bb4b14cbc7941663ec 100644 (file)
@@ -1031,4 +1031,19 @@ void TrackView::slotUpdateTrackEffectState(int ix)
     widgets.at(m_doc->tracksCount() - ix - 1)->updateEffectLabel(m_doc->trackInfoAt(ix).effectsList.effectNames());
 }
 
+void TrackView::slotSaveTimelinePreview(const QString path)
+{
+    QImage img(width(), height(), QImage::Format_ARGB32_Premultiplied);
+    img.fill(palette().base().color().rgb());
+    QPainter painter(&img);
+    render(&painter);
+    painter.end();
+    img = img.scaledToWidth(600, Qt::SmoothTransformation);
+    img.save(path);
+}
+
+
 #include "trackview.moc"
+
+
+
index e3fecfccd9c4d78d4291bcc1831afbead21229e0..1a5b55b94e1e8e6d28bdc1cbafd3091e10fb1416 100644 (file)
@@ -84,7 +84,8 @@ public slots:
     void slotChangeZoom(int horizontal, int vertical = -1);
     void setDuration(int dur);
     void slotSetZone(QPoint p, bool updateDocumentProperties = true);
-
+    /** @brief Save a snapshot image of current timeline view */
+    void slotSaveTimelinePreview(const QString path);
 private:
     CustomRuler *m_ruler;
     CustomTrackView *m_trackview;