From c328e203e0d84177a0028d8ba5b0af4b82c16eeb Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 5 Feb 2010 00:29:13 +0100 Subject: QPointers --> QWeakPointers --- src/tabbar.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 460a2464..5e1feb56 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -161,24 +161,21 @@ void TabBar::showTabPreview(int tab) int h = w*((0.0 + currentView->height())/currentView->width()); //delete previous tab preview - if (m_previewPopup) - { - delete m_previewPopup; - } - + m_previewPopup.clear(); + m_previewPopup = new KPassivePopup(this); - m_previewPopup->setFrameShape(QFrame::StyledPanel); - m_previewPopup->setFrameShadow(QFrame::Plain); - m_previewPopup->setFixedSize(w, h); + m_previewPopup.data()->setFrameShape(QFrame::StyledPanel); + m_previewPopup.data()->setFrameShadow(QFrame::Plain); + m_previewPopup.data()->setFixedSize(w, h); QLabel *l = new QLabel(); view->page()->setViewportSize(currentView->page()->viewportSize()); l->setPixmap(WebSnap::renderPreview(*(view->page()), w, h)); - m_previewPopup->setView(l); - m_previewPopup->layout()->setAlignment(Qt::AlignTop); - m_previewPopup->layout()->setMargin(0); + m_previewPopup.data()->setView(l); + m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); + m_previewPopup.data()->layout()->setMargin(0); QPoint pos( tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height() ); - m_previewPopup->show(mapToGlobal(pos)); + m_previewPopup.data()->show(mapToGlobal(pos)); } @@ -208,9 +205,9 @@ void TabBar::mouseMoveEvent(QMouseEvent *event) //if current tab or not found then hide previous tab preview if (tab==currentIndex() || tab==-1) { - if ( m_previewPopup) + if ( !m_previewPopup.isNull() ) { - m_previewPopup->hide(); + m_previewPopup.data()->hide(); } m_currentTabPreview = -1; } @@ -225,9 +222,9 @@ void TabBar::leaveEvent(QEvent *event) if (ReKonfig::alwaysShowTabPreviews()) { //if leave tabwidget then hide previous tab preview - if ( m_previewPopup) + if ( !m_previewPopup.isNull() ) { - m_previewPopup->hide(); + m_previewPopup.data()->hide(); } m_currentTabPreview = -1; } -- cgit v1.2.1 From 595760ddc38f35c8307eac5eb797975b6482461b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 8 Feb 2010 10:35:54 +0100 Subject: Fix tab preview. WeakPointer misconcept --- src/tabbar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 5e1feb56..58216991 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -161,6 +161,7 @@ void TabBar::showTabPreview(int tab) int h = w*((0.0 + currentView->height())/currentView->width()); //delete previous tab preview + delete m_previewPopup.data(); m_previewPopup.clear(); m_previewPopup = new KPassivePopup(this); -- cgit v1.2.1 From 067b99a053b6f8b1ccab507be8e828b2f72a1e43 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 10 Feb 2010 10:57:57 +0100 Subject: Fix copyright for 0.4 beta release --- src/tabbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 58216991..f77d4694 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -3,9 +3,9 @@ * This file is a part of the rekonq project * * Copyright (C) 2008 Benjamin C. Meyer -* Copyright (C) 2008-2009 by Andrea Diamantini +* Copyright (C) 2008-2010 by Andrea Diamantini * Copyright (C) 2009 by Paweł Prażak -* Copyright (C) 2009 by Lionel Chauvin +* Copyright (C) 2009-2010 by Lionel Chauvin * * * This program is free software; you can redistribute it and/or -- cgit v1.2.1 From e9c6614a7986367e29721ace8341c830f5d5a78d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 10 Feb 2010 12:33:09 +0100 Subject: fix tab preview position --- src/tabbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index f77d4694..2fa4cf8e 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -158,7 +158,7 @@ void TabBar::showTabPreview(int tab) return; int w = tabSizeHint(tab).width(); - int h = w*((0.0 + currentView->height())/currentView->width()); + int h = w * ( (0.0 + currentView->height()) / currentView->width() ); //delete previous tab preview delete m_previewPopup.data(); @@ -175,7 +175,7 @@ void TabBar::showTabPreview(int tab) m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); m_previewPopup.data()->layout()->setMargin(0); - QPoint pos( tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height() ); + QPoint pos( tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height() - 3); m_previewPopup.data()->show(mapToGlobal(pos)); } -- cgit v1.2.1 From 87c94e7241ad516bde363ace7087ea819608f07a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 26 Feb 2010 00:45:08 +0100 Subject: This simple commit is inspired from mr #97 It actually hides the addTab button when moving the bars letting it reappear on the release event.. :) --- src/tabbar.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 2fa4cf8e..ff996cb5 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -182,6 +182,13 @@ void TabBar::showTabPreview(int tab) void TabBar::mouseMoveEvent(QMouseEvent *event) { + if (event->buttons() & Qt::LeftButton) + { + // hide addNewTabButton when moving tabs + MainView *view = qobject_cast(parent()); + QTimer::singleShot(200, view->addTabButton(), SLOT(hide())); + } + if (ReKonfig::alwaysShowTabPreviews()) { //Find the tab under the mouse @@ -276,3 +283,12 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos) menu.exec(pos); } + + +void TabBar::mouseReleaseEvent(QMouseEvent *event) +{ + MainView *mv = qobject_cast(parent()); + QTimer::singleShot(200, mv->addTabButton(), SLOT(show())); + + KTabBar::mouseReleaseEvent(event); +} -- cgit v1.2.1 From 0f1dfeac60cdf35e44838b1323d98db8383738c7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 27 Feb 2010 15:29:58 +0100 Subject: New (embrional) unit tests: mainview, tabbar, webtab, webpage --- src/tabbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index ff996cb5..49ed230b 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -93,13 +93,13 @@ QSize TabBar::tabSizeHint(int index) const int minWidth = view->sizeHint().width()/MIN_WIDTH_DIVISOR; int w; - if (baseWidth*count() 0 && tabBarWidth/count()>minWidth) + if (count() > 0 && tabBarWidth/count() > minWidth) { w = tabBarWidth/count(); } -- cgit v1.2.1 From 01bf832717d4910183f7e55715065044361a4108 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 5 Mar 2010 01:34:06 +0100 Subject: Bug about page viewportsize seems fixed here, creating a copy of the page fro the tab preview. Some days of testing needed.. --- src/tabbar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 49ed230b..43432ec4 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -168,9 +168,12 @@ void TabBar::showTabPreview(int tab) m_previewPopup.data()->setFrameShape(QFrame::StyledPanel); m_previewPopup.data()->setFrameShadow(QFrame::Plain); m_previewPopup.data()->setFixedSize(w, h); + QLabel *l = new QLabel(); - view->page()->setViewportSize(currentView->page()->viewportSize()); - l->setPixmap(WebSnap::renderPreview(*(view->page()), w, h)); + QWebPage copyPage(view->page()); + copyPage.setViewportSize(currentView->page()->viewportSize()); + l->setPixmap(WebSnap::renderPreview(copyPage, w, h)); + m_previewPopup.data()->setView(l); m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); m_previewPopup.data()->layout()->setMargin(0); -- cgit v1.2.1 From 384b3f1d066443b67b9d3d6389846a44e976876f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 5 Mar 2010 12:41:28 +0100 Subject: Ok, things seem working well now. Anyway, it needs some days of testing.. --- src/tabbar.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 43432ec4..25351ac0 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -150,15 +150,15 @@ void TabBar::showTabPreview(int tab) { MainView *mv = qobject_cast(parent()); - WebTab *view = mv->webTab(tab); - WebTab *currentView = mv->webTab(currentIndex()); + WebTab *indexedTab = mv->webTab(tab); + WebTab *currentTab = mv->webTab(currentIndex()); // check if view && currentView exist before using them :) - if(!currentView || !view) + if(!currentTab || !indexedTab) return; int w = tabSizeHint(tab).width(); - int h = w * ( (0.0 + currentView->height()) / currentView->width() ); + int h = w * ( (0.0 + currentTab->height()) / currentTab->width() ); //delete previous tab preview delete m_previewPopup.data(); @@ -170,9 +170,7 @@ void TabBar::showTabPreview(int tab) m_previewPopup.data()->setFixedSize(w, h); QLabel *l = new QLabel(); - QWebPage copyPage(view->page()); - copyPage.setViewportSize(currentView->page()->viewportSize()); - l->setPixmap(WebSnap::renderPreview(copyPage, w, h)); + l->setPixmap( WebSnap::renderPreview( *indexedTab->page() , w, h) ); m_previewPopup.data()->setView(l); m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); -- cgit v1.2.1 From 25c5df38ada4523c7c76de55bf736656cf2bb5dc Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Thu, 11 Mar 2010 12:40:15 +0100 Subject: Close the tab preview when the close button is clicked --- src/tabbar.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 25351ac0..80782116 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -293,3 +293,17 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event) KTabBar::mouseReleaseEvent(event); } + + +void TabBar::tabRemoved(int index) +{ + Q_UNUSED(index) + if (ReKonfig::alwaysShowTabPreviews()) + { + if ( !m_previewPopup.isNull() ) + { + m_previewPopup.data()->hide(); + } + m_currentTabPreview = -1; + } +} -- cgit v1.2.1 From cc58fe53816a3033e0a71c6db9826eaf2de69934 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Mon, 15 Mar 2010 00:03:10 +0100 Subject: Close the tab preview when the tab is clicked --- src/tabbar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 80782116..44972548 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -244,6 +244,15 @@ void TabBar::leaveEvent(QEvent *event) void TabBar::mousePressEvent(QMouseEvent *event) { + if (ReKonfig::alwaysShowTabPreviews()) + { + if ( !m_previewPopup.isNull() ) + { + m_previewPopup.data()->hide(); + } + m_currentTabPreview = -1; + } + // just close tab on middle mouse click if (event->button() == Qt::MidButton) return; -- cgit v1.2.1 From c4a3ac8eb53f109a3da1f53f279fc86edcb92597 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 16 Mar 2010 01:45:50 +0100 Subject: First bunch of fixes for the NewTabPage + WebSnap chain. It seems clear (to me) that they leaks memory, so they urgently need fixes. And a complete redesign. This is just a first (the easiest) part of it: - Removed some unuseful methods, - Added some documentation for the WebSnap class - Cleaned code, in general --- src/tabbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 44972548..0f4e1064 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -170,7 +170,7 @@ void TabBar::showTabPreview(int tab) m_previewPopup.data()->setFixedSize(w, h); QLabel *l = new QLabel(); - l->setPixmap( WebSnap::renderPreview( *indexedTab->page() , w, h) ); + l->setPixmap( WebSnap::renderPreview( *indexedTab->page(), w, h, false) ); m_previewPopup.data()->setView(l); m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); -- cgit v1.2.1 From 7d53c477afdfb8013a8ae086d577d46e42455615 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 1 Apr 2010 11:06:00 +0200 Subject: 3 pixels preview's dilemma Johannes Zellner's patch. Thanks :) CCMAIL:johannes.zellner@nokia.com --- src/tabbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 0f4e1064..518b1a96 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -176,7 +176,7 @@ void TabBar::showTabPreview(int tab) m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); m_previewPopup.data()->layout()->setMargin(0); - QPoint pos( tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height() - 3); + QPoint pos( tabRect(tab).x() , tabRect(tab).y() + tabRect(tab).height()); m_previewPopup.data()->show(mapToGlobal(pos)); } -- cgit v1.2.1 From 8ef95ed5f65c07020a91b9fce306eacc0309794a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 17 Apr 2010 18:27:40 +0200 Subject: Clean tab previews, not showing on loading removed a duplicated method and save one QPixmap in WebSnap class --- src/tabbar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 518b1a96..f8da57b1 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -164,13 +164,16 @@ void TabBar::showTabPreview(int tab) delete m_previewPopup.data(); m_previewPopup.clear(); + if (indexedTab->progress() != 0) + return; + m_previewPopup = new KPassivePopup(this); m_previewPopup.data()->setFrameShape(QFrame::StyledPanel); m_previewPopup.data()->setFrameShadow(QFrame::Plain); m_previewPopup.data()->setFixedSize(w, h); QLabel *l = new QLabel(); - l->setPixmap( WebSnap::renderPreview( *indexedTab->page(), w, h, false) ); + l->setPixmap( WebSnap::renderPreview( *indexedTab->page(), w, h, true) ); m_previewPopup.data()->setView(l); m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); -- cgit v1.2.1