Commit 91112821 authored by Thomas Schöps's avatar Thomas Schöps Committed by Thomas Schöps

Add a setting to disable the close buttons on tabs

parent 7cb06699
......@@ -12,6 +12,9 @@
<entry name="TabBarVisibility" key="TabBarVisibility" type="Int">
<default>1</default>
</entry>
<entry name="CloseButtonsOnTabs" key="CloseButtonsOnTabs" type="Int">
<default>1</default>
</entry>
<entry name="TabBarOpenAfterCurrent" key="TabBarOpenAfterCurrent" type="Int">
<default>1</default>
</entry>
......
......@@ -86,7 +86,7 @@
<string>Tabbed Browsing</string>
</property>
<layout class="QGridLayout" name="gridLayout_1">
<item row="1" column="0">
<item row="2" column="0">
<widget class="QCheckBox" name="kcfg_TabBarOpenAfterCurrent">
<property name="toolTip">
<string>Controls whether to open new tabs next to the active one.</string>
......@@ -99,7 +99,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QCheckBox" name="kcfg_TabBarArrangeBuddies">
<property name="toolTip">
<string>When enabled, plugins can group related files side by side.
......@@ -123,6 +123,19 @@ For example, a header file will be opened next to the implementation file.</stri
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_CloseButtonsOnTabs">
<property name="toolTip">
<string>Enables or disables the display of a close button in each tab in the tab bar at the top of the editor window.</string>
</property>
<property name="text">
<string>Show close buttons on tabs</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -191,5 +204,21 @@ For example, a header file will be opened next to the implementation file.</stri
</hint>
</hints>
</connection>
<connection>
<sender>kcfg_TabBarVisibility</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_CloseButtonsOnTabs</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>260</x>
<y>133</y>
</hint>
<hint type="destinationlabel">
<x>260</x>
<y>158</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -365,7 +365,7 @@ Container::Container(QWidget *parent)
setTabBarHidden(!configTabBarVisible());
d->tabBar->setTabsClosable(true);
d->tabBar->setTabsClosable(configCloseButtonsOnTabs());
d->tabBar->setMovable(true);
d->tabBar->setExpanding(false);
d->tabBar->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
......@@ -379,6 +379,12 @@ bool Container::configTabBarVisible()
return group.readEntry("TabBarVisibility", 1);
}
bool Container::configCloseButtonsOnTabs()
{
KConfigGroup group = KSharedConfig::openConfig()->group("UiSettings");
return group.readEntry("CloseButtonsOnTabs", 1);
}
void Container::setLeftCornerWidget(QWidget* widget)
{
Q_D(Container);
......@@ -632,6 +638,13 @@ void Container::setTabBarHidden(bool hide)
}
}
void Container::setCloseButtonsOnTabs(bool show)
{
Q_D(Container);
d->tabBar->setTabsClosable(show);
}
void Container::resetTabColors(const QColor& color)
{
Q_D(Container);
......
......@@ -61,6 +61,7 @@ public:
View *viewForWidget(QWidget *w) const;
void setTabBarHidden(bool hide);
void setCloseButtonsOnTabs(bool show);
void setTabColor(const View* view, const QColor& color);
void setTabColors(const QHash<const View*, QColor>& colors);
......@@ -76,6 +77,7 @@ public:
QRect tabRect(int tab) const;
static bool configTabBarVisible();
static bool configCloseButtonsOnTabs();
Q_SIGNALS:
void activateView(Sublime::View* view);
......
......@@ -351,8 +351,10 @@ void MainWindow::loadSettings()
}
const bool tabBarHidden = !Container::configTabBarVisible();
const bool closeButtonsOnTabs = Container::configCloseButtonsOnTabs();
for (Container *container : qAsConst(d->viewContainers)) {
container->setTabBarHidden(tabBarHidden);
container->setCloseButtonsOnTabs(closeButtonsOnTabs);
}
hu.stop();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment