-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHeader.qml
84 lines (72 loc) · 1.94 KB
/
Header.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
import QtQuick 2.5
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
ToolBar {
id: toolbar
anchors {
top: parent.top
right: parent.right
left: parent.left
}
height: imgServer.height + txtStatus.height + 40
z: 4
Material.primary: Material.background
state: "show"
Image {
id: imgServer
anchors {
top: parent.top
topMargin: 20
horizontalCenter: parent.horizontalCenter
}
fillMode: Image.PreserveAspectFit
source: "qrc:/img/img/server.png"
}
// Status text
Text {
id: txtStatus
anchors {
horizontalCenter: imgServer.horizontalCenter
top: imgServer.bottom
topMargin: 10
}
wrapMode: Text.WordWrap
text: server.listen ? qsTr("Listening on: %1. Online users: %2").arg(server.url).arg(userModel.count) : qsTr("Chocal Server is ready to start.")
}
// End status text
// Transitions
transitions: Transition {
// smoothly reanchor settings panel and move into new position
AnchorAnimation {
easing.type: Easing.OutExpo
duration: 600
}
}
// States
states: [
// For showing panel
State {
name: "show"
// Move panel down
AnchorChanges {
target: toolbar
anchors.top: parent.top
}
},
// For hiding panel
State {
name: "hide"
// move image up until status text
AnchorChanges {
target: imgServer
anchors.top: undefined
anchors.bottom: parent.top
}
// Make height of panel a little higher that status text height
PropertyChanges {
target: toolbar
height: txtStatus.height + 20
}
}
]
}