Skip to content

Commit 534ad1d

Browse files
Add gps status
1 parent 8fed5d0 commit 534ad1d

6 files changed

+475
-27
lines changed

qml/Coordinates.qml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import QtQuick 2.6
2+
import Industrial.Controls 1.0 as Controls
3+
import Industrial.Indicators 1.0 as Indicators
4+
5+
Item {
6+
id: root
7+
8+
property bool dms: true
9+
10+
implicitHeight: Controls.Theme.baseSize
11+
12+
Indicators.Text {
13+
anchors.top: parent.top
14+
width: parent.width
15+
horizontalAlignment: Text.AlignRight
16+
font.pixelSize: Indicators.Theme.auxFontSize
17+
color: params.latitude ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
18+
text: {
19+
var result = qsTr("Lat") + ":";
20+
21+
if (!params.latitude) {
22+
result += "-";
23+
}
24+
else {
25+
if (dms)
26+
result += Controls.Helper.degreesToDmsString(params.latitude, false, 2);
27+
else
28+
result += params.latitude.toFixed(7);
29+
}
30+
31+
return result;
32+
}
33+
}
34+
35+
Indicators.Text {
36+
anchors.bottom: parent.bottom
37+
width: parent.width
38+
horizontalAlignment: Text.AlignRight
39+
font.pixelSize: Indicators.Theme.auxFontSize
40+
color: params.longitude ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
41+
text: {
42+
var result = qsTr("Lon") + ":";
43+
44+
if (!params.longitude) {
45+
result += "-";
46+
}
47+
else {
48+
if (dms)
49+
result += Controls.Helper.degreesToDmsString(params.longitude, true, 2);
50+
else
51+
result += params.longitude.toFixed(7);
52+
}
53+
54+
return result;
55+
}
56+
}
57+
}
58+

qml/GenericDashboard.qml

+58-25
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,47 @@ Column {
6363
Row {
6464
visible: maximized
6565

66-
Controls.Button {
67-
flat: true
68-
height: parent.height
69-
rightCropped: true
70-
enabled: typeof params.latitude !== "undefined" && typeof params.longitude !== "undefined"
71-
iconSource: controller.tracking ? "qrc:/icons/cancel_track.svg" : "qrc:/icons/track.svg"
72-
tipText: controller.tracking ? qsTr("Cancel track") : qsTr("Track")
73-
onClicked: controller.setTracking(!controller.tracking )
66+
Controls.ColoredIcon {
67+
id: snsIcon
68+
color: {
69+
if (typeof params.gpsFix === "undefined")
70+
return Indicators.Theme.disabledColor;
71+
72+
switch (params.gpsFix) {
73+
case -1:
74+
case 0: return Indicators.Theme.extremeRed;
75+
case 1: return Indicators.Theme.severeOrange;
76+
case 2: return Indicators.Theme.moderateYellow;
77+
case 3:
78+
default: return Indicators.Theme.textColor;
79+
}
80+
}
81+
source: "qrc:/icons/gps.svg"
82+
height: Controls.Theme.baseSize
83+
width: height
84+
85+
Text {
86+
text: guardNaN(params.satellitesVisible)
87+
font.pixelSize: parent.height / 4
88+
font.bold: true
89+
anchors.bottom: parent.bottom
90+
anchors.right: parent.right
91+
color: parent.color
92+
}
7493
}
7594

76-
Column {
77-
Indicators.Text {
78-
color: params.latitude ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
79-
text: qsTr("Lat") + ":\t" +
80-
(params.latitude ? Controls.Helper.degreesToDmsString(params.latitude, false, 2)
81-
: "-")
82-
}
95+
Coordinates {
96+
id: coordinates
97+
width: root.width - snsIcon.width - switchButton.width
98+
}
8399

84-
Indicators.Text {
85-
color: params.longitude ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
86-
text: qsTr("Lon") + ":\t" +
87-
(params.longitude ? Controls.Helper.degreesToDmsString(params.longitude, true, 2)
88-
: "-")
89-
}
100+
Controls.Button {
101+
id: switchButton
102+
flat: true
103+
leftCropped: true
104+
iconSource: "qrc:/icons/swap.svg"
105+
tipText: qsTr("Switch coordinates presentation")
106+
onClicked: coordinates.dms = !coordinates.dms
90107
}
91108
}
92109

@@ -112,7 +129,11 @@ Column {
112129
value: guardNaN(params.ias)
113130
}
114131

115-
Indicators.Text { width: parent.width; text: qsTr("m/s") }
132+
Indicators.Text {
133+
width: parent.width
134+
font.pixelSize: Indicators.Theme.auxFontSize
135+
text: qsTr("m/s")
136+
}
116137
}
117138

118139
Indicators.AttitudeIndicator {
@@ -162,7 +183,11 @@ Column {
162183
value: guardNaN(params.altitudeRelative)
163184
}
164185

165-
Indicators.Text { width: parent.width; text: qsTr("m") }
186+
Indicators.Text {
187+
width: parent.width
188+
font.pixelSize: Indicators.Theme.auxFontSize
189+
text: qsTr("m")
190+
}
166191
}
167192
}
168193

@@ -188,7 +213,11 @@ Column {
188213
value: compas.course
189214
}
190215

191-
Indicators.Text { width: parent.width; text: "\u00B0" }
216+
Indicators.Text {
217+
width: parent.width
218+
font.pixelSize: Indicators.Theme.auxFontSize
219+
text: "\u00B0"
220+
}
192221
}
193222

194223
Indicators.Compass {
@@ -222,7 +251,11 @@ Column {
222251
value: guardNaN(params.homeDistance)
223252
}
224253

225-
Indicators.Text { width: parent.width; text: qsTr("m") }
254+
Indicators.Text {
255+
width: parent.width
256+
font.pixelSize: Indicators.Theme.auxFontSize
257+
text: qsTr("m")
258+
}
226259
}
227260
}
228261

qml/VehiclesView.qml

+14-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ Controls.Pane {
2020
spacing: Controls.Theme.spacing
2121

2222
RowLayout {
23-
spacing: Controls.Theme.spacing
23+
spacing: 0
24+
25+
Controls.Button {
26+
id: trackButton
27+
enabled: vehiclesBox.displayText.length
28+
flat: true
29+
rightCropped: true
30+
iconSource: controller.tracking ? "qrc:/icons/cancel_track.svg" : "qrc:/icons/track.svg"
31+
tipText: controller.tracking ? qsTr("Cancel track") : qsTr("Track")
32+
onClicked: controller.setTracking(!controller.tracking )
33+
Layout.fillHeight: true
34+
}
2435

2536
Controls.ComboBox {
2637
id: vehiclesBox
@@ -33,10 +44,11 @@ Controls.Pane {
3344

3445
Controls.Button {
3546
flat: true
36-
round: true
47+
leftCropped: true
3748
tipText: maximized ? qsTr("Minimize") : qsTr("Maximize")
3849
iconSource: maximized ? "qrc:/icons/up.svg" : "qrc:/icons/down.svg"
3950
onClicked: maximized = !maximized
51+
Layout.fillHeight: true
4052
}
4153
}
4254

qml/draken_qml.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<file>GenericDashboard.qml</file>
55
<file>Preflight.qml</file>
66
<file>ChecklistItem.qml</file>
7+
<file>Coordinates.qml</file>
78
</qresource>
89
</RCC>

resources/draken_rsc.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<file>track.svg</file>
55
<file>cancel_track.svg</file>
66
<file>calibrate.svg</file>
7+
<file>gps.svg</file>
78
</qresource>
89
</RCC>

0 commit comments

Comments
 (0)