-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStatusBar.qml
More file actions
232 lines (203 loc) · 6.92 KB
/
Copy pathStatusBar.qml
File metadata and controls
232 lines (203 loc) · 6.92 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
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
import QtQuick
import QtQuick.Controls
Item {
id: root
// ── Public API ──
property string currentTime: "14:32"
property real outdoorTemp: 18
property real rangeKm: 412
property string driveMode: "ECO"
property bool leftSignal: false
property bool rightSignal: false
property color borderAccent: "#262d3d"
// ── NEW: integrated controls ──
property bool useMph: false
property string currentTheme: "Carbon"
property var themeList: ["Carbon"]
property bool showStimulator: true
// ── NEW: signals out for Main to react to ──
signal toggleUnitsRequested()
signal themeSelected(string themeName)
signal toggleStimulatorRequested()
implicitWidth: 800
implicitHeight: 44
Rectangle {
anchors.fill: parent
radius: 8
color: "#10141f"
border.color: root.borderAccent
border.width: 1.5
Behavior on border.color { ColorAnimation { duration: 400 } }
}
readonly property color driveModeColor:
driveMode === "SPORT" ? "#ff5252"
: driveMode === "ECO" ? "#00c896"
: "#00ADEF"
// ── Left turn signal ──
Text {
id: leftArrow
anchors.left: parent.left
anchors.leftMargin: 14
anchors.verticalCenter: parent.verticalCenter
text: "◀"
font.pixelSize: 18
color: root.leftSignal ? "#00c896" : "#262d3d"
opacity: root.leftSignal ? blinker.flash : 1
}
// ── Time + temp + range (left side) ──
Row {
anchors.left: leftArrow.right
anchors.leftMargin: 22
anchors.verticalCenter: parent.verticalCenter
spacing: 22
Text {
text: root.currentTime
color: "#e8eaed"
font.family: "Bahnschrift"
font.pixelSize: 14
font.weight: Font.Medium
}
Text {
text: root.outdoorTemp.toFixed(0) + "°C"
color: "#8a92a8"
font.family: "Bahnschrift"
font.pixelSize: 12
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: "Range " + root.rangeKm + " km"
color: "#8a92a8"
font.family: "Bahnschrift"
font.pixelSize: 12
anchors.verticalCenter: parent.verticalCenter
}
}
// ── Center: drive mode ──
Text {
anchors.centerIn: parent
text: root.driveMode
color: root.driveModeColor
font.family: "Bahnschrift"
font.pixelSize: 13
font.weight: Font.Medium
font.letterSpacing: 2
}
// ── Integrated controls (right side, before turn signal) ──
Row {
anchors.right: rightArrow.left
anchors.rightMargin: 14
anchors.verticalCenter: parent.verticalCenter
spacing: 6
// Unit toggle
Text {
anchors.verticalCenter: parent.verticalCenter
text: root.useMph ? "mph" : "km/h"
color: "#8a92a8"
font.family: "Bahnschrift"
font.pixelSize: 11
font.weight: Font.Medium
font.letterSpacing: 1.0
MouseArea {
anchors.fill: parent
anchors.margins: -6 // larger click area
cursorShape: Qt.PointingHandCursor
onClicked: root.toggleUnitsRequested()
hoverEnabled: true
onEntered: parent.color = "#ffffff"
onExited: parent.color = "#8a92a8"
}
ToolTip.visible: false // simple hover handled above
}
// Vertical separator
Rectangle {
width: 1
height: 14
color: "#3a4254"
anchors.verticalCenter: parent.verticalCenter
}
// Theme picker (gear icon → opens menu)
Item {
width: 18
height: 18
anchors.verticalCenter: parent.verticalCenter
Text {
anchors.centerIn: parent
text: "⚙"
color: themeMouse.containsMouse ? "#ffffff" : "#8a92a8"
font.pixelSize: 14
Behavior on color { ColorAnimation { duration: 150 } }
}
MouseArea {
id: themeMouse
anchors.fill: parent
anchors.margins: -4
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: themeMenu.open()
}
Menu {
id: themeMenu
y: parent.height + 4
Repeater {
model: root.themeList
MenuItem {
text: modelData
onTriggered: root.themeSelected(modelData)
contentItem: Text {
text: modelData
color: modelData === root.currentTheme ? "#00ADEF" : "#e8eaed"
font.family: "Bahnschrift"
font.pixelSize: 11
}
}
}
}
}
// Vertical separator
Rectangle {
width: 1
height: 14
color: "#3a4254"
anchors.verticalCenter: parent.verticalCenter
}
// Demo mode toggle (small minus / hamburger)
Text {
anchors.verticalCenter: parent.verticalCenter
text: root.showStimulator ? "−" : "≡"
color: demoMouse.containsMouse ? "#ffffff" : "#8a92a8"
font.pixelSize: 14
font.weight: Font.Bold
Behavior on color { ColorAnimation { duration: 150 } }
MouseArea {
id: demoMouse
anchors.fill: parent
anchors.margins: -6
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: root.toggleStimulatorRequested()
}
}
}
// ── Right turn signal ──
Text {
id: rightArrow
anchors.right: parent.right
anchors.rightMargin: 14
anchors.verticalCenter: parent.verticalCenter
text: "▶"
font.pixelSize: 18
color: root.rightSignal ? "#00c896" : "#262d3d"
opacity: root.rightSignal ? blinker.flash : 1
}
// Blinker
Item {
id: blinker
property real flash: 1
SequentialAnimation on flash {
running: root.leftSignal || root.rightSignal
loops: Animation.Infinite
NumberAnimation { from: 1; to: 0.2; duration: 400 }
NumberAnimation { from: 0.2; to: 1; duration: 400 }
}
}
}