Commit 4adbf551 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Make arming check ui less confusing (#3646)

parent 81837240
......@@ -25,7 +25,7 @@ QGCView {
FactPanelController { id: controller; factPanel: panel }
QGCPalette { id: palette; colorGroupEnabled: enabled }
QGCPalette { id: ggcPal; colorGroupEnabled: enabled }
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE")
......@@ -83,7 +83,7 @@ QGCView {
id: failsafeSettings
width: throttleEnableCombo.x + throttleEnableCombo.width + _margins
height: mahField.y + mahField.height + _margins
color: palette.windowShade
color: ggcPal.windowShade
QGCLabel {
id: gcsEnableLabel
......@@ -217,7 +217,7 @@ QGCView {
id: geoFenceSettings
width: fenceAltMaxField.x + fenceAltMaxField.width + _margins
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins
color: palette.windowShade
color: ggcPal.windowShade
QGCCheckBox {
id: circleGeo
......@@ -341,7 +341,7 @@ QGCView {
id: rtlSettings
width: rltAltFinalField.x + rltAltFinalField.width + _margins
height: rltAltFinalField.y + rltAltFinalField.height + _margins
color: palette.windowShade
color: ggcPal.windowShade
Image {
id: icon
......@@ -360,7 +360,7 @@ QGCView {
ColorOverlay {
anchors.fill: icon
source: icon
color: palette.text
color: ggcPal.text
visible: _showIcon
}
......@@ -472,7 +472,7 @@ QGCView {
Rectangle {
width: flowLayout.width
height: armingCheckInnerColumn.height + (_margins * 2)
color: palette.windowShade
color: ggcPal.windowShade
Column {
id: armingCheckInnerColumn
......@@ -482,19 +482,22 @@ QGCView {
anchors.right: parent.right
spacing: _margins
FactBitmask {
id: armingCheckBitmask
anchors.left: parent.left
anchors.right: parent.right
firstEntryIsAll: true
fact: _armingCheck
}
QGCLabel {
id: armingCheckWarning
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("Turning off arming checks can lead to loss of Vehicle control.")
}
FactBitmask {
id: armingCheckBitmask
anchors.left: parent.left
anchors.right: parent.right
fact: _armingCheck
color: qgcPal.warningText
text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.")
visible: _armingCheck.value != 1
}
}
} // Rectangle - Arming checks
......
......@@ -9,19 +9,47 @@ import QGroundControl.ScreenTools 1.0
Flow {
spacing: ScreenTools.defaultFontPixelWidth
/// true: Checking the first entry will clear and disable all other entries
property bool firstEntryIsAll: false
property Fact fact: Fact { }
Component.onCompleted: {
if (firstEntryIsAll && repeater.itemAt(0).checked) {
for (var i=1; i<repeater.count; i++) {
var otherCheckbox = repeater.itemAt(i)
otherCheckbox.enabled = false
}
}
}
Repeater {
model: fact.bitmaskStrings
id: repeater
model: fact.bitmaskStrings
QGCCheckBox {
id: checkbox
text: modelData
checked: fact.value & fact.bitmaskValues[index]
onClicked: {
if (checked) {
if (firstEntryIsAll && index == 0) {
for (var i=1; i<repeater.count; i++) {
var otherCheckbox = repeater.itemAt(i)
fact.value &= ~fact.bitmaskValues[i]
otherCheckbox.checked = false
otherCheckbox.enabled = false
}
}
fact.value |= fact.bitmaskValues[index]
} else {
if (firstEntryIsAll && index == 0) {
for (var i=1; i<repeater.count; i++) {
var otherCheckbox = repeater.itemAt(i)
otherCheckbox.enabled = true
}
}
fact.value &= ~fact.bitmaskValues[index]
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment