Changeset View
Changeset View
Standalone View
Standalone View
src/ViewContainer.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 64 | { | |||
---|---|---|---|---|---|
65 | setAcceptDrops(true); | 65 | setAcceptDrops(true); | ||
66 | 66 | | |||
67 | auto tabBarWidget = new DetachableTabBar(); | 67 | auto tabBarWidget = new DetachableTabBar(); | ||
68 | setTabBar(tabBarWidget); | 68 | setTabBar(tabBarWidget); | ||
69 | setDocumentMode(true); | 69 | setDocumentMode(true); | ||
70 | setMovable(true); | 70 | setMovable(true); | ||
71 | connect(tabBarWidget, &DetachableTabBar::moveTabToWindow, this, &TabbedViewContainer::moveTabToWindow); | 71 | connect(tabBarWidget, &DetachableTabBar::moveTabToWindow, this, &TabbedViewContainer::moveTabToWindow); | ||
72 | tabBar()->setContextMenuPolicy(Qt::CustomContextMenu); | 72 | tabBar()->setContextMenuPolicy(Qt::CustomContextMenu); | ||
73 | _newTabButton->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); | 73 | _newTabButton->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | ||
rizzitello: To save you time looking for it the icon set here. | |||||
74 | _newTabButton->setAutoRaise(true); | 74 | _newTabButton->setAutoRaise(true); | ||
75 | connect(_newTabButton, &QToolButton::clicked, this, [this]{ | 75 | connect(_newTabButton, &QToolButton::clicked, this, [this]{ | ||
76 | emit newViewRequest(this); | 76 | emit newViewRequest(this); | ||
77 | }); | 77 | }); | ||
78 | 78 | | |||
79 | _closeTabButton->setIcon(QIcon::fromTheme(QStringLiteral("tab-close"))); | 79 | _closeTabButton->setIcon(QIcon::fromTheme(QStringLiteral("tab-close"))); | ||
80 | _closeTabButton->setAutoRaise(true); | 80 | _closeTabButton->setAutoRaise(true); | ||
81 | connect(_closeTabButton, &QToolButton::clicked, this, [this]{ | 81 | connect(_closeTabButton, &QToolButton::clicked, this, [this]{ | ||
Show All 16 Lines | 96 | connect(_contextPopupMenu, &QMenu::aboutToHide, this, [this]() { | |||
98 | for (auto &action : _contextPopupMenu->actions()) { | 98 | for (auto &action : _contextPopupMenu->actions()) { | ||
99 | if (action->objectName() == QStringLiteral("view-readonly")) { | 99 | if (action->objectName() == QStringLiteral("view-readonly")) { | ||
100 | _contextPopupMenu->removeAction(action); | 100 | _contextPopupMenu->removeAction(action); | ||
101 | break; | 101 | break; | ||
102 | } | 102 | } | ||
103 | } | 103 | } | ||
104 | }); | 104 | }); | ||
105 | 105 | | |||
106 | connect(tabBar(), &QTabBar::tabCloseRequested, this, &TabbedViewContainer::closeTerminalTab); | ||||
107 | | ||||
106 | #if defined(ENABLE_DETACHING) | 108 | #if defined(ENABLE_DETACHING) | ||
107 | auto detachAction = _contextPopupMenu->addAction( | 109 | auto detachAction = _contextPopupMenu->addAction( | ||
108 | QIcon::fromTheme(QStringLiteral("tab-detach")), | 110 | QIcon::fromTheme(QStringLiteral("tab-detach")), | ||
109 | i18nc("@action:inmenu", "&Detach Tab"), this, | 111 | i18nc("@action:inmenu", "&Detach Tab"), this, | ||
110 | [this] { emit detachTab(this, terminalAt(_contextMenuTabIndex)); } | 112 | [this] { emit detachTab(this, terminalAt(_contextMenuTabIndex)); } | ||
111 | ); | 113 | ); | ||
112 | detachAction->setObjectName(QStringLiteral("tab-detach")); | 114 | detachAction->setObjectName(QStringLiteral("tab-detach")); | ||
113 | #endif | 115 | #endif | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 184 | if (KonsoleSettings::tabBarVisibility() == KonsoleSettings::EnumTabBarVisibility::AlwaysShowTabBar) { | |||
183 | tabBar()->setVisible(true); | 185 | tabBar()->setVisible(true); | ||
184 | } else if (KonsoleSettings::tabBarVisibility() == KonsoleSettings::EnumTabBarVisibility::AlwaysHideTabBar) { | 186 | } else if (KonsoleSettings::tabBarVisibility() == KonsoleSettings::EnumTabBarVisibility::AlwaysHideTabBar) { | ||
185 | tabBar()->setVisible(false); | 187 | tabBar()->setVisible(false); | ||
186 | } | 188 | } | ||
187 | } | 189 | } | ||
188 | 190 | | |||
189 | setTabPosition((QTabWidget::TabPosition) KonsoleSettings::tabBarPosition()); | 191 | setTabPosition((QTabWidget::TabPosition) KonsoleSettings::tabBarPosition()); | ||
190 | 192 | | |||
191 | setCornerWidget( KonsoleSettings::showQuickButtons() ? _newTabButton : nullptr, Qt::TopLeftCorner); | 193 | setCornerWidget(KonsoleSettings::newTabButton() ? _newTabButton : nullptr, Qt::TopLeftCorner); | ||
192 | setCornerWidget( KonsoleSettings::showQuickButtons() ? _closeTabButton : nullptr, Qt::TopRightCorner); | 194 | _newTabButton->setVisible(KonsoleSettings::newTabButton()); | ||
195 | | ||||
196 | setCornerWidget(KonsoleSettings::closeTabButton() == 1 ? _closeTabButton : nullptr, Qt::TopRightCorner); | ||||
197 | _closeTabButton->setVisible(KonsoleSettings::closeTabButton() == 1); | ||||
198 | | ||||
199 | tabBar()->setTabsClosable(KonsoleSettings::closeTabButton() == 0); | ||||
193 | 200 | | |||
194 | tabBar()->setExpanding(KonsoleSettings::expandTabWidth()); | 201 | tabBar()->setExpanding(KonsoleSettings::expandTabWidth()); | ||
195 | tabBar()->update(); | 202 | tabBar()->update(); | ||
196 | if (isVisible() && KonsoleSettings::showQuickButtons()) { | | |||
197 | _newTabButton->setVisible(true); | | |||
198 | _closeTabButton->setVisible(true); | | |||
199 | } | | |||
200 | 203 | | |||
201 | if (KonsoleSettings::tabBarUseUserStyleSheet()) { | 204 | if (KonsoleSettings::tabBarUseUserStyleSheet()) { | ||
202 | setCssFromFile(KonsoleSettings::tabBarUserStyleSheetFile()); | 205 | setCssFromFile(KonsoleSettings::tabBarUserStyleSheetFile()); | ||
203 | } else { | 206 | } else { | ||
204 | setCss(); | 207 | setCss(); | ||
205 | } | 208 | } | ||
206 | } | 209 | } | ||
207 | 210 | | |||
▲ Show 20 Lines • Show All 336 Lines • Show Last 20 Lines |
To save you time looking for it the icon set here.