diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-09 02:08:01 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-09 02:08:01 +0200 |
commit | 9ca2eb6a61ea5307923cab67c789e1c0ba2086d5 (patch) | |
tree | c9e79ffcd2c0e2a777bdd883757cfba8af5586b4 /src/mainview.cpp | |
parent | - Some things in the right position (diff) | |
download | rekonq-9ca2eb6a61ea5307923cab67c789e1c0ba2086d5.tar.xz |
HUGE COMMIT
1) moved lionel preview implementation to tabbar class.
This to simplify MainView management AND to use TabBar::tabSizeHint().
Now previews are of the same width of the tab :)
2) cleaned a bit TabBar code
3) fixed scrollButton bug, via a "rude" HACK: an hidden toolbutton shown
when tabs are more than.. a number!
4) Changed tabbar::tabsizehint implementation using 2 stupid constants:
BASE_WIDTH_DIVISOR and MIN_WIDTH_DIVISOR.
Just play with them to modify tab dimension and resize quite all :)
Good night, guys!
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index c77efe83..0abf6996 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -42,7 +42,6 @@ #include "webview.h" #include "sessionmanager.h" #include "homepage.h" -#include "websnap.h" // KDE Includes #include <KUrl> @@ -63,9 +62,6 @@ #include <QtGui/QLabel> #include <QtGui/QMovie> #include <QtGui/QWidget> -#include <QtGui/QMouseEvent> -#include <QtGui/QPainter> -#include <QtGui/QVBoxLayout> MainView::MainView(QWidget *parent) @@ -73,7 +69,6 @@ MainView::MainView(QWidget *parent) , m_urlBar(new UrlBar(this)) , m_tabBar(new TabBar(this)) , m_currentTabIndex(0) - , m_currentTabPreview(-1) { // setting tabbar setTabBar(m_tabBar); @@ -574,78 +569,3 @@ QLabel *MainView::animatedLoading(int index, bool addMovie) m_tabBar->setTabButton(index, QTabBar::LeftSide, label); return label; } - - -void MainView::resizeEvent(QResizeEvent *event) -{ - KTabWidget::resizeEvent(event); -} - - -void MainView::mouseMoveEvent(QMouseEvent *event) -{ - //Find the tab under the mouse - int i = 0; - int tab = -1; - while (i<count() && tab==-1) - { - if (m_tabBar->tabRect(i).contains(event->pos())) tab = i; - i++; - } - - //if found and not the current tab then show tab preview - if (tab!=-1 && tab!=m_tabBar->currentIndex() && m_currentTabPreview!=tab) - { - showTabPreview(tab); - m_currentTabPreview=tab; - } - - //if current tab or not found then hide previous tab preview - if (tab==m_tabBar->currentIndex() || tab==-1) - { - if ( m_previewPopup) - { - m_previewPopup->hide(); - } - m_currentTabPreview=-1; - } - - KTabWidget::mouseMoveEvent(event); -} - -void MainView::leaveEvent(QEvent *event) -{ - //if leave tabwidget then hide previous tab preview - if ( m_previewPopup) - { - m_previewPopup->hide(); - } - m_currentTabPreview=-1; - KTabWidget::leaveEvent(event); -} - - -void MainView::showTabPreview(int tab) -{ - int w=200; - int h=w*((0.0+webView(tab)->height())/webView(tab)->width()); - - //delete previous tab preview - if (m_previewPopup) - { - delete m_previewPopup; - } - - m_previewPopup = new KPassivePopup(this); - m_previewPopup->setFrameShape(QFrame::StyledPanel); - m_previewPopup->setFrameShadow(QFrame::Plain); - m_previewPopup->setFixedSize(w, h); - QLabel *l = new QLabel(); - l->setPixmap(WebSnap::renderPreview(*(webView(tab)->page()), w, h)); - m_previewPopup->setView(l); - m_previewPopup->layout()->setAlignment(Qt::AlignTop); - m_previewPopup->layout()->setMargin(0); - - QPoint pos(m_tabBar->tabRect(tab).x(),m_tabBar->tabRect(tab).y()+m_tabBar->tabRect(tab).height()); - m_previewPopup->show(mapToGlobal(pos)); -} |