-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTripDisplay.qml
More file actions
125 lines (109 loc) · 3.28 KB
/
Copy pathTripDisplay.qml
File metadata and controls
125 lines (109 loc) · 3.28 KB
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
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
// Trip computer display component
// Shows average speed, distance, and trip time
Rectangle {
id: root
width: 250
height: 180
color: "#2b2b2b"
border.color: "#4CAF50"
border.width: 2
radius: 10
required property double averageSpeed
required property double tripDistance
required property int tripTime
required property bool tripActive
ColumnLayout {
anchors.fill: parent
anchors.margins: 15
spacing: 10
Text {
text: "Trip Computer"
color: "#4CAF50"
font.pixelSize: 18
font.bold: true
Layout.alignment: Qt.AlignHCenter
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#4CAF50"
}
// Average Speed
Row {
Layout.fillWidth: true
spacing: 10
Text {
text: "Avg Speed:"
color: "white"
font.pixelSize: 14
width: 100
}
Text {
text: root.averageSpeed.toFixed(1) + " km/h"
color: root.tripActive ? "#4CAF50" : "#888"
font.pixelSize: 14
font.bold: true
}
}
// Trip Distance
Row {
Layout.fillWidth: true
spacing: 10
Text {
text: "Distance:"
color: "white"
font.pixelSize: 14
width: 100
}
Text {
text: root.tripDistance.toFixed(2) + " km"
color: root.tripActive ? "#4CAF50" : "#888"
font.pixelSize: 14
font.bold: true
}
}
// Trip Time
Row {
Layout.fillWidth: true
spacing: 10
Text {
text: "Time:"
color: "white"
font.pixelSize: 14
width: 100
}
Text {
function formatTime(seconds) {
var hours = Math.floor(seconds / 3600)
var minutes = Math.floor((seconds % 3600) / 60)
var secs = seconds % 60
return (hours < 10 ? "0" : "") + hours + ":" +
(minutes < 10 ? "0" : "") + minutes + ":" +
(secs < 10 ? "0" : "") + secs
}
text: formatTime(root.tripTime)
color: root.tripActive ? "#4CAF50" : "#888"
font.pixelSize: 14
font.bold: true
font.family: "Courier"
}
}
// Status indicator
Rectangle {
Layout.fillWidth: true
height: 25
color: root.tripActive ? "#4CAF50" : "#666"
radius: 5
Text {
anchors.centerIn: parent
text: root.tripActive ? "● ACTIVE" : "○ STOPPED"
color: "white"
font.pixelSize: 12
font.bold: true
}
}
}
}