From c4a3ac8eb53f109a3da1f53f279fc86edcb92597 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 16 Mar 2010 01:45:50 +0100 Subject: First bunch of fixes for the NewTabPage + WebSnap chain. It seems clear (to me) that they leaks memory, so they urgently need fixes. And a complete redesign. This is just a first (the easiest) part of it: - Removed some unuseful methods, - Added some documentation for the WebSnap class - Cleaned code, in general --- src/websnap.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/websnap.h') diff --git a/src/websnap.h b/src/websnap.h index 49b60769..73ed04ca 100644 --- a/src/websnap.h +++ b/src/websnap.h @@ -46,9 +46,17 @@ /** - * This class renders a site producing an image based - * on that. + * This class is used in many classes of rekonq to produce an image + * based on the site corresponding to the url passed as argument. + * It also cached the images to not retrieve them everytime :) + * * Heavily based on Graphics-Dojo WebSnap example (thanks!) + * + * We use this in the following rekonq classes: + * - TabBar class: to show a tab preview (given a page, you show WITHOUT saving an image) + * - NewTabPage class: to show the favorites page "preview" (given an url, you show AND save an image) + * - PreviewSelector class: to save new favorite selection (given a page, you show AND save an image) + * */ class REKONQ_TESTS_EXPORT WebSnap : public QObject { @@ -56,20 +64,13 @@ class REKONQ_TESTS_EXPORT WebSnap : public QObject public: WebSnap(const QUrl &url, QWebFrame *frame, int index); - ~WebSnap(); - - QPixmap previewImage(); // TODO : remove - - 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); + static KUrl fileForUrl(KUrl url); - static QString guessNameFromUrl(QUrl url); - static void savePreview(QPixmap pm, KUrl url); - QString snapTitle(); - QUrl snapUrl(); private slots: void load(); -- cgit v1.2.1