diff options
author | Adrian Kummerlaender | 2015-12-13 23:39:53 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-12-13 23:39:53 +0100 |
commit | ef9e2d08263efa811ece898deff6468ad0ed745e (patch) | |
tree | 3433c2e8f6cc7a8c1170eecf54ab22129754aaef /src | |
parent | 93684cccb13489a183aabb7940ec162a1f25fa5c (diff) | |
download | MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.tar MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.tar.gz MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.tar.bz2 MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.tar.lz MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.tar.xz MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.tar.zst MetaTerm-ef9e2d08263efa811ece898deff6468ad0ed745e.zip |
Implement terminal status line prototype
Diffstat (limited to 'src')
-rw-r--r-- | src/SettingsHandler.qml | 1 | ||||
-rw-r--r-- | src/widget/EmbeddedTerminal.qml | 191 |
2 files changed, 125 insertions, 67 deletions
diff --git a/src/SettingsHandler.qml b/src/SettingsHandler.qml index ca5ea6b..ca52198 100644 --- a/src/SettingsHandler.qml +++ b/src/SettingsHandler.qml @@ -68,6 +68,7 @@ QtObject { property string launcherArgument : "-c" property string overlayBackground : "black" property string overlayFontColor : "white" + property string statusFontColor : "gray" } property Settings command : Settings { diff --git a/src/widget/EmbeddedTerminal.qml b/src/widget/EmbeddedTerminal.qml index 67d9a91..5e2e2df 100644 --- a/src/widget/EmbeddedTerminal.qml +++ b/src/widget/EmbeddedTerminal.qml @@ -19,7 +19,7 @@ Item { function deselect() { highlighter.deselect() } function displayOverlay() { overlay.displayBriefly() } - height: terminal.height + height: terminal.parent.height width: parent.width - settings.terminal.frameWidth RowLayout { @@ -39,104 +39,161 @@ Item { Layout.fillHeight: true } - QMLTermWidget { - id: terminal + ColumnLayout { + Layout.fillWidth: true - font { - family: settings.terminal.fontFamily - pointSize: settings.terminal.fontSize - } + spacing: 0 + + QMLTermWidget { + id: terminal - Layout.fillWidth: true - Layout.preferredHeight: fontMetrics.height * item.lines + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize + } - colorScheme: settings.terminal.colorScheme + Layout.fillWidth: true + Layout.preferredHeight: fontMetrics.height * item.lines - session: QMLTermSession { - id: session + colorScheme: settings.terminal.colorScheme - initialWorkingDirectory: settings.terminal.initialWorkingDirectory + session: QMLTermSession { + id: session - shellProgram: settings.terminal.launcherProgram - shellProgramArgs: [ settings.terminal.launcherArgument, program ] + initialWorkingDirectory: settings.terminal.initialWorkingDirectory - onFinished: { - clearScreen(); - item.finished(); + shellProgram: settings.terminal.launcherProgram + shellProgramArgs: [ settings.terminal.launcherArgument, program ] + + onFinished: { + clearScreen(); + item.finished(); + } } - } - Component.onCompleted: { - forceActiveFocus(); - highlighter.select(); - session.startShellProgram(); - overlay.enabled = true; - } + Component.onCompleted: { + forceActiveFocus(); + highlighter.select(); + session.startShellProgram(); + statusLine.update(); + overlay.enabled = true; + } + + onTermGetFocus: { + highlighter.focus(); + statusLine.update(); + } - onTermGetFocus: highlighter.focus() - onTermLostFocus: highlighter.unfocus() - onHeightChanged: overlay.displayBriefly() - onWidthChanged: overlay.displayBriefly() + onTermLostFocus: highlighter.unfocus() + onHeightChanged: overlay.displayBriefly() + onWidthChanged: overlay.displayBriefly() - Rectangle { - id: overlay + Rectangle { + id: overlay - property bool enabled : false + property bool enabled : false - function displayBriefly() { - if ( enabled ) { animation.restart() } - } + function displayBriefly() { + if ( enabled ) { animation.restart() } + } + + anchors.fill: parent + opacity: 0 + color: settings.terminal.overlayBackground + + SequentialAnimation { + id: animation - anchors.fill: parent - opacity: 0 - color: settings.terminal.overlayBackground + ScriptAction { + script: overlay.opacity = 0.8 + } - SequentialAnimation { - id: animation + PauseAnimation { + duration: 500 + } - ScriptAction { - script: overlay.opacity = 0.8 + NumberAnimation { + target: overlay + property: "opacity" + + easing.type: Easing.InSine + duration: 300 + from: 0.8 + to: 0 + } } - PauseAnimation { - duration: 500 + Text { + anchors { + horizontalCenter: overlay.horizontalCenter + verticalCenter: overlay.verticalCenter + } + + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize * 2 + } + color: settings.terminal.overlayFontColor + + text: { + return item.lines + + 'x' + + Math.floor(terminal.width / terminal.fontMetrics.width); + } } + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + onWheel: { } + } + } - NumberAnimation { - target: overlay - property: "opacity" + RowLayout { + id: statusLine - easing.type: Easing.InSine - duration: 300 - from: 0.8 - to: 0 - } + Layout.fillWidth: true + Layout.alignment: Qt.AlignRight + + spacing: 5 + + function update() { + var shellPID = session.getShellPID(); + + pid.text = shellPID; + workingDirectory.text = cwd.currentOfPID(shellPID); } Text { - anchors { - horizontalCenter: overlay.horizontalCenter - verticalCenter: overlay.verticalCenter - } + id: pid font { family: settings.terminal.fontFamily - pointSize: settings.terminal.fontSize * 2 + pointSize: settings.terminal.fontSize } - color: settings.terminal.overlayFontColor + color: settings.terminal.statusFontColor + } - text: { - return item.lines - + 'x' - + Math.floor(terminal.width / terminal.fontMetrics.width); + Text { + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize } + color: settings.terminal.statusFontColor + + text: "@" } - } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.NoButton - onWheel: { } + Text { + id: workingDirectory + + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize + } + color: settings.terminal.statusFontColor + } } } } |