-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathJadeDetailsDrawer.qml
149 lines (147 loc) · 5.61 KB
/
JadeDetailsDrawer.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import Blockstream.Green
import Blockstream.Green.Core
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "jade.js" as JadeJS
AbstractDrawer {
required property JadeDevice device
onClosed: self.destroy()
id: self
edge: Qt.RightEdge
contentItem: GStackView {
initialItem: StackViewPage {
title: self.device.name
rightItem: CloseButton {
onClicked: self.close()
}
contentItem: ColumnLayout {
spacing: 10
MultiImage {
Layout.alignment: Qt.AlignCenter
foreground: JadeJS.image(self.device, 0)
width: 352
height: 240
}
GridLayout {
rowSpacing: 10
columnSpacing: 20
columns: 2
Label {
Layout.minimumWidth: 100
color: '#929292'
font.pixelSize: 14
font.weight: 400
text: qsTrId('id_model')
}
Label {
Layout.fillWidth: true
horizontalAlignment: Label.AlignRight
text: {
const board_type = self.device.versionInfo.BOARD_TYPE
return board_type === 'JADE_V2' ? 'Jade Plus' : 'Jade Classic'
}
}
Label {
Layout.minimumWidth: 100
color: '#929292'
font.pixelSize: 14
font.weight: 400
text: qsTrId('id_firmware')
}
Label {
Layout.fillWidth: true
horizontalAlignment: Label.AlignRight
text: self.device.version
}
Label {
Layout.minimumWidth: 100
color: '#929292'
font.pixelSize: 14
font.weight: 400
text: qsTrId('Configuration')
}
Label {
Layout.fillWidth: true
horizontalAlignment: Label.AlignRight
text: {
switch (self.device.versionInfo.JADE_CONFIG.toLowerCase()) {
case 'noradio': return 'No-Radio'
case 'ble': return 'Bluetooth'
}
}
}
Label {
Layout.minimumWidth: 100
color: '#929292'
font.pixelSize: 14
font.weight: 400
text: qsTrId('Battery')
}
Pane {
Layout.alignment: Qt.AlignRight
padding: 3
background: Rectangle {
border.width: 1
border.color: '#FFF'
color: 'transparent'
radius: 5
}
contentItem: RowLayout {
spacing: 1
Repeater {
model: 5
delegate: Rectangle {
implicitWidth: 8
implicitHeight: 8
radius: 1
color: 'green'
opacity: 0.75
}
}
}
}
Label {
Layout.minimumWidth: 100
color: '#929292'
font.pixelSize: 14
font.weight: 400
text: qsTrId('id_system_location')
}
Label {
Layout.fillWidth: true
horizontalAlignment: Label.AlignRight
text: self.device.systemLocation
}
Label {
Layout.minimumWidth: 100
color: '#929292'
font.pixelSize: 14
font.weight: 400
text: qsTrId('id_stauts')
}
Label {
Layout.fillWidth: true
horizontalAlignment: Label.AlignRight
text: {
if (!self.device.connected) return 'Disconnected'
switch (self.device.status) {
case JadeDevice.StatusIdle: return 'Idle'
case JadeDevice.StatusHandleClientMessage: return 'Busy'
case JadeDevice.StatusHandleMenuNavigation: return 'Menu'
}
}
}
}
Label {
Layout.fillWidth: true
text: JSON.stringify(self.device.versionInfo, null, ' ')
visible: false
wrapMode: Label.WrapAnywhere
}
VSpacer {
}
}
}
}
}