summaryrefslogtreecommitdiff
path: root/src/tabpreviewpopup.cpp
diff options
context:
space:
mode:
authorDavid E. Narváez <david.narvaez@computer.org>2012-04-14 07:54:32 -0500
committerDavid E. Narváez <david.narvaez@computer.org>2012-04-14 07:54:32 -0500
commit9892d840c1d2219f3f86f55d9d35d4f79d56c8a1 (patch)
treedb77b6cea9c11fa60ce3c7feb2b679bb39c68891 /src/tabpreviewpopup.cpp
parentFix typo. (diff)
downloadrekonq-9892d840c1d2219f3f86f55d9d35d4f79d56c8a1.tar.xz
Move Tab Preview to WebTab
Let the WebTab class calculate its own preview, so that it can be used elsewhere in the code. REVIEW: 104517
Diffstat (limited to 'src/tabpreviewpopup.cpp')
-rw-r--r--src/tabpreviewpopup.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/tabpreviewpopup.cpp b/src/tabpreviewpopup.cpp
index 4466868d..821c033c 100644
--- a/src/tabpreviewpopup.cpp
+++ b/src/tabpreviewpopup.cpp
@@ -31,7 +31,6 @@
// Rekonq Includes
#include "webtab.h"
#include "tabbar.h"
-#include "websnap.h"
#include "application.h"
#include "mainwindow.h"
@@ -99,21 +98,14 @@ TabPreviewPopup::~TabPreviewPopup()
void TabPreviewPopup::setWebTab(WebTab* tab)
{
- int w = (tab->parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor);
- int h = w * rApp->mainWindow()->size().height() / rApp->mainWindow()->size().width();
+ const QPixmap preview = tab->tabPreview();
- if (!tab->part())
- setThumbnail(WebSnap::renderPagePreview(*tab->page(), w, h));
- else
+ if (!preview.isNull())
{
- QWidget *part = tab->part()->widget();
- QPixmap partThumb(part->size());
- part->render(&partThumb);
- setThumbnail(partThumb.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
+ setThumbnail(preview);
+ setUrl(tab->url().prettyUrl());
+ setFixedSize(preview.width(), preview.height() + m_url->heightForWidth(preview.width()));
}
- setUrl(tab->url().prettyUrl());
-
- setFixedSize(w, h + m_url->heightForWidth(w));
}