aboutsummaryrefslogtreecommitdiff
path: root/EmbeddedTerminal.qml
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-06-21 20:21:50 +0200
committerAdrian Kummerlaender2015-06-21 20:21:50 +0200
commit97e3cfada0d599fe6121d92d52e4782fc02aed08 (patch)
treea351ca7412489152af3f127bcfe6f0180d17a928 /EmbeddedTerminal.qml
downloadMetaTerm-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 'EmbeddedTerminal.qml')
-rw-r--r--EmbeddedTerminal.qml86
1 files changed, 86 insertions, 0 deletions
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();
+ }
+ }
+ }
+ }
+}