From f01eadd3530e61063b43aa615123dcd82ce3d239 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 29 Jun 2015 22:31:24 +0200 Subject: Added vim-like UI normal and insert modes Normal mode allows for selecting the a terminal or newline text input. Insert mode sets the keyboard focus to the currently selected item. This transforms _MetaTerm_ into a fully keyboard driven application. --- EmbeddedTerminal.qml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'EmbeddedTerminal.qml') diff --git a/EmbeddedTerminal.qml b/EmbeddedTerminal.qml index e02ba61..f4f104e 100644 --- a/EmbeddedTerminal.qml +++ b/EmbeddedTerminal.qml @@ -12,7 +12,8 @@ Item { width: container.width height: container.height - function focus() { terminal.forceActiveFocus() } + function select() { highlighter.select() } + function deselect() { highlighter.deselect() } Row { id: container @@ -23,7 +24,7 @@ Item { width: 10 height: terminal.height - color: "#aadb0f" + color: "#909636" Behavior on opacity { NumberAnimation { @@ -32,8 +33,10 @@ Item { } } - function focus() { opacity = 1 } - function unfocus() { opacity = 0 } + function select() { opacity = 1 } + function deselect() { opacity = 0 } + function focus() { color = "#352F6A" } + function unfocus() { color = "#909636" } } Rectangle { @@ -66,16 +69,15 @@ Item { } } + onTermGetFocus: highlighter.focus() + onTermLostFocus: highlighter.unfocus() + MouseArea { anchors.fill: parent - acceptedButtons: Qt.LeftButton - onClicked: parent.forceActiveFocus(); + acceptedButtons: Qt.NoButton onWheel: { } } - onTermGetFocus: highlighter.focus() - onTermLostFocus: highlighter.unfocus() - Component.onCompleted: { terminal.forceActiveFocus(); session.startShellProgram(); -- cgit v1.2.3