diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-06-18 17:22:04 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-06-18 17:22:04 +0200 |
commit | 7800e131b954ef646fb4db073eb9d09a677b09b9 (patch) | |
tree | 7738b84e6e9afc66adb97aba809a19e6d5a36100 /src | |
parent | Adding a "default" encoding option.. (diff) | |
download | rekonq-7800e131b954ef646fb4db073eb9d09a677b09b9.tar.xz |
No more save tab previews as they are everytime computed again..
Diffstat (limited to 'src')
-rw-r--r-- | src/tabbar.cpp | 2 | ||||
-rw-r--r-- | src/websnap.cpp | 19 | ||||
-rw-r--r-- | src/websnap.h | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp index a1bbf2b8..f3584eed 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -181,7 +181,7 @@ void TabBar::showTabPreview() m_previewPopup.data()->setFixedSize(w, h); QLabel *l = new QLabel(); - l->setPixmap(WebSnap::renderPreview(*indexedTab->page(), w, h)); + l->setPixmap( WebSnap::renderPreview(*indexedTab->page(), w, h, false) ); m_previewPopup.data()->setView(l); m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); diff --git a/src/websnap.cpp b/src/websnap.cpp index 0f2dc7b9..b85e5da8 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -81,7 +81,7 @@ void WebSnap::load() // NOTE please, be careful modifying this. // You are playing with fire.. -QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h) +QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h, bool save) { // NOTE // it seems no way to enable/disable scrollbars in new QtWebKit's @@ -118,13 +118,16 @@ QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h) page.setViewportSize(oldSize); QPixmap pm = QPixmap::fromImage(pageImage); - KUrl url(page.mainFrame()->url()); - kDebug() << "saving preview"; - - QString path = imagePathFromUrl(url); - QFile::remove(path); - pm.save(path); - + + if(save) + { + KUrl url(page.mainFrame()->url()); + kDebug() << "saving preview"; + QString path = imagePathFromUrl(url); + QFile::remove(path); + pm.save(path); + } + return pm; } diff --git a/src/websnap.h b/src/websnap.h index 03d63746..cfc2c83e 100644 --- a/src/websnap.h +++ b/src/websnap.h @@ -85,10 +85,11 @@ public: * @param page the page to snap * @param w the image width * @param h the image height + * @param save decide to save or not the preview on cache * * @return the pixmap snapped from the page */ - static QPixmap renderPreview(const QWebPage &page, int w = WIDTH, int h = HEIGHT); + static QPixmap renderPreview(const QWebPage &page, int w = WIDTH, int h = HEIGHT, bool save = true); /** * Guess the local path where the image for the url provided |