From b39809bfae27aff9ae215a48cd1f609c7b0700f5 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Fri, 9 Oct 2015 16:03:38 +0200 Subject: [PATCH] Remove option to show tab previews --- src/lib/lib.pro | 2 - src/lib/preferences/preferences.cpp | 12 ---- src/lib/preferences/preferences.h | 1 - src/lib/preferences/preferences.ui | 47 --------------- src/lib/tabwidget/tabbar.cpp | 89 +---------------------------- src/lib/tabwidget/tabbar.h | 8 --- src/lib/webtab/webtab.cpp | 9 --- src/lib/webtab/webtab.h | 2 - 8 files changed, 1 insertion(+), 169 deletions(-) diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 6e6e9a088..d5f1978d9 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -179,7 +179,6 @@ SOURCES += \ tabwidget/combotabbar.cpp \ tabwidget/tabbar.cpp \ tabwidget/tabicon.cpp \ - tabwidget/tabpreview.cpp \ tabwidget/tabstackedwidget.cpp \ tabwidget/tabwidget.cpp \ tools/aesinterface.cpp \ @@ -372,7 +371,6 @@ HEADERS += \ tabwidget/combotabbar.h \ tabwidget/tabbar.h \ tabwidget/tabicon.h \ - tabwidget/tabpreview.h \ tabwidget/tabstackedwidget.h \ tabwidget/tabwidget.h \ tools/aesinterface.h \ diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index da3780a6a..e75c3e13e 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -235,14 +235,9 @@ Preferences::Preferences(BrowserWindow* window) ui->dontCloseOnLastTab->setChecked(settings.value("dontCloseWithOneTab", false).toBool()); ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool()); ui->showClosedTabsButton->setChecked(settings.value("showClosedTabsButton", false).toBool()); - ui->showTabPreviews->setChecked(settings.value("showTabPreviews", false).toBool()); - ui->animatedTabPreviews->setChecked(settings.value("tabPreviewAnimationsEnabled", true).toBool()); ui->showCloseOnInactive->setCurrentIndex(settings.value("showCloseOnInactiveTabs", 0).toInt()); settings.endGroup(); - connect(ui->showTabPreviews, SIGNAL(toggled(bool)), this, SLOT(showTabPreviewsChanged(bool))); - showTabPreviewsChanged(ui->showTabPreviews->isChecked()); - //AddressBar settings.beginGroup("AddressBar"); ui->addressbarCompletion->setCurrentIndex(settings.value("showSuggestions", 0).toInt()); @@ -714,11 +709,6 @@ void Preferences::useDifferentProxyForHttpsChanged(bool state) ui->httpsProxyPassword->setEnabled(state); } -void Preferences::showTabPreviewsChanged(bool state) -{ - ui->animatedTabPreviews->setEnabled(state); -} - void Preferences::changeCachePathClicked() { QString path = QzTools::getExistingDirectory("Preferences-CachePath", this, tr("Choose cache path..."), ui->cachePath->text()); @@ -885,8 +875,6 @@ void Preferences::saveSettings() settings.setValue("dontCloseWithOneTab", ui->dontCloseOnLastTab->isChecked()); settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked()); settings.setValue("showClosedTabsButton", ui->showClosedTabsButton->isChecked()); - settings.setValue("showTabPreviews", ui->showTabPreviews->isChecked()); - settings.setValue("tabPreviewAnimationsEnabled", ui->animatedTabPreviews->isChecked()); settings.setValue("showCloseOnInactiveTabs", ui->showCloseOnInactive->currentIndex()); settings.endGroup(); diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h index 182f60f5e..1cdc567b9 100644 --- a/src/lib/preferences/preferences.h +++ b/src/lib/preferences/preferences.h @@ -73,7 +73,6 @@ private slots: void setManualProxyConfigurationEnabled(bool state); void useExternalDownManagerChanged(bool state); void useDifferentProxyForHttpsChanged(bool state); - void showTabPreviewsChanged(bool state); void changeCachePathClicked(); void newTabChanged(int value); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index bafe4277b..9ca040a3b 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -666,53 +666,6 @@ Tabs behaviour - - - - - - Show tab previews - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - Make tab previews animated - - - - - - - Qt::Horizontal - - - - 63 - 13 - - - - - - diff --git a/src/lib/tabwidget/tabbar.cpp b/src/lib/tabwidget/tabbar.cpp index 990a55eeb..27bff4455 100644 --- a/src/lib/tabwidget/tabbar.cpp +++ b/src/lib/tabwidget/tabbar.cpp @@ -17,7 +17,6 @@ * ============================================================ */ #include "tabbar.h" #include "tabwidget.h" -#include "tabpreview.h" #include "browserwindow.h" #include "webtab.h" #include "toolbutton.h" @@ -44,8 +43,6 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget) : ComboTabBar() , m_window(window) , m_tabWidget(tabWidget) - , m_tabPreview(new TabPreview(window, window)) - , m_showTabPreviews(false) , m_hideTabBarWithOneTab(false) , m_showCloseOnInactive(0) , m_clickedTab(0) @@ -64,20 +61,9 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget) connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); - m_tabPreviewShowTimer = new QTimer(this); - m_tabPreviewShowTimer->setInterval(300); - m_tabPreviewShowTimer->setSingleShot(true); - connect(m_tabPreviewShowTimer, SIGNAL(timeout()), this, SLOT(showTabPreview())); - - m_tabPreviewHideTimer = new QTimer(this); - m_tabPreviewHideTimer->setInterval(300); - m_tabPreviewHideTimer->setSingleShot(true); - connect(m_tabPreviewHideTimer, SIGNAL(timeout()), m_tabPreview, SLOT(hideAnimated())); - // ComboTabBar features setUsesScrollButtons(true); setCloseButtonsToolTip(BrowserWindow::tr("Close Tab")); - connect(this, SIGNAL(scrollBarValueChanged(int)), this, SLOT(hideTabPreview())); connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overflowChanged(bool))); if (mApp->isPrivate()) { @@ -95,8 +81,6 @@ void TabBar::loadSettings() Settings settings; settings.beginGroup("Browser-Tabs-Settings"); m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool(); - m_tabPreview->setAnimationsEnabled(settings.value("tabPreviewAnimationsEnabled", true).toBool()); - m_showTabPreviews = settings.value("showTabPreviews", false).toBool(); bool activateLastTab = settings.value("ActivateLastTabWhenClosingActual", false).toBool(); m_showCloseOnInactive = settings.value("showCloseOnInactiveTabs", 0).toInt(0); settings.endGroup(); @@ -123,7 +107,6 @@ void TabBar::setVisible(bool visible) visible = !(count() == 1 && m_hideTabBarWithOneTab); } - hideTabPreview(false); ComboTabBar::setVisible(visible); } @@ -438,8 +421,6 @@ void TabBar::currentTabChanged(int index) return; } - hideTabPreview(false); - // Don't hide close buttons when dragging tabs if (m_dragStartPosition.isNull()) { showCloseButton(index); @@ -503,49 +484,6 @@ void TabBar::setTabText(int index, const QString &text) ComboTabBar::setTabText(index, tabText); } -void TabBar::showTabPreview(bool delayed) -{ - if (!m_showTabPreviews) { - return; - } - - if (delayed) { - int index = tabAt(mapFromGlobal(QCursor::pos())); - if (index == -1 || QApplication::mouseButtons() != Qt::NoButton) { - return; - } - - m_tabPreview->setPreviewIndex(index); - m_tabPreviewShowTimer->stop(); - } - - WebTab* webTab = qobject_cast(m_tabWidget->widget(m_tabPreview->previewIndex())); - if (!webTab) { - return; - } - - m_tabPreviewHideTimer->stop(); - m_tabPreview->setWebTab(webTab, m_tabPreview->previewIndex() == currentIndex()); - - QRect r(tabRect(m_tabPreview->previewIndex())); - r.setTopLeft(mapTo(m_window, r.topLeft())); - r.setBottomRight(mapTo(m_window, r.bottomRight())); - - m_tabPreview->showOnRect(r); -} - -void TabBar::hideTabPreview(bool delayed) -{ - m_tabPreviewShowTimer->stop(); - - if (delayed) { - m_tabPreviewHideTimer->start(); - } - else { - m_tabPreview->hideAnimated(); - } -} - void TabBar::tabInserted(int index) { Q_UNUSED(index) @@ -585,8 +523,6 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent* event) void TabBar::mousePressEvent(QMouseEvent* event) { - hideTabPreview(false); - if (mApp->plugins()->processMousePress(Qz::ON_TabBar, this, event)) { return; } @@ -611,22 +547,9 @@ void TabBar::mouseMoveEvent(QMouseEvent* event) int manhattanLength = (event->pos() - m_dragStartPosition).manhattanLength(); if (manhattanLength > QApplication::startDragDistance()) { m_tabWidget->buttonAddTab()->hide(); - hideTabPreview(); } } - // Tab Preview - const int tab = tabAt(event->pos()); - - if (m_tabPreview->isVisible() && tab != -1 && tab != m_tabPreview->previewIndex() && event->buttons() == Qt::NoButton && m_dragStartPosition.isNull()) { - m_tabPreview->setPreviewIndex(tab); - showTabPreview(false); - } - - if (!m_tabPreview->isVisible()) { - m_tabPreviewShowTimer->start(); - } - ComboTabBar::mouseMoveEvent(event); } @@ -667,7 +590,7 @@ bool TabBar::event(QEvent* event) { switch (event->type()) { case QEvent::ToolTip: - if (!m_showTabPreviews && !isDragInProgress()) { + if (!isDragInProgress()) { QHelpEvent* ev = static_cast(event); int index = tabAt(ev->pos()); @@ -677,16 +600,6 @@ bool TabBar::event(QEvent* event) } break; - case QEvent::Leave: - if (!rect().contains(mapFromGlobal(QCursor::pos()))) { - hideTabPreview(); - } - break; - - case QEvent::Wheel: - hideTabPreview(false); - break; - default: break; } diff --git a/src/lib/tabwidget/tabbar.h b/src/lib/tabwidget/tabbar.h index b3bbb5e17..86191aebc 100644 --- a/src/lib/tabwidget/tabbar.h +++ b/src/lib/tabwidget/tabbar.h @@ -26,7 +26,6 @@ class BrowserWindow; class TabWidget; -class TabPreview; class WebTab; class QUPZILLA_EXPORT TabBar : public ComboTabBar @@ -75,9 +74,6 @@ private slots: void closeAllButCurrent(); void closeTabFromButton(); - void showTabPreview(bool delayed = true); - void hideTabPreview(bool delayed = true); - private: inline bool validIndex(int index) const { return index >= 0 && index < count(); } @@ -103,11 +99,7 @@ private: BrowserWindow* m_window; TabWidget* m_tabWidget; - TabPreview* m_tabPreview; - QTimer* m_tabPreviewShowTimer; - QTimer* m_tabPreviewHideTimer; - bool m_showTabPreviews; bool m_hideTabBarWithOneTab; int m_showCloseOnInactive; diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index fbc8c7c1a..4f96f8d6d 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -326,15 +326,6 @@ void WebTab::p_restoreTab(const WebTab::SavedTab &tab) p_restoreTab(tab.url, tab.history); } -QPixmap WebTab::renderTabPreview() -{ - const int previewWidth = 230; - const int previewHeight = 150; - - QPixmap p = m_webView->grab(); - return p.scaled(previewWidth, previewHeight, Qt::KeepAspectRatioByExpanding); -} - void WebTab::showNotification(QWidget* notif) { const int notifPos = 0; diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index 9bfd7e5dd..79b35d050 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -93,8 +93,6 @@ public: void p_restoreTab(const SavedTab &tab); void p_restoreTab(const QUrl &url, const QByteArray &history); - QPixmap renderTabPreview(); - private slots: void showNotification(QWidget* notif); void loadStarted();