}
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);
}
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);
}
-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);
-}
-
#ifndef CUSTOMTRACKVIEW_H
#define CUSTOMTRACKVIEW_H
-#include <KPixmapCache>
+#include <KImageCache>
#include <KColorScheme>
#include <QGraphicsView>
class AbstractGroupItem;
class Transition;
-
class CustomTrackView : public QGraphicsView
{
Q_OBJECT
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.
* @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);
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()));
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"
+
+
+
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;