diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index caa78199d..5baaf1a0b 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -56,7 +56,6 @@ void removeDir(const QString d) } dir.rmdir(d); - } } @@ -117,6 +116,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) : ui->showNavigationToolbar->setChecked( p_QupZilla->navigationToolbar()->isVisible() ); ui->showHome->setChecked( settings.value("showHomeButton",true).toBool() ); ui->showBackForward->setChecked( settings.value("showBackForwardButtons",true).toBool() ); + ui->showAddTabButton->setChecked( settings.value("showAddTabButton", true).toBool() ); if (settings.value("useTransparentBackground",false).toBool()) ui->useTransparentBg->setChecked(true); else @@ -506,6 +506,7 @@ void Preferences::saveSettings() settings.setValue("showBackForwardButtons",ui->showBackForward->isChecked()); settings.setValue("useTransparentBackground", ui->useTransparentBg->isChecked()); settings.setValue("menuTextColor", m_menuTextColor); + settings.setValue("showAddTabButton", ui->showAddTabButton->isChecked()); settings.endGroup(); //TABS diff --git a/src/preferences/preferences.ui b/src/preferences/preferences.ui index 7e639ed29..57c8b33b8 100644 --- a/src/preferences/preferences.ui +++ b/src/preferences/preferences.ui @@ -460,7 +460,7 @@ - + @@ -485,82 +485,87 @@ - - - Show StatusBar on start - - + + + + + Show StatusBar on start + + + + + + + Show Bookmarks ToolBar on start + + + + + + + Show Navigation ToolBar on start + + + + + + + Show Add Tab button + + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Show Bookmarks ToolBar on start - - - - - - - Show Navigation ToolBar on start - - - - + <b>Navigation ToolBar</b> - + Show Home button - + Show Back / Forward buttons - + <b>Background<b/> - + Use transparent background - + Use background image - + + + + Menu text color + + + + @@ -628,12 +633,18 @@ - - - - Menu text color + + + + Qt::Horizontal - + + + 40 + 20 + + + @@ -988,14 +999,14 @@ - + Allow storing network cache on disk - + @@ -1015,7 +1026,7 @@ - + 10 diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index 4b53d6db1..c102117dd 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -30,19 +30,20 @@ class NewTabButton : public QToolButton public: explicit NewTabButton(QWidget* parent ) : QToolButton(parent) { +#ifndef Q_WS_WIN + setIcon(QIcon::fromTheme("list-add")); + setIconSize(QSize(16,16)); + setAutoRaise(true); +#endif } - QSize sizeHint() const { QSize siz = QToolButton::sizeHint(); -#ifdef Q_WS_X11 - siz.setWidth(25); -#else siz.setWidth(26); -#endif return siz; } +#ifdef Q_WS_WIN private: void paintEvent(QPaintEvent*) { @@ -54,13 +55,11 @@ private: QPixmap pix(":/icons/other/list-add.png"); QRect r = this->rect(); r.setHeight(r.height()+3); -#ifdef Q_WS_X11 - r.setWidth(r.width()-1); -#else r.setWidth(r.width()+3); -#endif style()->drawItemPixmap(&p, r, Qt::AlignCenter, pix); } +#endif + }; class TabListButton : public QToolButton @@ -108,8 +107,6 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) : setObjectName("tabWidget"); setStyleSheet("QTabBar::tab{ max-width:250px; }"); - loadSettings(); - connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory())); connect(this, SIGNAL(currentChanged(int)), p_QupZilla->locationBar(), SLOT(siteIconChanged())); @@ -135,6 +132,8 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) : m_buttonAddTab->setToolTip(tr("Add Tab")); connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab())); setCornerWidget(m_buttonAddTab, Qt::TopLeftCorner); + + loadSettings(); } void TabWidget::loadSettings() @@ -147,6 +146,14 @@ void TabWidget::loadSettings() settings.beginGroup("Web-URL-Settings"); m_urlOnNewTab = settings.value("newTabUrl","").toUrl(); settings.endGroup(); + settings.beginGroup("Browser-View-Settings"); + bool showAddTab = settings.value("showAddTabButton", true).toBool(); + m_buttonAddTab->setVisible(showAddTab); + if (showAddTab && !cornerWidget(Qt::TopLeftCorner)) + setCornerWidget(m_buttonAddTab, Qt::TopLeftCorner); + else if (!showAddTab && cornerWidget(Qt::TopLeftCorner)) + setCornerWidget(0, Qt::TopLeftCorner); + settings.endGroup(); m_tabBar->loadSettings(); }