diff options
author | Adrian Kummerlaender | 2015-07-20 21:02:54 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2015-07-20 21:02:54 +0200 |
commit | 84f2d6febc9344261dcb59c022f293f4f0de3d9a (patch) | |
tree | 82c571512b64bf8d615f6513597c4059ea0ab3d1 /qml/main.qml | |
parent | eca10a1bd5b1f6186d280848bc102e0503c7b487 (diff) | |
download | MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.tar MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.tar.gz MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.tar.bz2 MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.tar.lz MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.tar.xz MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.tar.zst MetaTerm-84f2d6febc9344261dcb59c022f293f4f0de3d9a.zip |
Moved UI mode implementation into separate `StateHandler`
`ApplicationWindow` doesn't offer QML State support but as this functionality lends itself quite well to the _Vim like_ UI mode paradigm it was moved into a `Item` based component.
Diffstat (limited to 'qml/main.qml')
-rw-r--r-- | qml/main.qml | 81 |
1 files changed, 4 insertions, 77 deletions
diff --git a/qml/main.qml b/qml/main.qml index ef17a99..11337f3 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -6,7 +6,6 @@ ApplicationWindow { id: root visible: true - color: "#161616" Component.onCompleted: terminalList.focusCurrent() @@ -84,7 +83,7 @@ ApplicationWindow { if ( activeItem < (children.length - 1) ) { selectItem(activeItem + 1); } else { - insertTerminalAction.trigger(); + state.enterInsertMode(); } } @@ -113,81 +112,9 @@ ApplicationWindow { } } - Action { - id: insertTerminalAction - shortcut: "i" - enabled: false - onTriggered: { - escapeTerminalAction.enabled = true; - insertTerminalAction.enabled = false; - nextTerminalAction.enabled = false; - heightenTerminalAction.enabled = false; - shortenTerminalAction.enabled = false; - prevTerminalAction.enabled = false; - lastTerminalAction.enabled = false; - firstTerminalAction.enabled = false; - - terminalList.focusCurrent(); - } - } - - Action { - id: escapeTerminalAction - shortcut: "Shift+ESC" - onTriggered: { - escapeTerminalAction.enabled = false; - insertTerminalAction.enabled = true; - nextTerminalAction.enabled = true; - heightenTerminalAction.enabled = true; - shortenTerminalAction.enabled = true; - prevTerminalAction.enabled = true; - lastTerminalAction.enabled = true; - firstTerminalAction.enabled = true; - - terminalList.forceActiveFocus(); - terminalList.unfocusCurrent(); - } - } - - Action { - id: nextTerminalAction - shortcut: "j" - enabled: false - onTriggered: terminalList.selectNext() - } - - Action { - id: heightenTerminalAction - shortcut: "Shift+J" - enabled: false - onTriggered: terminalList.getCurrent().heighten() - } - - Action { - id: shortenTerminalAction - shortcut: "Shift+K" - enabled: false - onTriggered: terminalList.getCurrent().shorten() - } - - Action { - id: prevTerminalAction - shortcut: "k" - enabled: false - onTriggered: terminalList.selectPrev() - } - - Action { - id: lastTerminalAction - shortcut: "Shift+G" - enabled: false - onTriggered: terminalList.selectItem(terminalList.children.length - 1) - } + StateHandler { + id: state - Action { - id: firstTerminalAction - shortcut: "g" - enabled: false - onTriggered: terminalList.selectItem(0) + terminalList: terminalList } } |