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. --- EmbeddedTerminal.qml | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 EmbeddedTerminal.qml (limited to 'EmbeddedTerminal.qml') diff --git a/EmbeddedTerminal.qml b/EmbeddedTerminal.qml new file mode 100644 index 0000000..e02ba61 --- /dev/null +++ b/EmbeddedTerminal.qml @@ -0,0 +1,86 @@ +import QtQuick 2.0 +import QMLTermWidget 1.0 +import QtQuick.Controls 1.2 + +Item { + id: embeddedTerminal + property string program + property string workingDirectory + property int columns + property int lines + + width: container.width + height: container.height + + function focus() { terminal.forceActiveFocus() } + + Row { + id: container + + Rectangle { + id: highlighter + + width: 10 + height: terminal.height + + color: "#aadb0f" + + Behavior on opacity { + NumberAnimation { + duration: 300 + easing.type: Easing.OutCubic + } + } + + function focus() { opacity = 1 } + function unfocus() { opacity = 0 } + } + + Rectangle { + width: terminal.width + height: terminal.height + + color: "#ffffff" + + QMLTermWidget { + id: terminal + + font.family: "Monospace" + font.pointSize: 8 + + width: fontMetrics.width * embeddedTerminal.columns + height: fontMetrics.height * embeddedTerminal.lines + + session: QMLTermSession { + initialWorkingDirectory: embeddedTerminal.workingDirectory + + shellProgram: { + return (embeddedTerminal.program).split(" ")[0]; + } + + shellProgramArgs: { + var elements = (embeddedTerminal.program).split(" "); + elements.shift(); + + return elements; + } + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onClicked: parent.forceActiveFocus(); + onWheel: { } + } + + onTermGetFocus: highlighter.focus() + onTermLostFocus: highlighter.unfocus() + + Component.onCompleted: { + terminal.forceActiveFocus(); + session.startShellProgram(); + } + } + } + } +} -- cgit v1.2.3