Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
de694e19
Commit
de694e19
authored
Aug 01, 2022
by
William Brawner
Browse files
Add action to automatically split terminal view
parent
073d3f0e
Pipeline
#222434
passed with stage
in 4 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/ViewManager.cpp
View file @
de694e19
...
...
@@ -124,6 +124,14 @@ void ViewManager::setupActions()
collection
->
addAction
(
QStringLiteral
(
"split-view-top-bottom"
),
action
);
splitViewActions
->
addAction
(
action
);
action
=
new
QAction
(
this
);
action
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"view-split-auto"
)));
action
->
setText
(
i18nc
(
"@action:inmenu"
,
"Split View Automatically"
));
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
ViewManager
::
splitAuto
);
collection
->
setDefaultShortcut
(
action
,
QKeySequence
(
Qt
::
CTRL
|
Qt
::
Key_Asterisk
));
collection
->
addAction
(
QStringLiteral
(
"split-view-auto"
),
action
);
splitViewActions
->
addAction
(
action
);
splitViewActions
->
addSeparator
();
action
=
new
QAction
(
this
);
...
...
@@ -627,6 +635,18 @@ void ViewManager::splitTopBottom()
splitView
(
Qt
::
Vertical
);
}
void
ViewManager
::
splitAuto
()
{
Qt
::
Orientation
orientation
;
auto
activeTerminalDisplay
=
_viewContainer
->
activeViewSplitter
()
->
activeTerminalDisplay
();
if
(
activeTerminalDisplay
->
width
()
>
activeTerminalDisplay
->
height
())
{
orientation
=
Qt
::
Horizontal
;
}
else
{
orientation
=
Qt
::
Vertical
;
}
splitView
(
orientation
);
}
void
ViewManager
::
splitView
(
Qt
::
Orientation
orientation
)
{
int
currentSessionId
=
currentSession
();
...
...
src/ViewManager.h
View file @
de694e19
...
...
@@ -318,6 +318,7 @@ private Q_SLOTS:
// called when the "Split View Left/Right" menu item is selected
void
splitLeftRight
();
void
splitTopBottom
();
void
splitAuto
();
void
expandActiveContainer
();
void
shrinkActiveContainer
();
void
equalSizeAllContainers
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment