From ee80c422c341068188820a9e5d9757be80735012 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 18 Jul 2015 22:06:13 +0200 Subject: Moved terminal resizing methods to `TerminalItem` --- qml/TerminalItem.qml | 24 ++++++++++++++++++++++++ qml/main.qml | 32 ++++---------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index b417a6b..acc2f8e 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -44,6 +44,30 @@ Item { } } + function widen() { + if ( terminal !== null ) { + terminal.columns += 1; + } + } + + function narrow() { + if ( terminal !== null ) { + terminal.columns -= 1; + } + } + + function heighten() { + if ( terminal !== null ) { + terminal.lines += 1; + } + } + + function shorten() { + if ( terminal !== null ) { + terminal.lines -= 1; + } + } + FocusScope { id: scope diff --git a/qml/main.qml b/qml/main.qml index 3a4bad2..a2355e9 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -159,52 +159,28 @@ ApplicationWindow { id: heightenTerminalAction shortcut: "Shift+J" enabled: false - onTriggered: { - var current = terminalList.getCurrent().terminal; - - if ( current !== null ) { - current.lines += 1; - } - } + onTriggered: terminalList.getCurrent().heighten() } Action { id: shortenTerminalAction shortcut: "Shift+K" enabled: false - onTriggered: { - var current = terminalList.getCurrent().terminal; - - if ( current !== null ) { - current.lines -= 1; - } - } + onTriggered: terminalList.getCurrent().shorten() } Action { id: widenTerminalAction shortcut: "Shift+L" enabled: false - onTriggered: { - var current = terminalList.getCurrent().terminal; - - if ( current !== null ) { - current.columns += 1; - } - } + onTriggered: terminalList.getCurrent().widen() } Action { id: narrowTerminalAction shortcut: "Shift+H" enabled: false - onTriggered: { - var current = terminalList.getCurrent().terminal; - - if ( current !== null ) { - current.columns -= 1; - } - } + onTriggered: terminalList.getCurrent().narrow() } Action { -- cgit v1.2.3