diff options
author | Adrian Kummerlaender | 2015-06-21 20:21:50 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2015-06-21 20:21:50 +0200 |
commit | 97e3cfada0d599fe6121d92d52e4782fc02aed08 (patch) | |
tree | a351ca7412489152af3f127bcfe6f0180d17a928 /TerminalItem.qml | |
download | MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.tar MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.tar.gz MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.tar.bz2 MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.tar.lz MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.tar.xz MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.tar.zst MetaTerm-97e3cfada0d599fe6121d92d52e4782fc02aed08.zip |
Initial commit of _MetaTerm_ UI prototype
MetaTerm is a meta terminal in the sense that it allows launching multiple terminal shells and applications in a unified interface that is in itself reminiscent of a terminal shell.
Diffstat (limited to 'TerminalItem.qml')
-rw-r--r-- | TerminalItem.qml | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/TerminalItem.qml b/TerminalItem.qml new file mode 100644 index 0000000..9fce337 --- /dev/null +++ b/TerminalItem.qml @@ -0,0 +1,70 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 + +Item { + id: terminalItem + signal executed + + height: elementList.height + + function focus() { + if ( command.readOnly ) { + elementList.children[1].focus(); + } else { + command.forceActiveFocus(); + } + } + + Column { + id: elementList + + function createTerminal(program) { + var terminal = Qt.createComponent("EmbeddedTerminal.qml"); + var instantiateTerminal = function() { + terminal.createObject(elementList, { + "columns": 90, + "lines": 20, + "program": program, + "workingDirectory": "$HOME" + }); + } + + if ( terminal.status == Component.Ready ) { + instantiateTerminal(); + } else { + terminal.statusChanged.connect(instantiateTerminal); + } + } + + RowLayout { + width: terminalItem.width + + Text { + text: "> " + font.pointSize: 18 + color: "white" + } + + TextInput { + id: command + + font.pointSize: 18 + color: "white" + selectedTextColor: "#161616" + selectionColor: "white" + selectByMouse: true + + Layout.fillWidth: true + + onAccepted: { + if ( !readOnly ) { + readOnly = true; + elementList.createTerminal(text); + terminalItem.executed(); + } + } + } + } + } +} |