Commit 5dffd405 authored by Rustom Jehangir's avatar Rustom Jehangir

Update Sub's safetyComponent to use new SetupPage structure.

parent 1386aaa0
...@@ -18,258 +18,249 @@ import QGroundControl.Palette 1.0 ...@@ -18,258 +18,249 @@ import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
QGCView { SetupPage {
id: _safetyView id: safetyPage
viewPanel: panel pageComponent: safetyPageComponent
anchors.fill: parent
FactPanelController { id: controller; factPanel: panel } Component {
id: safetyPageComponent
QGCPalette { id: ggcPal; colorGroupEnabled: enabled } Flow {
id: flowLayout
width: availableWidth
spacing: _margins
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") FactPanelController { id: controller; factPanel: safetyPage.viewPanel }
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
property Fact _failsafePressureValue: controller.getParameterFact(-1, "FS_PRESS_MAX")
property Fact _failsafeTempEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
property Fact _failsafeTempValue: controller.getParameterFact(-1, "FS_TEMP_MAX")
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") QGCPalette { id: ggcPal; colorGroupEnabled: true }
property Fact _fenceAltMax: controller.getParameterFact(-1, "FENCE_ALT_MAX")
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE")
property Fact _fenceMargin: controller.getParameterFact(-1, "FENCE_MARGIN")
property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE")
property Fact _leakPin: controller.getParameterFact(-1, "LEAK1_PIN") property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _leakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC") property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
property Fact _failsafePressureValue: controller.getParameterFact(-1, "FS_PRESS_MAX")
property Fact _failsafeTempEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
property Fact _failsafeTempValue: controller.getParameterFact(-1, "FS_TEMP_MAX")
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION")
property Fact _fenceAltMax: controller.getParameterFact(-1, "FENCE_ALT_MAX")
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE")
property Fact _fenceMargin: controller.getParameterFact(-1, "FENCE_MARGIN")
property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE")
property real _margins: ScreenTools.defaultFontPixelHeight property Fact _leakPin: controller.getParameterFact(-1, "LEAK1_PIN")
property bool _showIcon: !ScreenTools.isTinyScreen property Fact _leakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC")
ExclusiveGroup { id: fenceActionRadioGroup } property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
QGCViewPanel { property real _margins: ScreenTools.defaultFontPixelHeight
id: panel property bool _showIcon: !ScreenTools.isTinyScreen
anchors.fill: parent
QGCFlickable { ExclusiveGroup { id: fenceActionRadioGroup }
clip: true
anchors.fill: parent
contentHeight: flowLayout.height
contentWidth: flowLayout.width
Flow { Column {
id: flowLayout spacing: _margins / 2
width: panel.width // parent.width doesn't work for some reason
spacing: _margins
Column { QGCLabel {
spacing: _margins / 2 id: failsafeLabel
text: qsTr("Failsafe Actions")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
id: failsafeSettings
width: leakEnableCombo.x + leakEnableCombo.width + _margins
height: leakEnableCombo.y + leakEnableCombo.height + _margins
color: ggcPal.windowShade
QGCLabel { QGCLabel {
id: failsafeLabel id: gcsEnableLabel
text: qsTr("Failsafe Actions") anchors.margins: _margins
font.family: ScreenTools.demiboldFontFamily anchors.left: parent.left
anchors.baseline: gcsEnableCombo.baseline
text: qsTr("Ground Station failsafe:")
} }
Rectangle { FactComboBox {
id: failsafeSettings id: gcsEnableCombo
width: leakEnableCombo.x + leakEnableCombo.width + _margins anchors.margins: _margins
height: leakEnableCombo.y + leakEnableCombo.height + _margins anchors.left: gcsEnableLabel.right
color: ggcPal.windowShade anchors.top: parent.top
width: ScreenTools.defaultFontPixelWidth*15
QGCLabel { fact: _failsafeGCSEnable
id: gcsEnableLabel indexModel: false
anchors.margins: _margins }
anchors.left: parent.left
anchors.baseline: gcsEnableCombo.baseline
text: qsTr("Ground Station failsafe:")
}
FactComboBox {
id: gcsEnableCombo
anchors.margins: _margins
anchors.left: gcsEnableLabel.right
anchors.top: parent.top
width: ScreenTools.defaultFontPixelWidth*15
fact: _failsafeGCSEnable
indexModel: false
}
QGCLabel {
id: leakEnableLabel
anchors.margins: _margins
anchors.left: parent.left
anchors.baseline: leakEnableCombo.baseline
text: qsTr("Leak failsafe:")
}
FactComboBox {
id: leakEnableCombo
anchors.topMargin: _margins
anchors.left: gcsEnableCombo.left
anchors.top: gcsEnableCombo.bottom
width: ScreenTools.defaultFontPixelWidth*15
fact: _failsafeLeakEnable
indexModel: false
}
} // Rectangle - Failsafe Settings
} // Column - Failsafe Settings
Column {
spacing: _margins / 2
QGCLabel { QGCLabel {
id: geoFenceLabel id: leakEnableLabel
text: qsTr("GeoFence") anchors.margins: _margins
font.family: ScreenTools.demiboldFontFamily anchors.left: parent.left
anchors.baseline: leakEnableCombo.baseline
text: qsTr("Leak failsafe:")
} }
Rectangle { FactComboBox {
id: geoFenceSettings id: leakEnableCombo
width: fenceAltMaxField.x + fenceAltMaxField.width + _margins anchors.topMargin: _margins
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins anchors.left: gcsEnableCombo.left
color: ggcPal.windowShade anchors.top: gcsEnableCombo.bottom
width: ScreenTools.defaultFontPixelWidth*15
QGCCheckBox { fact: _failsafeLeakEnable
id: altitudeGeo indexModel: false
anchors.margins: _margins }
anchors.left: parent.left } // Rectangle - Failsafe Settings
anchors.top: parent.top } // Column - Failsafe Settings
text: qsTr("Depth GeoFence enabled\n(report only)")
checked: _fenceEnable.value != 0 && _fenceType.value & 1 Column {
spacing: _margins / 2
onClicked: {
if (checked) { QGCLabel {
if (_fenceEnable.value == 1) { id: geoFenceLabel
_fenceType.value |= 1 text: qsTr("GeoFence")
} else { font.family: ScreenTools.demiboldFontFamily
_fenceEnable.value = 1 }
_fenceType.value = 1
} Rectangle {
id: geoFenceSettings
width: fenceAltMaxField.x + fenceAltMaxField.width + _margins
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins
color: ggcPal.windowShade
QGCCheckBox {
id: altitudeGeo
anchors.margins: _margins
anchors.left: parent.left
anchors.top: parent.top
text: qsTr("Depth GeoFence enabled\n(report only)")
checked: _fenceEnable.value != 0 && _fenceType.value & 1
onClicked: {
if (checked) {
if (_fenceEnable.value == 1) {
_fenceType.value |= 1
} else { } else {
_fenceEnable.value = 0 _fenceEnable.value = 1
_fenceType.value = 0 _fenceType.value = 1
} }
} else {
_fenceEnable.value = 0
_fenceType.value = 0
} }
} }
}
QGCLabel {
id: fenceAltMaxLabel
anchors.left: altitudeGeo.left
anchors.baseline: fenceAltMaxField.baseline
text: qsTr("Max depth:")
}
FactTextField {
id: fenceAltMaxField
anchors.topMargin: _margins / 2
anchors.leftMargin: _margins
anchors.left: fenceAltMaxLabel.right
anchors.top: altitudeGeo.bottom
fact: _fenceAltMax
showUnits: true
}
} // Rectangle - GeoFence Settings
} // Column - GeoFence Settings
Column {
spacing: _margins / 2
QGCLabel { QGCLabel {
id: leakDetectorLabel id: fenceAltMaxLabel
text: qsTr("Leak detector") anchors.left: altitudeGeo.left
font.family: ScreenTools.demiboldFontFamily anchors.baseline: fenceAltMaxField.baseline
text: qsTr("Max depth:")
} }
Rectangle { FactTextField {
id: leakDetectorSettings id: fenceAltMaxField
width: leakLogicCombo.x + leakLogicCombo.width + _margins anchors.topMargin: _margins / 2
height: leakLogicCombo.y + leakLogicCombo.height + _margins anchors.leftMargin: _margins
color: ggcPal.windowShade anchors.left: fenceAltMaxLabel.right
anchors.top: altitudeGeo.bottom
fact: _fenceAltMax
showUnits: true
}
} // Rectangle - GeoFence Settings
} // Column - GeoFence Settings
QGCLabel { Column {
id: leakPinLabel spacing: _margins / 2
anchors.margins: _margins
anchors.left: parent.left
anchors.top: parent.top
text: qsTr("Pin:")
}
FactComboBox { QGCLabel {
id: leakPinCombo id: leakDetectorLabel
anchors.margins: _margins text: qsTr("Leak detector")
anchors.left: leakLogicLabel.right font.family: ScreenTools.demiboldFontFamily
anchors.baseline: leakPinLabel.baseline }
width: ScreenTools.defaultFontPixelWidth*15
fact: _leakPin
indexModel: false
}
QGCLabel { Rectangle {
id: leakLogicLabel id: leakDetectorSettings
anchors.margins: _margins width: leakLogicCombo.x + leakLogicCombo.width + _margins
anchors.left: parent.left height: leakLogicCombo.y + leakLogicCombo.height + _margins
anchors.top: leakPinLabel.bottom color: ggcPal.windowShade
text: qsTr("Logic:")
}
FactComboBox { QGCLabel {
id: leakLogicCombo id: leakPinLabel
anchors.margins: _margins anchors.margins: _margins
anchors.left: leakLogicLabel.right anchors.left: parent.left
anchors.baseline: leakLogicLabel.baseline anchors.top: parent.top
width: ScreenTools.defaultFontPixelWidth*15 text: qsTr("Pin:")
fact: _leakLogic }
indexModel: false
}
} // Rectangle - Leak Detector Settings
} // Column - Leak Detector Settings
Column { FactComboBox {
spacing: _margins / 2 id: leakPinCombo
anchors.margins: _margins
anchors.left: leakLogicLabel.right
anchors.baseline: leakPinLabel.baseline
width: ScreenTools.defaultFontPixelWidth*15
fact: _leakPin
indexModel: false
}
QGCLabel { QGCLabel {
text: qsTr("Arming Checks") id: leakLogicLabel
font.family: ScreenTools.demiboldFontFamily anchors.margins: _margins
anchors.left: parent.left
anchors.top: leakPinLabel.bottom
text: qsTr("Logic:")
} }
Rectangle { FactComboBox {
width: flowLayout.width id: leakLogicCombo
height: armingCheckInnerColumn.height + (_margins * 2) anchors.margins: _margins
color: ggcPal.windowShade anchors.left: leakLogicLabel.right
anchors.baseline: leakLogicLabel.baseline
Column { width: ScreenTools.defaultFontPixelWidth*15
id: armingCheckInnerColumn fact: _leakLogic
anchors.margins: _margins indexModel: false
anchors.top: parent.top }
} // Rectangle - Leak Detector Settings
} // Column - Leak Detector Settings
Column {
spacing: _margins / 2
QGCLabel {
text: qsTr("Arming Checks")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
width: flowLayout.width
height: armingCheckInnerColumn.height + (_margins * 2)
color: ggcPal.windowShade
Column {
id: armingCheckInnerColumn
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: _margins
FactBitmask {
id: armingCheckBitmask
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: _margins firstEntryIsAll: true
fact: _armingCheck
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
color: qgcPal.warningText color: qgcPal.warningText
text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.") text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.")
visible: _armingCheck.value != 1 visible: _armingCheck.value != 1
}
} }
} // Rectangle - Arming checks }
} // Column - Arming Checks } // Rectangle - Arming checks
} // Flow } // Column - Arming Checks
} // QGCFlickable } // Flow
} // QGCViewPanel } // Component - safetyPageComponent
} // QGCView } // SetupView
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