diff options
author | Yoann Laissus <yoann.laissus@gmail.com> | 2012-08-05 18:21:50 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-08-14 17:47:41 +0200 |
commit | 618081a2e0c3eb0320ff22fa6615bc73e19152db (patch) | |
tree | 5892a96b569fe266c157c72cef8e9a33eb6f2e9d /src/tabpreviewpopup.cpp | |
parent | Fix the tab preview ratio. We want the web page ratio, not the window ratio. (diff) | |
download | rekonq-618081a2e0c3eb0320ff22fa6615bc73e19152db.tar.xz |
Use a default size for tab preview.
It will fix disproportionate previews caused by very high ratio.
Diffstat (limited to 'src/tabpreviewpopup.cpp')
-rw-r--r-- | src/tabpreviewpopup.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/tabpreviewpopup.cpp b/src/tabpreviewpopup.cpp index 0490e602..92809abc 100644 --- a/src/tabpreviewpopup.cpp +++ b/src/tabpreviewpopup.cpp @@ -29,9 +29,6 @@ #include "tabpreviewpopup.h" // Rekonq Includes -#include "application.h" -#include "mainwindow.h" -#include "tabbar.h" #include "webtab.h" //Qt Includes @@ -96,10 +93,26 @@ TabPreviewPopup::~TabPreviewPopup() } +QSize TabPreviewPopup::thumbnailSize() const +{ + return m_thumbnail->pixmap()->size(); +} + + void TabPreviewPopup::setWebTab(WebTab* tab) { - int w = (tab->parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor); - int h = w * tab->size().height() / tab->size().width(); + // The ratio of the tab + double ratio = (double) tab->size().height() / tab->size().width(); + + int w = previewBaseSize; + int h = previewBaseSize; + + // Apply the ratio to the width or the weight to not exceed previewBaseSize + if (ratio < 1) + h *= ratio; + else if (ratio > 1) + w *= (1 / ratio); + const QPixmap preview = tab->tabPreview(w, h); if (!preview.isNull()) |