From 14f5f78b2c59d40207ff0e988200ef0180bd1081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20E=2E=20Narv=C3=A1ez?= Date: Tue, 17 Apr 2012 01:58:25 -0500 Subject: Remove tabbar.h and mainwindow.h Dependencies from webtab.cpp Fixes previous attempt to move tab preview to WebTab class. REVIEW: 104517 --- src/tabpreviewpopup.cpp | 4 +++- src/webtab.cpp | 11 +++-------- src/webtab.h | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/tabpreviewpopup.cpp b/src/tabpreviewpopup.cpp index 821c033c..52c06cfb 100644 --- a/src/tabpreviewpopup.cpp +++ b/src/tabpreviewpopup.cpp @@ -98,7 +98,9 @@ TabPreviewPopup::~TabPreviewPopup() void TabPreviewPopup::setWebTab(WebTab* tab) { - const QPixmap preview = tab->tabPreview(); + int w = (tab->parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor); + int h = w * rApp->mainWindow()->size().height() / rApp->mainWindow()->size().width(); + const QPixmap preview = tab->tabPreview(w, h); if (!preview.isNull()) { diff --git a/src/webtab.cpp b/src/webtab.cpp index c91c3a20..1519d833 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -36,14 +36,12 @@ #include "application.h" #include "historymanager.h" #include "messagebar.h" -#include "mainwindow.h" #include "opensearchmanager.h" #include "previewselectorbar.h" #include "rsswidget.h" #include "searchenginebar.h" #include "sessionmanager.h" #include "syncmanager.h" -#include "tabbar.h" #include "urlbar.h" #include "walletbar.h" #include "webpage.h" @@ -368,7 +366,7 @@ bool WebTab::hasAdBlockedElements() } -QPixmap WebTab::tabPreview() +QPixmap WebTab::tabPreview(int width, int height) { if (isPageLoading()) { @@ -376,12 +374,9 @@ QPixmap WebTab::tabPreview() return QPixmap(); } - int w = (parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor); - int h = w * rApp->mainWindow()->size().height() / rApp->mainWindow()->size().width(); - if (!part()) { - return WebSnap::renderPagePreview(*page(), w, h); + return WebSnap::renderPagePreview(*page(), width, height); } else { @@ -390,7 +385,7 @@ QPixmap WebTab::tabPreview() partWidget->render(&partThumb); - return partThumb.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + return partThumb.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } } diff --git a/src/webtab.h b/src/webtab.h index c318da10..e9805846 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -92,7 +92,7 @@ public: bool hasAdBlockedElements(); - QPixmap tabPreview(); + QPixmap tabPreview(int width, int height); private Q_SLOTS: void updateProgress(int progress); -- cgit v1.2.1