From 55c66514c6e03bc731c7f5ae4d6f6a1e1d1ab601 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 15 Dec 2015 19:53:18 +0100 Subject: Separate widgets into primary and augmenting items --- src/ui.qrc | 6 +-- src/widget/Highlighter.qml | 24 ------------ src/widget/Overlay.qml | 61 ------------------------------ src/widget/StatusLine.qml | 76 -------------------------------------- src/widget/augment/Highlighter.qml | 24 ++++++++++++ src/widget/augment/Overlay.qml | 60 ++++++++++++++++++++++++++++++ src/widget/augment/StatusLine.qml | 76 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 163 insertions(+), 164 deletions(-) delete mode 100644 src/widget/Highlighter.qml delete mode 100644 src/widget/Overlay.qml delete mode 100644 src/widget/StatusLine.qml create mode 100644 src/widget/augment/Highlighter.qml create mode 100644 src/widget/augment/Overlay.qml create mode 100644 src/widget/augment/StatusLine.qml diff --git a/src/ui.qrc b/src/ui.qrc index 31ec346..0cf1b20 100644 --- a/src/ui.qrc +++ b/src/ui.qrc @@ -8,9 +8,9 @@ command/CommandInput.qml command/commands.js widget/EmbeddedTerminal.qml - widget/StatusLine.qml widget/HistoryViewer.qml - widget/Highlighter.qml - widget/Overlay.qml + widget/augment/StatusLine.qml + widget/augment/Highlighter.qml + widget/augment/Overlay.qml diff --git a/src/widget/Highlighter.qml b/src/widget/Highlighter.qml deleted file mode 100644 index 53f308c..0000000 --- a/src/widget/Highlighter.qml +++ /dev/null @@ -1,24 +0,0 @@ -import QtQuick 2.0 - -Item { - function select() { bar.opacity = 1 } - function deselect() { bar.opacity = 0 } - function focus() { bar.color = settings.highlighter.focusColor } - function unfocus() { bar.color = settings.highlighter.defaultColor } - - Rectangle { - id: bar - - anchors.fill: parent - - opacity: 0 - color: settings.highlighter.defaultColor - - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.OutCubic - } - } - } -} diff --git a/src/widget/Overlay.qml b/src/widget/Overlay.qml deleted file mode 100644 index 2a50219..0000000 --- a/src/widget/Overlay.qml +++ /dev/null @@ -1,61 +0,0 @@ -import QtQuick 2.0 - -Item { - id: item - - property bool enabled : false - - property alias text : content.text - - function displayBriefly() { - if ( enabled ) { - animation.restart() - } - } - - Rectangle { - id: background - - anchors.fill: parent - - opacity: 0 - color: settings.terminal.overlayBackground - - SequentialAnimation { - id: animation - - ScriptAction { - script: background.opacity = 0.8 - } - - PauseAnimation { - duration: 500 - } - - NumberAnimation { - target: background - property: "opacity" - - easing.type: Easing.InSine - duration: 300 - from: 0.8 - to: 0 - } - } - - Text { - id: content - - anchors { - horizontalCenter: background.horizontalCenter - verticalCenter: background.verticalCenter - } - - font { - family: settings.terminal.fontFamily - pointSize: settings.terminal.fontSize * 2 - } - color: settings.terminal.overlayFontColor - } - } -} diff --git a/src/widget/StatusLine.qml b/src/widget/StatusLine.qml deleted file mode 100644 index 56b0b31..0000000 --- a/src/widget/StatusLine.qml +++ /dev/null @@ -1,76 +0,0 @@ -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 - } - } -} diff --git a/src/widget/augment/Highlighter.qml b/src/widget/augment/Highlighter.qml new file mode 100644 index 0000000..53f308c --- /dev/null +++ b/src/widget/augment/Highlighter.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +Item { + function select() { bar.opacity = 1 } + function deselect() { bar.opacity = 0 } + function focus() { bar.color = settings.highlighter.focusColor } + function unfocus() { bar.color = settings.highlighter.defaultColor } + + Rectangle { + id: bar + + anchors.fill: parent + + opacity: 0 + color: settings.highlighter.defaultColor + + Behavior on opacity { + NumberAnimation { + duration: 300 + easing.type: Easing.OutCubic + } + } + } +} diff --git a/src/widget/augment/Overlay.qml b/src/widget/augment/Overlay.qml new file mode 100644 index 0000000..ac1e230 --- /dev/null +++ b/src/widget/augment/Overlay.qml @@ -0,0 +1,60 @@ +import QtQuick 2.0 + +Item { + id: item + + property bool enabled : false + property alias text : content.text + + function displayBriefly() { + if ( enabled ) { + animation.restart() + } + } + + Rectangle { + id: background + + anchors.fill: parent + + opacity: 0 + color: settings.terminal.overlayBackground + + SequentialAnimation { + id: animation + + ScriptAction { + script: background.opacity = 0.8 + } + + PauseAnimation { + duration: 500 + } + + NumberAnimation { + target: background + property: "opacity" + + easing.type: Easing.InSine + duration: 300 + from: 0.8 + to: 0 + } + } + + Text { + id: content + + anchors { + horizontalCenter: background.horizontalCenter + verticalCenter: background.verticalCenter + } + + font { + family: settings.terminal.fontFamily + pointSize: settings.terminal.fontSize * 2 + } + color: settings.terminal.overlayFontColor + } + } +} diff --git a/src/widget/augment/StatusLine.qml b/src/widget/augment/StatusLine.qml new file mode 100644 index 0000000..56b0b31 --- /dev/null +++ b/src/widget/augment/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 + } + } +} -- cgit v1.2.3