From 97e3cfada0d599fe6121d92d52e4782fc02aed08 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 21 Jun 2015 20:21:50 +0200 Subject: 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. --- TerminalItem.qml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 TerminalItem.qml (limited to 'TerminalItem.qml') 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(); + } + } + } + } + } +} -- cgit v1.2.3