aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-12-15 19:48:16 +0100
committerAdrian Kummerlaender2015-12-15 19:48:16 +0100
commit012d8f7503d9d49ff33da621aee5fabd252e57f5 (patch)
tree232dab8c038d554f55d8c58837e4ebe26208c343
parent1562641cc744ff9d6c0e0fd0ce1936010331000f (diff)
downloadMetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.tar
MetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.tar.gz
MetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.tar.bz2
MetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.tar.lz
MetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.tar.xz
MetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.tar.zst
MetaTerm-012d8f7503d9d49ff33da621aee5fabd252e57f5.zip
Extract terminal resize overlay into separate QML item
-rw-r--r--src/ui.qrc1
-rw-r--r--src/widget/EmbeddedTerminal.qml53
-rw-r--r--src/widget/Overlay.qml61
3 files changed, 66 insertions, 49 deletions
diff --git a/src/ui.qrc b/src/ui.qrc
index 05f9d79..31ec346 100644
--- a/src/ui.qrc
+++ b/src/ui.qrc
@@ -11,5 +11,6 @@
<file alias="StatusLine.qml">widget/StatusLine.qml</file>
<file alias="HistoryViewer.qml">widget/HistoryViewer.qml</file>
<file alias="Highlighter.qml">widget/Highlighter.qml</file>
+ <file alias="Overlay.qml">widget/Overlay.qml</file>
</qresource>
</RCC>
diff --git a/src/widget/EmbeddedTerminal.qml b/src/widget/EmbeddedTerminal.qml
index 23e545b..0a7a562 100644
--- a/src/widget/EmbeddedTerminal.qml
+++ b/src/widget/EmbeddedTerminal.qml
@@ -92,59 +92,14 @@ Item {
onHeightChanged: overlay.displayBriefly()
onWidthChanged: overlay.displayBriefly()
- Rectangle {
+ Overlay {
id: overlay
- property bool enabled : false
-
- function displayBriefly() {
- if ( enabled ) { animation.restart() }
- }
-
anchors.fill: parent
- opacity: 0
- color: settings.terminal.overlayBackground
-
- SequentialAnimation {
- id: animation
-
- ScriptAction {
- script: overlay.opacity = 0.8
- }
- PauseAnimation {
- duration: 500
- }
-
- NumberAnimation {
- target: overlay
- property: "opacity"
-
- easing.type: Easing.InSine
- duration: 300
- from: 0.8
- to: 0
- }
- }
-
- 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);
- }
- }
+ text: item.lines
+ + 'x'
+ + Math.floor(terminal.width / terminal.fontMetrics.width)
}
MouseArea {
diff --git a/src/widget/Overlay.qml b/src/widget/Overlay.qml
new file mode 100644
index 0000000..2a50219
--- /dev/null
+++ b/src/widget/Overlay.qml
@@ -0,0 +1,61 @@
+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
+ }
+ }
+}