summaryrefslogtreecommitdiff
path: root/src/tabbar.cpp
diff options
context:
space:
mode:
authorVyacheslav Blinov <blinov.vyacheslav@gmail.com>2011-07-15 10:24:08 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-15 10:24:08 +0200
commit1feccda4818f0dd7c98cf55032f05b3071135fe2 (patch)
tree95ec79aa993d5c621429dc0c5b903c55fba660f6 /src/tabbar.cpp
parentChange KMessageWidget message type (diff)
downloadrekonq-1feccda4818f0dd7c98cf55032f05b3071135fe2.tar.xz
Improving tab previews
Improvements: * title of the page is removed since it is visible on a tab. * widget now has a smooth 3d look'n'feel with Oxygen thanks to raisen frame * widget has rouned corners in all the styles * url of the page is elided * with compositing tab previews will be shown semitransparent with 25% alpha by default, witch can be setted to be optional later * code of tab preview is now separated from tab bar so it is more explicit REVIEWED BY: Johannes, Andrea, Pierre CCMAIL: blinov.vyacheslav@gmail.com REVIEW: 101848
Diffstat (limited to 'src/tabbar.cpp')
-rw-r--r--src/tabbar.cpp42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index dee49eaf..1b2dcb2b 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -42,11 +42,11 @@
#include "webtab.h"
#include "websnap.h"
#include "tabhighlighteffect.h"
+#include "tabpreviewpopup.h"
// KDE Includes
#include <KActionMenu>
#include <KMenu>
-#include <KPassivePopup>
#include <KToolBar>
#include <KColorScheme>
@@ -183,46 +183,8 @@ void TabBar::showTabPreview()
return;
int w = (mv->sizeHint().width() / baseWidthDivisor);
- int h = w * 0.75;
- m_previewPopup = new KPassivePopup(this);
- m_previewPopup.data()->setFrameShape(QFrame::StyledPanel);
- m_previewPopup.data()->setFrameShadow(QFrame::Plain);
-
- QWidget *widget = new QWidget();
- QLabel *thumbnail = new QLabel(widget);
- QLabel *title = new QLabel(widget);
- QLabel *url = new QLabel(widget);
- thumbnail->setPixmap(WebSnap::renderTabPreview(*indexedTab->page(), w, h));
- thumbnail->setAlignment(Qt::AlignHCenter);
-
- QString text = indexedTab->view()->title();
- if (text.length() > 20)
- {
- text = text.left(17) + "...";
- }
-
- title->setText(text);
- title->setAlignment(Qt::AlignHCenter);
-
- text = indexedTab->url().prettyUrl();
- if (text.length() > 20)
- {
- text = text.left(17) + "...";
- }
-
- url->setText(text);
- url->setAlignment(Qt::AlignHCenter);
- QVBoxLayout *vb = new QVBoxLayout(widget);
- vb->addWidget(title);
- vb->addWidget(thumbnail);
- vb->addWidget(url);
- widget->setLayout(vb);
-
- m_previewPopup.data()->setFixedSize(w, h + url->heightForWidth(w) + title->heightForWidth(w));
- m_previewPopup.data()->setView(widget);
- m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop);
- m_previewPopup.data()->layout()->setMargin(0);
+ m_previewPopup = new TabPreviewPopup(indexedTab ,this);
int tabBarWidth = mv->size().width();
int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - w)/2;