This repository has been archived by the owner on Aug 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TopDrawer.qml
executable file
·121 lines (101 loc) · 2.97 KB
/
TopDrawer.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
119
120
import QtQuick 2.3
import "StyleSheet.js" as Style
import "qrc:/Controls"
Rectangle {
id: theTopDrawer
color: Style.bgRed
clip: true
readonly property int iExpandedHeight: 160
readonly property int iClosedHeight: 70
width: 480 // Default
height: isExpanded ? iExpandedHeight : iClosedHeight
property bool isExpanded: false
Behavior on height {
PropertyAnimation { duration: 400; }
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 5
color: Style.accentColor
}
Image {
id: img_Expander
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.bottomMargin: 15
anchors.rightMargin: 15
width: 50
height: 50
source: "Images/Chevron Down-50.png"
rotation: isExpanded ? (flipMouse.pressed ? 0 : 180) : (flipMouse.pressed ? 180 : 0)
Behavior on rotation {
PropertyAnimation {}
}
MouseArea {
id: flipMouse
anchors.centerIn: parent
width: parent.width + 10
height: parent.width + 10
onClicked: {
theTopDrawer.isExpanded = !theTopDrawer.isExpanded
}
}
}
Label {
text: printer.curTemp.toFixed(2).replace(/\.?0+$/, "") + "/"
+ printer.targetTemp.toFixed(2).replace(/\.?0+$/, "") + "°C"
anchors.verticalCenter: img_Expander.verticalCenter
anchors.right: img_Expander.left
anchors.rightMargin: 15
}
Label {
text: printer.status
anchors.verticalCenter: img_Expander.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 15
}
Item {
// Hidden area
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: img_Expander.top
anchors.bottomMargin: 15
height: iExpandedHeight - iClosedHeight - 10 // -15+5
Button {
id: estpBtn
text: "Emergency Stop"
height: 50
width: 180
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 15
onClicked: {
printer.emergencyStop()
}
}
Button {
text: printer.paused ? "Resume" : "Pause"
height: 50
width: 120
anchors.verticalCenter: parent.verticalCenter
anchors.left: estpBtn.right
anchors.leftMargin: 15
onClicked: {
printer.pauseResume()
}
}
Button {
text: "Home"
height: 50
width: 100
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 15
onClicked: {
printer.homeAll()
}
}
}
}