-
Notifications
You must be signed in to change notification settings - Fork 1
/
Terminal.qml
118 lines (103 loc) · 3.59 KB
/
Terminal.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
Copyright (C) 2012 Andrew Baldwin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import QtQuick 2.0
import "experimental" 1.0
import QtQuick.Particles 2.0
FocusScope {
BackBox {
id: bb
anchors.fill: parent
Process {
anchors.centerIn: parent
id:process
Component.onCompleted: {
process.cw=contentWidth;
process.ch=contentHeight;
launch("/bin/bash","-i");
size = Qt.size(80,23);
}
//onStderrChanged: { terminal.text+=stderr; }
onStdoutChanged: { text=stdout; }
focus: true
onFocusChanged: console.log("process focus",focus)
//size: Qt.size(30,80)
property real cw
property real ch
color: "white"
font.pixelSize: 38
font.weight: Font.Bold
font.family: "Courier"
textFormat: Text.PlainText
text: "."
onCursorChanged: {
stars.burst(5);
cursorRect.width = process.cw;
cursorRect.height = process.ch;
cursorRect.x = cursorRect.width*cursor.x;
cursorRect.y = cursorRect.height*cursor.y;
//console.log(cursor.x,cursor.y,size.width,size.height);
stars.burst(5);
}
//NumberAnimation on visible { from: -1; to: 2; duration: 5000; loops: -1 }
Text {
id: cursorpad
}
Rectangle {
id: cursorRect
color: Qt.rgba(1,0,0,0.5)
Behavior on x { SpringAnimation {spring: 4; damping: 0.2} }
Behavior on y { SpringAnimation {spring: 4; damping: 0.2 } }
}
ParticleSystem {
id: particles
}
ImageParticle {
id: star
system: particles
anchors.fill: parent
groups: ["A"]
source: "star.png"
colorVariation: 100
color: "#00111111"
}
Emitter {
id: stars
group: "A"
system: particles
anchors.fill: cursorRect
lifeSpan: 1000
velocity : PointDirection {yVariation: 100; xVariation: 100}
acceleration: PointDirection {xVariation: 100; yVariation: 100}
size: 10
sizeVariation: 8
endSize: 16
emitRate: 50
}
//Keys.onEscapePressed: { Qt.quit(); }
//Keys.onPressed: {
// process.writeEvent(event);
//process.writeString(event.text);
//console.log(event.key);
//}
//Keys.onReturnPressed: {
// process.writeChar(13);
//}
}
}
}