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 { ...@@ -25,7 +25,7 @@ QGCView {
FactPanelController { id: controller; factPanel: panel } 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 _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE") property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE")
...@@ -83,7 +83,7 @@ QGCView { ...@@ -83,7 +83,7 @@ QGCView {
id: failsafeSettings id: failsafeSettings
width: throttleEnableCombo.x + throttleEnableCombo.width + _margins width: throttleEnableCombo.x + throttleEnableCombo.width + _margins
height: mahField.y + mahField.height + _margins height: mahField.y + mahField.height + _margins
color: palette.windowShade color: ggcPal.windowShade
QGCLabel { QGCLabel {
id: gcsEnableLabel id: gcsEnableLabel
...@@ -217,7 +217,7 @@ QGCView { ...@@ -217,7 +217,7 @@ QGCView {
id: geoFenceSettings id: geoFenceSettings
width: fenceAltMaxField.x + fenceAltMaxField.width + _margins width: fenceAltMaxField.x + fenceAltMaxField.width + _margins
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins height: fenceAltMaxField.y + fenceAltMaxField.height + _margins
color: palette.windowShade color: ggcPal.windowShade
QGCCheckBox { QGCCheckBox {
id: circleGeo id: circleGeo
...@@ -341,7 +341,7 @@ QGCView { ...@@ -341,7 +341,7 @@ QGCView {
id: rtlSettings id: rtlSettings
width: rltAltFinalField.x + rltAltFinalField.width + _margins width: rltAltFinalField.x + rltAltFinalField.width + _margins
height: rltAltFinalField.y + rltAltFinalField.height + _margins height: rltAltFinalField.y + rltAltFinalField.height + _margins
color: palette.windowShade color: ggcPal.windowShade
Image { Image {
id: icon id: icon
...@@ -360,7 +360,7 @@ QGCView { ...@@ -360,7 +360,7 @@ QGCView {
ColorOverlay { ColorOverlay {
anchors.fill: icon anchors.fill: icon
source: icon source: icon
color: palette.text color: ggcPal.text
visible: _showIcon visible: _showIcon
} }
...@@ -472,7 +472,7 @@ QGCView { ...@@ -472,7 +472,7 @@ QGCView {
Rectangle { Rectangle {
width: flowLayout.width width: flowLayout.width
height: armingCheckInnerColumn.height + (_margins * 2) height: armingCheckInnerColumn.height + (_margins * 2)
color: palette.windowShade color: ggcPal.windowShade
Column { Column {
id: armingCheckInnerColumn id: armingCheckInnerColumn
...@@ -482,19 +482,22 @@ QGCView { ...@@ -482,19 +482,22 @@ QGCView {
anchors.right: parent.right anchors.right: parent.right
spacing: _margins spacing: _margins
FactBitmask {
id: armingCheckBitmask
anchors.left: parent.left
anchors.right: parent.right
firstEntryIsAll: true
fact: _armingCheck
}
QGCLabel { QGCLabel {
id: armingCheckWarning id: armingCheckWarning
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("Turning off arming checks can lead to loss of Vehicle control.") color: qgcPal.warningText
} text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.")
visible: _armingCheck.value != 1
FactBitmask {
id: armingCheckBitmask
anchors.left: parent.left
anchors.right: parent.right
fact: _armingCheck
} }
} }
} // Rectangle - Arming checks } // Rectangle - Arming checks
......
...@@ -9,19 +9,47 @@ import QGroundControl.ScreenTools 1.0 ...@@ -9,19 +9,47 @@ import QGroundControl.ScreenTools 1.0
Flow { Flow {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
/// true: Checking the first entry will clear and disable all other entries
property bool firstEntryIsAll: false
property Fact fact: Fact { } 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 { Repeater {
model: fact.bitmaskStrings id: repeater
model: fact.bitmaskStrings
QGCCheckBox { QGCCheckBox {
id: checkbox
text: modelData text: modelData
checked: fact.value & fact.bitmaskValues[index] checked: fact.value & fact.bitmaskValues[index]
onClicked: { onClicked: {
if (checked) { 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] fact.value |= fact.bitmaskValues[index]
} else { } 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] 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