Commit de694e19 authored by William Brawner's avatar William Brawner
Browse files

Add action to automatically split terminal view

parent 073d3f0e
Pipeline #222434 passed with stage
in 4 minutes and 49 seconds
......@@ -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();
......
......@@ -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();
......
Supports Markdown
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