APMSafetyComponentSub.qml 12.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/


import QtQuick              2.5
import QtQuick.Controls     1.2
import QtGraphicalEffects   1.0

import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0

QGCView {
    id:                 _safetyView
    viewPanel:          panel
    anchors.fill:       parent

    FactPanelController { id: controller; factPanel: panel }

    QGCPalette { id: ggcPal; colorGroupEnabled: enabled }

    property Fact _failsafeGCSEnable:   controller.getParameterFact(-1, "FS_GCS_ENABLE")
31 32 33 34 35
    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")
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

    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 Fact _leakPin:            controller.getParameterFact(-1, "WD_1_PIN")
    property Fact _leakLogic:          controller.getParameterFact(-1, "WD_1_DEFAULT")

    property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")

    property real _margins:     ScreenTools.defaultFontPixelHeight
    property bool _showIcon:    !ScreenTools.isTinyScreen

    ExclusiveGroup { id: fenceActionRadioGroup }

    QGCViewPanel {
        id:             panel
        anchors.fill:   parent

        QGCFlickable {
            clip:               true
            anchors.fill:       parent
            contentHeight:      flowLayout.height
            contentWidth:       flowLayout.width

            Flow {
                id:         flowLayout
                width:      panel.width // parent.width doesn't work for some reason
                spacing:    _margins

                Column {
                    spacing: _margins / 2

                    QGCLabel {
                        id:         failsafeLabel
73
                        text:       qsTr("Failsafe Actions")
74 75 76 77 78
                        font.family: ScreenTools.demiboldFontFamily
                    }

                    Rectangle {
                        id:     failsafeSettings
79 80
                        width:  leakEnableCombo.x + leakEnableCombo.width + _margins
                        height: leakEnableCombo.y + leakEnableCombo.height + _margins
81 82 83 84 85 86 87 88 89 90 91 92
                        color:  ggcPal.windowShade

                        QGCLabel {
                            id:                 gcsEnableLabel
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.baseline:   gcsEnableCombo.baseline
                            text:               qsTr("Ground Station failsafe:")
                        }

                        FactComboBox {
                            id:                 gcsEnableCombo
93
                            anchors.margins:    _margins
94 95
                            anchors.left:       gcsEnableLabel.right
                            anchors.top:        parent.top
96
                            width:              ScreenTools.defaultFontPixelWidth*15
97 98 99 100 101
                            fact:               _failsafeGCSEnable
                            indexModel:         false
                        }

                        QGCLabel {
102
                            id:                 leakEnableLabel
103 104
                            anchors.margins:    _margins
                            anchors.left:       parent.left
105 106
                            anchors.baseline:   leakEnableCombo.baseline
                            text:               qsTr("Leak failsafe:")
107 108
                        }

109 110
                        FactComboBox {
                            id:                 leakEnableCombo
111 112 113
                            anchors.topMargin:  _margins
                            anchors.left:       gcsEnableCombo.left
                            anchors.top:        gcsEnableCombo.bottom
114 115 116
                            width:              ScreenTools.defaultFontPixelWidth*15
                            fact:               _failsafeLeakEnable
                            indexModel:         false
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
                        }
                    } // Rectangle - Failsafe Settings
                } // Column - Failsafe Settings

                Column {
                    spacing: _margins / 2

                    QGCLabel {
                        id:             geoFenceLabel
                        text:           qsTr("GeoFence")
                        font.family:    ScreenTools.demiboldFontFamily
                    }

                    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
141
                            text:               qsTr("Depth GeoFence enabled\n(report only)")
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
                            checked:            _fenceEnable.value != 0 && _fenceType.value & 1

                            onClicked: {
                                if (checked) {
                                    if (_fenceEnable.value == 1) {
                                        _fenceType.value |= 1
                                    } else {
                                        _fenceEnable.value = 1
                                        _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
171
                            anchors.top:        altitudeGeo.bottom
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
                            fact:               _fenceAltMax
                            showUnits:          true
                        }
                    } // Rectangle - GeoFence Settings
                } // Column - GeoFence Settings

                Column {
                    spacing: _margins / 2

                    QGCLabel {
                        id:             leakDetectorLabel
                        text:           qsTr("Leak Detector")
                        font.family:    ScreenTools.demiboldFontFamily
                    }

                    Rectangle {
                        id:     leakDetectorSettings
                        width:  leakLogicCombo.x + leakLogicCombo.width + _margins
                        height: leakLogicCombo.y + leakLogicCombo.height + _margins
                        color:  ggcPal.windowShade

                        QGCLabel {
                            id:                 leakPinLabel
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.top:        parent.top
                            text:               qsTr("Pin:")
                        }

                        FactComboBox {
                            id:                 leakPinCombo
                            anchors.margins:    _margins
                            anchors.left:       leakLogicLabel.right
                            anchors.baseline:   leakPinLabel.baseline
206
                            width:              ScreenTools.defaultFontPixelWidth*15
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
                            fact:               _leakPin
                            indexModel:         false
                        }

                        QGCLabel {
                            id:                 leakLogicLabel
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.top:        leakPinLabel.bottom
                            text:               qsTr("Logic:")
                        }

                        FactComboBox {
                            id:                 leakLogicCombo
                            anchors.margins:    _margins
                            anchors.left:       leakLogicLabel.right
                            anchors.baseline:   leakLogicLabel.baseline
224
                            width:              ScreenTools.defaultFontPixelWidth*15
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
                            fact:               _leakLogic
                            indexModel:         false
                        }
                    } // 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.right:      parent.right
                                firstEntryIsAll:    true
                                fact:               _armingCheck
                            }

                            QGCLabel {
                                id:             armingCheckWarning
                                anchors.left:   parent.left
                                anchors.right:  parent.right
                                wrapMode:       Text.WordWrap
                                color:          qgcPal.warningText
                                text:            qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.")
                                visible:        _armingCheck.value != 1
                            }
                        }
                    } // Rectangle - Arming checks
                } // Column - Arming Checks
            } // Flow
        } // QGCFlickable
    } // QGCViewPanel
} // QGCView