From dbb98babd5de116609e849bba4382cf9af9458bc Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 18 Jul 2015 21:31:27 +0200 Subject: Added terminal resizing commands --- qml/TerminalItem.qml | 10 +++--- qml/main.qml | 88 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 81 insertions(+), 17 deletions(-) (limited to 'qml') diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index 13a19dd..b417a6b 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -13,7 +13,7 @@ Item { height: elementList.height function select() { - if ( terminal == null ) { + if ( terminal === null ) { highlighter.select(); } else { terminal.select(); @@ -21,7 +21,7 @@ Item { } function deselect() { - if ( terminal == null ) { + if ( terminal === null ) { highlighter.deselect(); } else { terminal.deselect(); @@ -31,7 +31,7 @@ Item { function forceActiveFocus() { scope.forceActiveFocus(); - if ( terminal == null ) { + if ( terminal === null ) { scope.forceActiveFocus(); highlighter.select(); highlighter.focus(); @@ -39,7 +39,7 @@ Item { } function unfocus() { - if ( terminal == null ) { + if ( terminal === null ) { highlighter.unfocus(); } } @@ -110,7 +110,7 @@ Item { Layout.fillWidth: true onAccepted: { - if ( item.terminal == null ) { + if ( item.terminal === null ) { readOnly = true; focus = false; diff --git a/qml/main.qml b/qml/main.qml index 70110db..3a4bad2 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -97,6 +97,10 @@ ApplicationWindow { children[activeItem].unfocus(); } + function getCurrent() { + return children[activeItem]; + } + TerminalItem { width: terminalListFlickable.width onExecuted: terminalList.createItem() @@ -109,12 +113,16 @@ ApplicationWindow { shortcut: "i" enabled: false onTriggered: { - escapeTerminalAction.enabled = true; - insertTerminalAction.enabled = false; - nextTerminalAction.enabled = false; - prevTerminalAction.enabled = false; - lastTerminalAction.enabled = false; - firstTerminalAction.enabled = false; + escapeTerminalAction.enabled = true; + insertTerminalAction.enabled = false; + nextTerminalAction.enabled = false; + heightenTerminalAction.enabled = false; + shortenTerminalAction.enabled = false; + widenTerminalAction.enabled = false; + narrowTerminalAction.enabled = false; + prevTerminalAction.enabled = false; + lastTerminalAction.enabled = false; + firstTerminalAction.enabled = false; terminalList.focusCurrent(); } @@ -124,12 +132,16 @@ ApplicationWindow { id: escapeTerminalAction shortcut: "Shift+ESC" onTriggered: { - escapeTerminalAction.enabled = false; - insertTerminalAction.enabled = true; - nextTerminalAction.enabled = true; - prevTerminalAction.enabled = true; - lastTerminalAction.enabled = true; - firstTerminalAction.enabled = true; + escapeTerminalAction.enabled = false; + insertTerminalAction.enabled = true; + nextTerminalAction.enabled = true; + heightenTerminalAction.enabled = true; + shortenTerminalAction.enabled = true; + widenTerminalAction.enabled = true; + narrowTerminalAction.enabled = true; + prevTerminalAction.enabled = true; + lastTerminalAction.enabled = true; + firstTerminalAction.enabled = true; terminalList.forceActiveFocus(); terminalList.unfocusCurrent(); @@ -143,6 +155,58 @@ ApplicationWindow { onTriggered: terminalList.selectNext() } + Action { + id: heightenTerminalAction + shortcut: "Shift+J" + enabled: false + onTriggered: { + var current = terminalList.getCurrent().terminal; + + if ( current !== null ) { + current.lines += 1; + } + } + } + + Action { + id: shortenTerminalAction + shortcut: "Shift+K" + enabled: false + onTriggered: { + var current = terminalList.getCurrent().terminal; + + if ( current !== null ) { + current.lines -= 1; + } + } + } + + Action { + id: widenTerminalAction + shortcut: "Shift+L" + enabled: false + onTriggered: { + var current = terminalList.getCurrent().terminal; + + if ( current !== null ) { + current.columns += 1; + } + } + } + + Action { + id: narrowTerminalAction + shortcut: "Shift+H" + enabled: false + onTriggered: { + var current = terminalList.getCurrent().terminal; + + if ( current !== null ) { + current.columns -= 1; + } + } + } + Action { id: prevTerminalAction shortcut: "k" -- cgit v1.2.3