diff options
-rw-r--r-- | qml/EmbeddedTerminal.qml | 19 | ||||
-rw-r--r-- | qml/Highlighter.qml | 24 | ||||
-rw-r--r-- | qml/TerminalItem.qml | 17 | ||||
-rw-r--r-- | qml/ui.qrc | 1 |
4 files changed, 29 insertions, 32 deletions
diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml index 2e58fa9..aa22328 100644 --- a/qml/EmbeddedTerminal.qml +++ b/qml/EmbeddedTerminal.qml @@ -26,25 +26,11 @@ Item { spacing: 0 - Rectangle { + Highlighter { id: highlighter width: item.frameWidth Layout.fillHeight: true - - color: "#909636" - - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.OutCubic - } - } - - function select() { opacity = 1 } - function deselect() { opacity = 0 } - function focus() { color = "#352F6A" } - function unfocus() { color = "#909636" } } QMLTermWidget { @@ -73,7 +59,7 @@ Item { } } - onTermGetFocus: highlighter.focus() + onTermGetFocus: highlighter.focus() onTermLostFocus: highlighter.unfocus() MouseArea { @@ -84,6 +70,7 @@ Item { Component.onCompleted: { forceActiveFocus(); + highlighter.select(); session.startShellProgram(); } } diff --git a/qml/Highlighter.qml b/qml/Highlighter.qml new file mode 100644 index 0000000..8d42054 --- /dev/null +++ b/qml/Highlighter.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +Item { + function select() { bar.opacity = 1 } + function deselect() { bar.opacity = 0 } + function focus() { bar.color = "#352F6A" } + function unfocus() { bar.color = "#909636" } + + Rectangle { + id: bar + + anchors.fill: parent + + opacity: 0 + color: "#909636" + + Behavior on opacity { + NumberAnimation { + duration: 300 + easing.type: Easing.OutCubic + } + } + } +} diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index 26793da..48fb9f7 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -116,26 +116,11 @@ Item { right: parent.right } - Rectangle { + Highlighter { id: highlighter width: 10 height: command.height - opacity: 0 - - color: "#909636" - - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.OutCubic - } - } - - function select() { opacity = 1 } - function deselect() { opacity = 0 } - function focus() { color = "#352F6A" } - function unfocus() { color = "#909636" } } TextInput { @@ -4,5 +4,6 @@ <file>StateHandler.qml</file> <file>TerminalItem.qml</file> <file>EmbeddedTerminal.qml</file> + <file>Highlighter.qml</file> </qresource> </RCC> |