Skip to content

Commit 55a3289

Browse files
Add preparation panel
1 parent 7bb8a69 commit 55a3289

File tree

6 files changed

+160
-2
lines changed

6 files changed

+160
-2
lines changed

qml/ChecklistItem.qml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import QtQuick 2.6
2+
import QtQuick.Layouts 1.3
3+
import Industrial.Controls 1.0 as Controls
4+
import Industrial.Indicators 1.0 as Indicators
5+
6+
RowLayout {
7+
id: control
8+
9+
property bool active: true
10+
property bool inProcess: false
11+
property bool caution: false
12+
property bool failed: false
13+
14+
property alias text: label.text
15+
16+
Controls.Label {
17+
id: label
18+
font.weight: Font.Medium
19+
font.pixelSize: Controls.Theme.auxFontSize
20+
Layout.fillWidth: true
21+
color: active ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
22+
}
23+
24+
Controls.ColoredIcon {
25+
id: icon
26+
implicitWidth: Controls.Theme.baseSize * 0.8
27+
implicitHeight: implicitWidth
28+
color: {
29+
if (!active) return Indicators.Theme.disabledColor;
30+
if (inProcess) return Indicators.Theme.activeColor;
31+
if (failed) return Indicators.Theme.extremeRed;
32+
if (caution) return Indicators.Theme.moderateYellow;
33+
34+
return Indicators.Theme.normalGreen;
35+
}
36+
source: {
37+
if (!active) return "qrc:/icons/cancel.svg";
38+
if (inProcess) return "qrc:/icons/refresh.svg";
39+
if (failed) return "qrc:/icons/close.svg";
40+
if (caution) return "qrc:/icons/info.svg";
41+
42+
return "qrc:/icons/ok.svg";
43+
}
44+
45+
MouseArea {
46+
id: area
47+
anchors.fill: parent
48+
hoverEnabled: true
49+
}
50+
51+
Controls.ToolTip {
52+
id: toolTip
53+
visible: area.containsMouse
54+
text: {
55+
if (!active) return qsTr("Unactive");
56+
if (inProcess) return qsTr("In process");
57+
if (failed) return qsTr("Failed");
58+
if (caution) return qsTr("Caution");
59+
60+
return qsTr("Normal");
61+
}
62+
}
63+
}
64+
}

qml/GenericDashboard.qml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Column {
3030
Controls.Button {
3131
flat: true
3232
height: parent.height
33+
rightCropped: true
3334
enabled: typeof params.latitude !== "undefined" && typeof params.longitude !== "undefined"
3435
iconSource: controller.tracking ? "qrc:/icons/cancel_track.svg" : "qrc:/icons/track.svg"
3536
onClicked: controller.setTracking(!controller.tracking )
@@ -55,14 +56,27 @@ Column {
5556
Row {
5657
visible: maximized
5758

59+
Controls.Button {
60+
flat: true
61+
rightCropped: true
62+
iconSource: "qrc:/icons/calibrate.svg"
63+
highlighted: preflight.visible
64+
onClicked: preflight.visible ? preflight.close() : preflight.open()
65+
66+
Preflight {
67+
id: preflight
68+
closePolicy: Controls.Popup.CloseOnPressOutsideParent
69+
x: -width - Controls.Theme.margins - Controls.Theme.spacing
70+
}
71+
}
72+
5873
Indicators.Text {
5974
width: root.width / 2
6075
color: params.state ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
6176
text: qsTr("STATE") + ": " + (params.state ? params.state : "-")
6277
}
6378

6479
Indicators.Text {
65-
width: root.width / 2
6680
color: params.armed ? Indicators.Theme.textColor : Indicators.Theme.disabledColor
6781
text: params.armed ? qsTr("ARMED") : qsTr("DISARMED")
6882
}
@@ -216,7 +230,7 @@ Column {
216230
flat: true
217231
labelText: qsTr("WP")
218232
model: params.wpCount ? params.wpCount : 0
219-
displayText: params.wp ? params.wp : "-"
233+
displayText: typeof(params.wp) !== "undefined" ? params.wp : "-"
220234
Binding on currentIndex { value: params.wp ? params.wp : 0; when: !wpBox.activeFocus}
221235
onActivated: setParam("setWp", index)
222236
}

qml/Preflight.qml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import QtQuick 2.6
2+
import QtQuick.Layouts 1.3
3+
import Industrial.Controls 1.0 as Controls
4+
import Industrial.Indicators 1.0 as Indicators
5+
6+
Controls.Popup {
7+
id: root
8+
9+
property int fails: 0
10+
11+
ColumnLayout {
12+
spacing: 0
13+
14+
Repeater {
15+
model: [
16+
{ text: qsTr("AHRS"), reliable: params.ahrs },
17+
{ text: qsTr("SNS"), reliable: params.satellite },
18+
{ text: qsTr("Barometric"), reliable: params.barometric },
19+
{ text: qsTr("Pitot"), reliable: params.pitot },
20+
{ text: qsTr("Radalt"), reliable: params.radalt },
21+
{ text: qsTr("Battery"), reliable: params.battery },
22+
{ text: qsTr("Mission"), reliable: params.mission },
23+
{ text: qsTr("Arm ready"), reliable: params.armReady }
24+
]
25+
26+
delegate: ChecklistItem {
27+
text: modelData.text
28+
failed: !modelData.reliable
29+
active: typeof(params.online) !== "undefined" && params.online
30+
onFailedChanged: failed ? fails++ : fails --
31+
Layout.fillWidth: true
32+
}
33+
}
34+
35+
Item {
36+
Layout.minimumHeight: Controls.Theme.padding
37+
Layout.fillHeight: true
38+
}
39+
40+
Controls.DelayButton {
41+
flat: true
42+
text: params.armed ? qsTr("Disarm throttle"): qsTr("Arm throttle")
43+
onActivated: setParam("setArmed", !params.armed)
44+
Layout.fillWidth: true
45+
}
46+
}
47+
}

qml/draken_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
<qresource prefix="/Draken">
33
<file>VehiclesView.qml</file>
44
<file>GenericDashboard.qml</file>
5+
<file>Preflight.qml</file>
6+
<file>ChecklistItem.qml</file>
57
</qresource>
68
</RCC>

resources/calibrate.svg

Lines changed: 30 additions & 0 deletions
Loading

resources/draken_rsc.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<file>generic_aircraft.svg</file>
44
<file>track.svg</file>
55
<file>cancel_track.svg</file>
6+
<file>calibrate.svg</file>
67
</qresource>
78
</RCC>

0 commit comments

Comments
 (0)