diff options
author | Adrian Kummerlaender | 2015-12-14 20:50:43 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-12-14 20:50:43 +0100 |
commit | 1562641cc744ff9d6c0e0fd0ce1936010331000f (patch) | |
tree | 6f49e9b4633e2ad906b85a15ff54d8e07cf2b543 | |
parent | 70fcd5c9221d3d7c0a524559ca053bf74bd6c8f0 (diff) | |
download | MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.tar MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.tar.gz MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.tar.bz2 MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.tar.lz MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.tar.xz MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.tar.zst MetaTerm-1562641cc744ff9d6c0e0fd0ce1936010331000f.zip |
Extract terminal status line into separate QML item
-rw-r--r-- | src/ui.qrc | 1 | ||||
-rw-r--r-- | src/widget/EmbeddedTerminal.qml | 59 | ||||
-rw-r--r-- | src/widget/StatusLine.qml | 76 |
3 files changed, 79 insertions, 57 deletions
@@ -8,6 +8,7 @@ <file alias="CommandInput.qml">command/CommandInput.qml</file> <file alias="commands.js">command/commands.js</file> <file alias="EmbeddedTerminal.qml">widget/EmbeddedTerminal.qml</file> + <file alias="StatusLine.qml">widget/StatusLine.qml</file> <file alias="HistoryViewer.qml">widget/HistoryViewer.qml</file> <file alias="Highlighter.qml">widget/Highlighter.qml</file> </qresource> diff --git a/src/widget/EmbeddedTerminal.qml b/src/widget/EmbeddedTerminal.qml index 24dc3f6..23e545b 100644 --- a/src/widget/EmbeddedTerminal.qml +++ b/src/widget/EmbeddedTerminal.qml @@ -154,67 +154,12 @@ Item { } } - RowLayout { + StatusLine { id: statusLine Layout.fillWidth: true - Layout.alignment: Qt.AlignRight - spacing: 5 - - function update() { - var shellPID = session.getShellPID(); - - pid.text = shellPID; - workingDirectory.text = cwd.currentOfPID(shellPID); - } - - Rectangle { - Layout.fillWidth: true - - anchors.fill: parent - - color: settings.terminal.statusBackground - } - - Text { - id: pid - - Layout.rightMargin: 4 - Layout.bottomMargin: 2 - - font { - family: settings.terminal.fontFamily - pointSize: settings.terminal.fontSize - } - color: settings.terminal.statusFontColor - } - - Text { - Layout.rightMargin: 4 - Layout.bottomMargin: 2 - - font { - family: settings.terminal.fontFamily - pointSize: settings.terminal.fontSize - } - color: settings.terminal.statusFontColor - - text: "@" - } - - Text { - id: workingDirectory - - Layout.rightMargin: 4 - Layout.bottomMargin: 2 - - font { - family: settings.terminal.fontFamily - pointSize: settings.terminal.fontSize - } - color: settings.terminal.statusFontColor - } + session: terminal.session } } } diff --git a/src/widget/StatusLine.qml b/src/widget/StatusLine.qml new file mode 100644 index 0000000..56b0b31 --- /dev/null +++ b/src/widget/StatusLine.qml @@ -0,0 +1,76 @@ +import QtQuick 2.0 +import QMLTermWidget 1.0 +import QtQuick.Layouts 1.1 + +Item { + id: item + + property QMLTermSession session : null + + function update() { + var shellPID = session.getShellPID(); + + pid.text = shellPID; + workingDirectory.text = cwd.currentOfPID(shellPID); + } + + height: wrap.height + + RowLayout { + id: wrap + + anchors.right: parent.right + anchors.left: parent.left + + Layout.alignment: Qt.AlignRight + + spacing: 5 + + Rectangle { + Layout.fillWidth: true + + anchors.fill: wrap + + color: settings.terminal.statusBackground + } + + Text { + id: pid + + Layout.rightMargin: 4 + Layout.bottomMargin: 2 + + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize + } + color: settings.terminal.statusFontColor + } + + Text { + Layout.rightMargin: 4 + Layout.bottomMargin: 2 + + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize + } + color: settings.terminal.statusFontColor + + text: "@" + } + + Text { + id: workingDirectory + + Layout.rightMargin: 4 + Layout.bottomMargin: 2 + + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize + } + color: settings.terminal.statusFontColor + } + } +} |