aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-07-25 21:53:01 +0200
committerAdrian Kummerlaender2015-07-25 21:53:01 +0200
commit311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a (patch)
treeab5019fe014a2d6be67c5c443f6ea0be8b25acaf
parent1ed6dfcd2eb9878b2ad25c42358d9a21839a1951 (diff)
downloadMetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.tar
MetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.tar.gz
MetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.tar.bz2
MetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.tar.lz
MetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.tar.xz
MetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.tar.zst
MetaTerm-311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a.zip
Extracted highlighter rectangles into separate component
-rw-r--r--qml/EmbeddedTerminal.qml19
-rw-r--r--qml/Highlighter.qml24
-rw-r--r--qml/TerminalItem.qml17
-rw-r--r--qml/ui.qrc1
4 files changed, 29 insertions, 32 deletions
diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml
index 2e58fa9..aa22328 100644
--- a/qml/EmbeddedTerminal.qml
+++ b/qml/EmbeddedTerminal.qml
@@ -26,25 +26,11 @@ Item {
spacing: 0
- Rectangle {
+ Highlighter {
id: highlighter
width: item.frameWidth
Layout.fillHeight: true
-
- color: "#909636"
-
- Behavior on opacity {
- NumberAnimation {
- duration: 300
- easing.type: Easing.OutCubic
- }
- }
-
- function select() { opacity = 1 }
- function deselect() { opacity = 0 }
- function focus() { color = "#352F6A" }
- function unfocus() { color = "#909636" }
}
QMLTermWidget {
@@ -73,7 +59,7 @@ Item {
}
}
- onTermGetFocus: highlighter.focus()
+ onTermGetFocus: highlighter.focus()
onTermLostFocus: highlighter.unfocus()
MouseArea {
@@ -84,6 +70,7 @@ Item {
Component.onCompleted: {
forceActiveFocus();
+ highlighter.select();
session.startShellProgram();
}
}
diff --git a/qml/Highlighter.qml b/qml/Highlighter.qml
new file mode 100644
index 0000000..8d42054
--- /dev/null
+++ b/qml/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 = "#352F6A" }
+ function unfocus() { bar.color = "#909636" }
+
+ Rectangle {
+ id: bar
+
+ anchors.fill: parent
+
+ opacity: 0
+ color: "#909636"
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 300
+ easing.type: Easing.OutCubic
+ }
+ }
+ }
+}
diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml
index 26793da..48fb9f7 100644
--- a/qml/TerminalItem.qml
+++ b/qml/TerminalItem.qml
@@ -116,26 +116,11 @@ Item {
right: parent.right
}
- Rectangle {
+ Highlighter {
id: highlighter
width: 10
height: command.height
- opacity: 0
-
- color: "#909636"
-
- Behavior on opacity {
- NumberAnimation {
- duration: 300
- easing.type: Easing.OutCubic
- }
- }
-
- function select() { opacity = 1 }
- function deselect() { opacity = 0 }
- function focus() { color = "#352F6A" }
- function unfocus() { color = "#909636" }
}
TextInput {
diff --git a/qml/ui.qrc b/qml/ui.qrc
index 2705e7e..1bc4c62 100644
--- a/qml/ui.qrc
+++ b/qml/ui.qrc
@@ -4,5 +4,6 @@
<file>StateHandler.qml</file>
<file>TerminalItem.qml</file>
<file>EmbeddedTerminal.qml</file>
+ <file>Highlighter.qml</file>
</qresource>
</RCC>