diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-03-16 01:45:50 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-03-16 01:45:50 +0100 |
commit | c4a3ac8eb53f109a3da1f53f279fc86edcb92597 (patch) | |
tree | 8ef689aac509629d33fce88c6b2ad31e8837285f /src/websnap.h | |
parent | Merge commit 'refs/merge-requests/104' of git://gitorious.org/rekonq/mainline... (diff) | |
download | rekonq-c4a3ac8eb53f109a3da1f53f279fc86edcb92597.tar.xz |
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
Diffstat (limited to 'src/websnap.h')
-rw-r--r-- | src/websnap.h | 25 |
1 files changed, 13 insertions, 12 deletions
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(); |