forked from BlitzGLEP1326/vehicle-can-daq
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.qml
385 lines (348 loc) · 10.2 KB
/
main.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Extras 1.4
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "ColorFormatter.js" as CF
Window {
property int rpmValue
property int speedValue
property int fuelValue
property int coolantValue
property int oilValue
// Test fields for connectivity and values.
property string connStatus: "Not Connected"
property int frames: 0
property string canFilter: "No"
id: root
visible: true
width: 800
height: 480
title: "Linear Cluster"
color: "#000"
Item {
id: container
x: 0
y: 0
width: 800
height: Math.min(root.width, root.height)
visible: true
z: 0
rotation: 0
scale: 1
anchors.verticalCenterOffset: 0
anchors.horizontalCenterOffset: 0
anchors.centerIn: parent
Gauge {
id: tachGauge
x: -17
style: TachGaugeStyle {}
width: 833
height: 50
anchors.topMargin: 0
minimumValue: 0
maximumValue: 9000
tickmarkStepSize: 75
value: rpmValue
orientation: Qt.Horizontal
anchors.top: parent.top
}
Text {
id: txtRPM
x: 702
y: 78
width: 98
height: 46
color: CF.getTachColor(tachGauge.value)
text: Math.ceil(tachGauge.value) + '<font size="1"> RPM</font>'
styleColor: "#000"
style: Text.Normal
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignTop
font.pixelSize: 36
}
/****************** FUEL GAUGE ******************/
Gauge {
id: fuelGauge
x: 0
y: 441
width: 185
style: FuelGaugeStyle {}
height: 7
anchors.verticalCenterOffset: 220
minimumValue: 0
maximumValue: 100
tickmarkStepSize: 25
value: fuelValue
orientation: Qt.Horizontal
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
id: rectFuel
x: fuelGauge.x + 13
y: fuelGauge.y + 11
width: Math.ceil(fuelGauge.width) / 4 - 25
height: fuelGauge.height
color: "#ff311a" // red
}
Image {
id: imgFuel
x: fuelGauge.x + (width / 2)
y: fuelGauge.y - height - 4
width: 28
height: 25
source: "../images/fuel_icon.png"
}
Text {
id: txtFuel
x: 115
y: 424
width: 76
height: 32
color: fuelGauge.value <= 20 ? "#ff0000" : "#fff"
text: Math.ceil(fuelGauge.value) + '<font size="1">%</font>'
style: Text.Normal
verticalAlignment: Text.AlignTop
styleColor: "#000000"
horizontalAlignment: Text.AlignRight
font.pixelSize: 28
}
/****************** COOLANT TEMP GAUGE ******************/
Gauge {
id: coolantTempGauge
x: 607
y: 420
width: 185
style: CoolantTempGaugeStyle {}
height: 7
anchors.verticalCenterOffset: 153
minimumValue: 50
maximumValue: 140
tickmarkStepSize: (maximumValue - minimumValue) / 4
value: coolantValue
orientation: Qt.Horizontal
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
id: rectCoolantTempLow
x: coolantTempGauge.x + 13
y: coolantTempGauge.y + 11
width: Math.ceil(coolantTempGauge.width) / 4 - 25
height: coolantTempGauge.height
color: "#4286f4" // blue
}
Rectangle {
id: rectCoolantTempHigh
x: rectCoolantTempLow.x + coolantTempGauge.width - (width * 2) - 6
y: rectCoolantTempLow.y
width: Math.ceil(coolantTempGauge.width) / 4 - 25
height: coolantTempGauge.height
color: "#ff311a" // red
}
Image {
id: imgCoolantTemp
x: coolantTempGauge.x + (width / 2)
y: coolantTempGauge.y - height - 4
width: 28
height: 28
source: "../images/coolant_temp_icon.png"
}
Text {
id: txtCoolantTemp
x: 692
y: 357
width: 98
height: 46
color: CF.getCoolantTempColor(coolantTempGauge.value)
text: Math.ceil(coolantValue) + '<font size="1">C</font>'
horizontalAlignment: Text.AlignRight
style: Text.Normal
styleColor: "#000000"
font.pixelSize: 28
verticalAlignment: Text.AlignTop
}
/****************** OIL TEMP GAUGE ******************/
Gauge {
id: oilTempGauge
x: 605
y: 200
width: 185
style: OilTempGaugeStyle {}
height: 7
anchors.verticalCenterOffset: 220
minimumValue: 50
maximumValue: 150
tickmarkStepSize: (maximumValue - minimumValue) / 4
value: oilValue
orientation: Qt.Horizontal
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
id: rectOilTempLow
x: oilTempGauge.x + 13
y: oilTempGauge.y + 11
width: Math.ceil(oilTempGauge.width) / 4 - 25
height: oilTempGauge.height
color: "#4286f4" // blue
}
Rectangle {
id: rectOilTempHigh
x: rectOilTempLow.x + oilTempGauge.width - (width * 2) - 6
y: rectOilTempLow.y
width: Math.ceil(oilTempGauge.width) / 4 - 25
height: oilTempGauge.height
color: "#ff311a" // red
}
Image {
id: imgOilTemp
x: oilTempGauge.x + (width / 2)
y: oilTempGauge.y - height + 4
width: 28
height: 28
source: "../images/oil_temp_icon.png"
}
Text {
id: txtOilTemp
x: 692
y: 424
width: 98
height: 46
color: CF.getCoolantTempColor(oilTempGauge.value)
text: Math.ceil(oilValue) + '<font size="1">C</font>'
horizontalAlignment: Text.AlignRight
style: Text.Normal
styleColor: "#000000"
font.pixelSize: 28
verticalAlignment: Text.AlignTop
}
/****************** VEHICLE SPEED ******************/
Text {
id: txtSpeed
x: 324
y: 302
width: 149
height: 46
color: "#fff"
text: "<b>0</b>"
font.family: "Arial"
horizontalAlignment: Text.AlignRight
style: Text.Normal
styleColor: "#000000"
font.pixelSize: 52
verticalAlignment: Text.AlignTop
}
Text {
id: txtMph
x: 479
y: 302
width: 70
height: 57
color: "#ffffff"
text: qsTr("MPH")
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
font.pixelSize: 22
}
/****************** LAP TIMING ******************/
Text {
id: txtCurLap
x: 264
y: 223
width: 285
height: 58
color: "#fff"
text: "Current " + '<font size="4"> --:--.--</font>'
z: 1
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pixelSize: 36
}
Text {
id: txtBestLap
x: 324
y: 151
width: 166
height: 58
color: "#ffffff"
text: "Best <font size=\"4\"> --:--.--</font>"
z: 1
verticalAlignment: Text.AlignVCenter
font.pixelSize: 24
horizontalAlignment: Text.AlignLeft
}
Rectangle {
id: rectangle1
x: 247
y: 221
width: 345
height: 66
color: "#3e3e3e"
radius: 7
z: 0
}
Text {
id: txtCanFilter
x: 650
y: 186
width: 142
height: 23
text: qsTr("Filtering: " + canFilter)
color: (canFilter == "No") ? "red" : "green"
font.pixelSize: 12
}
Text {
id: txtConnStatus
x: 650
y: 157
width: 142
height: 23
text: qsTr("CAN bus: " + connStatus)
color: (connStatus == "Not Connected") ? "red" : "green"
font.pixelSize: 12
}
Text {
id: txtFrames
x: 650
y: 215
width: 142
height: 23
text: qsTr("Frames: " + frames)
color: (frames == 0) ? "red" : "green"
font.pixelSize: 12
}
/****************** GUI ELEMENTS ******************/
ComboBox {
id: cboTracks
objectName: "cboTracks"
x: 8
y: 365
width: 200
height: 30
style: ComboBoxStyle {
textColor: "#000000"
background: Rectangle {
color: "#000000"
border.width: 1
border.color: "#ffffff"
antialiasing: true
}
label: Label {
text: "Select Track..."
verticalAlignment: Text.AlignVCenter
font.pixelSize: 14
color: "#ffffff"
}
}
}
Text {
id: txtSelectedTrack
x: 8
y: 336
width: 142
height: 23
color: "#ffffff"
text: cboTracks.currentText
font.pixelSize: 12
}
}
}