From e2f57546558b2d90147cced3beee541e7e1cae9e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 18 Sep 2009 19:22:51 +0200 Subject: Faster loading.. --- src/previewimage.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/previewimage.cpp') diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 2d963171..d027bfd1 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -26,19 +26,32 @@ #include "previewimage.h" #include "previewimage.moc" +#include + #include #include #include -PreviewImage::PreviewImage(const QString &url) +PreviewImage::PreviewImage(const QString &url, const QString &pos) : QLabel() , ws(0) -{ - QString path = KStandardDirs::locate("appdata", "pics/loading.mng"); //QString("thumbs/") + m_fileName, true); - setPixmap( QPixmap(path) ); - kDebug() << url; - ws = new WebSnap( KUrl(url) ); - connect(ws, SIGNAL(finished()), this, SLOT(setSiteImage())); +{ + QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rek") + pos + ".png", true); + + if(QFile::exists(path)) + { + kDebug() << "exists! Loading it..."; + m_pixmap.load(path); + setPixmap( m_pixmap ); + } + else + { + QString path = KStandardDirs::locate("appdata", "pics/loading.mng"); + setPixmap( QPixmap(path) ); + + ws = new WebSnap( url, pos ); + connect(ws, SIGNAL(finished()), this, SLOT(setSiteImage())); + } } -- cgit v1.2.1