From cb84ae8badcab5bfe095e71cf4c0e33175e60817 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 7 Jan 2011 17:49:24 +0100 Subject: This GCI task adds a combobox with different settings to choice when hovering tabs: * tab preview (default one) * show title as tooltip * show url as tooltip * show nothing Patch by Furkan Uzumcu, reviewed (and merged) by adjam BUG:260343 RB:100282 --- src/application.cpp | 29 +++++++++++++++++ src/mainview.cpp | 4 +++ src/rekonq.kcfg | 4 +-- src/settings/settings_tabs.ui | 75 ++++++++++++++++++++++++++++++++----------- src/settings/tabswidget.cpp | 1 - src/tabbar.cpp | 9 +++--- src/tabbar.h | 1 - 7 files changed, 96 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index 41c6e762..466a0a4e 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -528,6 +528,35 @@ void Application::updateConfiguration() Application::historyManager()->loadSettings(); Application::adblockManager()->loadSettings(); + // hovering unfocused tabs options + switch(ReKonfig::hoveringTabOption()) + { + case 0: // tab previews + case 3: // nothing + for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++) + { + mainWindow()->mainView()->tabBar()->setTabToolTip(i, ""); + } + break; + + case 1: // title previews + for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++) + { + mainWindow()->mainView()->tabBar()->setTabToolTip(i, mainWindow()->mainView()->tabText(i).remove('&')); + } + break; + + case 2: // url previews + for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++) + { + mainWindow()->mainView()->tabBar()->setTabToolTip(i, mainWindow()->mainView()->webTab(i)->url().toMimeDataString()); + } + break; + + default: // non extant case + break; + } + defaultSettings = 0; } diff --git a/src/mainview.cpp b/src/mainview.cpp index 94dc1688..42a76758 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -566,6 +566,8 @@ void MainView::webViewTitleChanged(const QString &title) emit currentTitle(viewTitle); } Application::historyManager()->updateHistoryEntry(tab->url(), tabTitle); + if (ReKonfig::hoveringTabOption() == 1) + tabBar()->setTabToolTip(index, tabTitle.remove('&')); } @@ -577,6 +579,8 @@ void MainView::webViewUrlChanged(const QUrl &url) { tabBar()->setTabData(index, url); } + if (ReKonfig::hoveringTabOption() == 2) + tabBar()->setTabToolTip(index, webTab(index)->url().toMimeDataString()); emit tabsChanged(); } diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 6700b4e1..cda76d88 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -96,8 +96,8 @@ false - - true + + 0 false diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index 2e2ee103..290c6274 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -20,6 +20,9 @@ New Tab Behavior + + QFormLayout::ExpandingFieldsGrow + @@ -126,18 +129,64 @@ Tabbed Browsing - + - - - Open links in new tab instead of in new window - - + + + + + + 150 + 0 + + + + When hovering tab show: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + + Tab Previews + + + + + Title Tooltip + + + + + Url Tooltip + + + + + Nothing + + + + + - + - Always show tab bar + Open links in new tab instead of in new window @@ -155,16 +204,6 @@ - - - - Show preview when hovering tab - - - false - - - diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp index aa555339..d9b741be 100644 --- a/src/settings/tabswidget.cpp +++ b/src/settings/tabswidget.cpp @@ -41,7 +41,6 @@ void TabsWidget::save() { } - bool TabsWidget::changed() { return _changed; diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 286d7d45..57124979 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -54,7 +54,6 @@ #include #include - #define BASE_WIDTH_DIVISOR 4 #define MIN_WIDTH_DIVISOR 8 @@ -220,7 +219,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event) KTabBar::mouseMoveEvent(event); - if (ReKonfig::alwaysShowTabPreviews()) + if (ReKonfig::hoveringTabOption() == 0) { //Find the tab under the mouse int i = 0; @@ -262,7 +261,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event) void TabBar::leaveEvent(QEvent *event) { - if (ReKonfig::alwaysShowTabPreviews()) + if (ReKonfig::hoveringTabOption() == 0) { //if leave tabwidget then hide previous tab preview if (!m_previewPopup.isNull()) @@ -278,7 +277,7 @@ void TabBar::leaveEvent(QEvent *event) void TabBar::mousePressEvent(QMouseEvent *event) { - if (ReKonfig::alwaysShowTabPreviews()) + if (ReKonfig::hoveringTabOption() == 0) { if (!m_previewPopup.isNull()) { @@ -355,7 +354,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event) void TabBar::tabRemoved(int /*index*/) { - if (ReKonfig::alwaysShowTabPreviews()) + if (ReKonfig::hoveringTabOption() == 0) { if (!m_previewPopup.isNull()) { diff --git a/src/tabbar.h b/src/tabbar.h index acd8e2fb..41707865 100644 --- a/src/tabbar.h +++ b/src/tabbar.h @@ -90,7 +90,6 @@ private slots: private: void setupHistoryActions(); - friend class MainView; /** -- cgit v1.2.1