1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Remove option to show tab previews

This commit is contained in:
David Rosca 2015-10-09 16:03:38 +02:00
parent df487f0726
commit b39809bfae
8 changed files with 1 additions and 169 deletions

View File

@ -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 \

View File

@ -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();

View File

@ -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);

View File

@ -666,53 +666,6 @@
<string>Tabs behaviour</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QCheckBox" name="showTabPreviews">
<property name="text">
<string>Show tab previews</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="animatedTabPreviews">
<property name="text">
<string>Make tab previews animated</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>63</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="hideTabsOnTab">
<property name="text">

View File

@ -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<WebTab*>(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<QHelpEvent*>(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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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();