1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

Add Tab button will only show theme specific icon on Linux + added

option to show/hide it
This commit is contained in:
nowrep 2011-04-19 20:46:31 +02:00
parent 6db73b6c1a
commit 1282e23b71
3 changed files with 79 additions and 60 deletions

View File

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

View File

@ -460,7 +460,7 @@
</layout>
</widget>
<widget class="QWidget" name="stackedWidgetPage2">
<layout class="QGridLayout" name="gridLayout_7">
<layout class="QGridLayout" name="gridLayout_16">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_18">
<property name="text">
@ -485,82 +485,87 @@
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="showStatusbar">
<property name="text">
<string>Show StatusBar on start</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QCheckBox" name="showStatusbar">
<property name="text">
<string>Show StatusBar on start</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="showBookmarksToolbar">
<property name="text">
<string>Show Bookmarks ToolBar on start</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="showNavigationToolbar">
<property name="text">
<string>Show Navigation ToolBar on start</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="showAddTabButton">
<property name="text">
<string>Show Add Tab button</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="showBookmarksToolbar">
<property name="text">
<string>Show Bookmarks ToolBar on start</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="showNavigationToolbar">
<property name="text">
<string>Show Navigation ToolBar on start</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>&lt;b&gt;Navigation ToolBar&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="3" column="1">
<widget class="QCheckBox" name="showHome">
<property name="text">
<string>Show Home button</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="4" column="1">
<widget class="QCheckBox" name="showBackForward">
<property name="text">
<string>Show Back / Forward buttons</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>&lt;b&gt;Background&lt;b/&gt;</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="6" column="1">
<widget class="QRadioButton" name="useTransparentBg">
<property name="text">
<string>Use transparent background</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="7" column="1">
<widget class="QRadioButton" name="useBgImage">
<property name="text">
<string>Use background image</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<item row="8" column="1">
<widget class="QToolButton" name="textColorChooser">
<property name="text">
<string>Menu text color</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QFrame" name="bgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -628,12 +633,18 @@
</layout>
</widget>
</item>
<item row="10" column="1">
<widget class="QToolButton" name="textColorChooser">
<property name="text">
<string>Menu text color</string>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
@ -988,14 +999,14 @@
</layout>
</widget>
</item>
<item row="3" column="1" colspan="4">
<item row="1" column="1" colspan="4">
<widget class="QCheckBox" name="allowCache">
<property name="text">
<string>Allow storing network cache on disk</string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="2" column="2">
<widget class="QFrame" name="cacheFrame">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
@ -1015,7 +1026,7 @@
</layout>
</widget>
</item>
<item row="4" column="4">
<item row="2" column="4">
<widget class="QSlider" name="cacheMB">
<property name="minimum">
<number>10</number>

View File

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