summaryrefslogtreecommitdiff
path: root/src/tabbar.cpp
diff options
context:
space:
mode:
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;