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/rekonqpage | |
| 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/rekonqpage')
| -rw-r--r-- | src/rekonqpage/newtabpage.cpp | 5 | ||||
| -rw-r--r-- | src/rekonqpage/newtabpage.h | 24 | ||||
| -rw-r--r-- | src/rekonqpage/previewselectorbar.cpp | 6 | 
3 files changed, 18 insertions, 17 deletions
| diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp index 845dcf51..6fd5160d 100644 --- a/src/rekonqpage/newtabpage.cpp +++ b/src/rekonqpage/newtabpage.cpp @@ -56,7 +56,6 @@  NewTabPage::NewTabPage(QWebFrame *frame)      : m_root(frame->documentElement()) -    , m_url(KUrl())  {      QString htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");      QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics");     @@ -98,7 +97,7 @@ void NewTabPage::generate(KUrl url)      }      QWebPage *page = m_root.webFrame()->page(); -    page->mainFrame()->setHtml(m_html,m_url); +    page->mainFrame()->setHtml(m_html);      m_root = page->mainFrame()->documentElement().findFirst("#content"); @@ -109,7 +108,6 @@ void NewTabPage::generate(KUrl url)      {          favoritesPage();          title = i18n("Favorites"); -        url = KUrl("about:favorites");      }      else if(url == KUrl("about:closedTabs"))      { @@ -127,7 +125,6 @@ void NewTabPage::generate(KUrl url)          title = i18n("Bookmarks");      } -    m_url = url;      m_root.document().findFirst("title").setPlainText(title);  } diff --git a/src/rekonqpage/newtabpage.h b/src/rekonqpage/newtabpage.h index d4c57299..fd04e60a 100644 --- a/src/rekonqpage/newtabpage.h +++ b/src/rekonqpage/newtabpage.h @@ -62,7 +62,8 @@ public:      void snapFinished(int index, KUrl url, QString title);      void removePreview(int index); -protected:  // these are the function to build the new tab page +protected:   +    // these are the functions to build the new tab page      void browsingMenu(const KUrl ¤tUrl);      void favoritesPage(); @@ -70,13 +71,15 @@ protected:  // these are the function to build the new tab page      void bookmarksPage();      void closedTabsPage(); +    // Previews handling      QWebElement emptyPreview(int index);      QWebElement loadingPreview(int index, KUrl url);      QWebElement validPreview(int index, KUrl url, QString title); -    /** This function takes a QwebElement with the .thumbnail structure. -        It hides the "remove" and "modify" buttons-> -    */ +    /** This function takes a QwebElement with the .thumbnail structure, +     *  hiding the "remove" and "modify" buttons +     * +     */      void hideControls(QWebElement e);      void showControls(QWebElement e);      void setupPreview(QWebElement e, int index); @@ -84,10 +87,13 @@ protected:  // these are the function to build the new tab page  private:      void createBookItem(const KBookmark &bookmark, QWebElement parent); -    /** This function helps to get faster a new markup of one type,it isn't easy to create one with QWebElement. -        It gets it in the #models div of home.html. -        It works for all elements defined here. -    */ +    /** This function helps to get faster a new markup of one type, +     *  it isn't easy to create one with QWebElement. +     * +     *  It gets it in the #models div of home.html. +     *  It works for all elements defined here. +     * +     */      inline QWebElement markup(QString selector)       {         return m_root.document().findFirst("#models > " + selector).clone(); @@ -98,8 +104,6 @@ private:      QString m_html;      QWebElement m_root; -     -    KUrl m_url;  };  #endif // REKONQ_NEW_TAB_PAGE diff --git a/src/rekonqpage/previewselectorbar.cpp b/src/rekonqpage/previewselectorbar.cpp index d7676e3c..924a5439 100644 --- a/src/rekonqpage/previewselectorbar.cpp +++ b/src/rekonqpage/previewselectorbar.cpp @@ -119,10 +119,10 @@ void PreviewSelectorBar::clicked()      if(page)      { -        KUrl url = page->mainFrame()->url(); - -        WebSnap::savePreview(WebSnap::renderPreview(*page), url); +        // this is done just lo let the render process being faster.. +        WebSnap::renderPreview(*page); +        KUrl url = page->mainFrame()->url();                  QStringList names = ReKonfig::previewNames();          QStringList urls = ReKonfig::previewUrls(); | 
