FlightBrief.qml 12.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import QtQuick                  2.3
import QtQuick.Controls         1.2
import QtQuick.Controls.Styles  1.4
import QtQuick.Dialogs          1.2
import QtQml                    2.2

import QGroundControl                   1.0
import QGroundControl.Airmap            1.0
import QGroundControl.Airspace          1.0
import QGroundControl.Controls          1.0
import QGroundControl.Palette           1.0
import QGroundControl.ScreenTools       1.0
import QGroundControl.SettingsManager   1.0

Item {
    id:                 _root
    implicitHeight:     briefRootCol.height
    implicitWidth:      briefRootCol.width
19 20 21
    property real baseHeight:   ScreenTools.defaultFontPixelHeight * 22
    property real baseWidth:    ScreenTools.defaultFontPixelWidth  * 40
    signal closed()
22 23 24 25 26 27 28 29 30 31 32 33 34 35 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
    Column {
        id:             briefRootCol
        spacing:        ScreenTools.defaultFontPixelHeight * 0.25
        Rectangle {
            color:          qgcPal.windowShade
            anchors.right:  parent.right
            anchors.left:   parent.left
            height:         briefLabel.height + ScreenTools.defaultFontPixelHeight
            QGCLabel {
                id:             briefLabel
                text:           qsTr("Flight Brief")
                font.pointSize: ScreenTools.mediumFontPointSize
                font.family:    ScreenTools.demiboldFontFamily
                anchors.centerIn: parent
            }
        }
        Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.5; }
        Flickable {
            clip:           true
            width:          baseWidth
            height:         baseHeight - buttonRow.height - ScreenTools.defaultFontPixelHeight
            contentHeight:  briefCol.height
            flickableDirection: Flickable.VerticalFlick
            Column {
                id:                 briefCol
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                anchors.right:      parent.right
                anchors.left:       parent.left
                QGCLabel {
                    text:           qsTr("Authorizations")
                }
                Rectangle {
                    color:          qgcPal.windowShade
                    anchors.right:  parent.right
                    anchors.left:   parent.left
                    height:         authCol.height + ScreenTools.defaultFontPixelHeight
                    Column {
                        id:                 authCol
                        spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                        anchors.margins:    ScreenTools.defaultFontPixelWidth
                        anchors.right:      parent.right
                        anchors.left:       parent.left
                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
                        //-- Actual Authorization from some jurisdiction
                        Repeater {
                            visible:        QGroundControl.airspaceManager.flightPlan.authorizations.count > 0
                            model:          QGroundControl.airspaceManager.flightPlan.authorizations
                            Column {
                                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                                anchors.right:      parent.right
                                anchors.left:       parent.left
                                QGCLabel {
                                    text:           object.name
                                    font.family:    ScreenTools.demiboldFontFamily
                                    anchors.horizontalCenter: parent.horizontalCenter
                                }
                                Rectangle {
                                    anchors.right:      parent.right
                                    anchors.left:       parent.left
                                    height:             label.height + (ScreenTools.defaultFontPixelHeight * 0.5)
                                    color: {
                                        if(object.status === AirspaceFlightAuthorization.Pending)
                                            return _colorOrange
                                        if(object.status === AirspaceFlightAuthorization.Accepted || object.status === AirspaceFlightAuthorization.AcceptedOnSubmission)
                                            return _colorGreen
                                        if(object.status === AirspaceFlightAuthorization.Rejected || object.status === AirspaceFlightAuthorization.RejectedOnSubmission)
                                            return _colorRed
                                        return _colorGray
                                    }
                                    QGCLabel {
                                        id:     label
                                        color:  _colorWhite
                                        text: {
                                            if(object.status === AirspaceFlightAuthorization.Pending)
                                                return qsTr("Authorization Pending")
                                            if(object.status === AirspaceFlightAuthorization.Accepted || object.status === AirspaceFlightAuthorization.AcceptedOnSubmission)
                                                return qsTr("Authorization Accepted")
                                            if(object.status === AirspaceFlightAuthorization.Rejected || object.status === AirspaceFlightAuthorization.RejectedOnSubmission)
                                                return qsTr("Authorization Rejected")
                                            return qsTr("Authorization Unknown")
                                        }
                                        anchors.centerIn: parent
                                    }
                                }
                            }
107
                        }
Gus Grubba's avatar
Gus Grubba committed
108
                        //-- Implied Authorization from no jurisdiction
109 110 111
                        Rectangle {
                            anchors.right:      parent.right
                            anchors.left:       parent.left
Gus Grubba's avatar
Gus Grubba committed
112 113
                            height:             noAuthLabel.height + (ScreenTools.defaultFontPixelHeight * 0.5)
                            visible:            QGroundControl.airspaceManager.flightPlan.authorizations.count < 1
114
                            color: {
115
                                if(_flightPermit === AirspaceFlightPlanProvider.PermitPending)
116
                                    return _colorOrange
117
                                if(_flightPermit === AirspaceFlightPlanProvider.PermitAccepted || _flightPermit === AirspaceFlightPlanProvider.PermitNotRequired)
118
                                    return _colorGreen
119
                                if(_flightPermit === AirspaceFlightPlanProvider.PermitRejected)
120 121 122 123
                                    return _colorRed
                                return _colorGray
                            }
                            QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
124
                                id:     noAuthLabel
125 126 127 128 129 130 131 132
                                color:  _colorWhite
                                text: {
                                    if(_flightPermit === AirspaceFlightPlanProvider.PermitPending)
                                        return qsTr("Authorization Pending")
                                    if(_flightPermit === AirspaceFlightPlanProvider.PermitAccepted)
                                        return qsTr("Authorization Accepted")
                                    if(_flightPermit === AirspaceFlightPlanProvider.PermitRejected)
                                        return qsTr("Authorization Rejected")
133 134
                                    if(_flightPermit === AirspaceFlightPlanProvider.PermitNotRequired)
                                        return qsTr("Authorization Not Required")
135 136 137 138 139 140 141 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 171 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
                                    return qsTr("Authorization Unknown")
                                }
                                anchors.centerIn: parent
                            }
                        }
                    }
                }
                Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
                QGCLabel {
                    text:           qsTr("Rules & Compliance")
                    visible:        hasBriefRules()
                }
                ExclusiveGroup { id: ruleGroup }
                ComplianceRules {
                    text:           qsTr("Rules you may be violating")
                    rules:          violationRules
                    visible:        violationRules && violationRules.count
                    color:          _colorRed
                    exclusiveGroup: ruleGroup
                    anchors.right:  parent.right
                    anchors.left:   parent.left
                    property var violationRules: QGroundControl.airspaceManager.flightPlan.rulesViolation
                }
                ComplianceRules {
                    text:           qsTr("Rules needing more information")
                    rules:          infoRules
                    color:          _colorOrange
                    visible:        infoRules && infoRules.count
                    exclusiveGroup: ruleGroup
                    anchors.right:  parent.right
                    anchors.left:   parent.left
                    property var infoRules: QGroundControl.airspaceManager.flightPlan.rulesInfo
                }
                ComplianceRules {
                    text:           qsTr("Rules you should review")
                    rules:          reviewRules
                    color:          _colorYellow
                    visible:        reviewRules && reviewRules.count
                    exclusiveGroup: ruleGroup
                    anchors.right:  parent.right
                    anchors.left:   parent.left
                    property var reviewRules: QGroundControl.airspaceManager.flightPlan.rulesReview
                }
                ComplianceRules {
                    text:           qsTr("Rules you are following")
                    rules:          followRules
                    color:          _colorGreen
                    visible:        followRules && followRules.count
                    exclusiveGroup: ruleGroup
                    anchors.right:  parent.right
                    anchors.left:   parent.left
                    property var followRules: QGroundControl.airspaceManager.flightPlan.rulesFollowing
                }
            }
        }
        //-------------------------------------------------------------
        //-- File Flight Plan or Close
        Item { width: 1; height: ScreenTools.defaultFontPixelHeight; }
        Row {
            id:         buttonRow
            spacing: ScreenTools.defaultFontPixelWidth
            anchors.horizontalCenter: parent.horizontalCenter
            QGCButton {
                text:           qsTr("Update Plan")
                backRadius:     4
                heightFactor:   0.3333
                showBorder:     true
202
                enabled:        _flightPermit !== AirspaceFlightPlanProvider.PermitNone && QGroundControl.airspaceManager.flightPlan.dirty
203 204 205
                visible:        planView
                width:          ScreenTools.defaultFontPixelWidth * 12
                onClicked: {
206
                    QGroundControl.airspaceManager.flightPlan.updateFlightPlan()
207 208 209 210 211 212 213
                }
            }
            QGCButton {
                text:           qsTr("Submit Plan")
                backRadius:     4
                heightFactor:   0.3333
                showBorder:     true
214
                enabled:        _flightPermit === AirspaceFlightPlanProvider.PermitAccepted || _flightPermit === AirspaceFlightPlanProvider.PermitNotRequired
215 216 217
                width:          ScreenTools.defaultFontPixelWidth * 12
                visible:        planView
                onClicked: {
Gus Grubba's avatar
Gus Grubba committed
218
                    QGroundControl.airspaceManager.flightPlan.submitFlightPlan()
219
                    _root.closed()
220 221 222 223 224 225 226 227 228
                }
            }
            QGCButton {
                text:           qsTr("Close")
                backRadius:     4
                heightFactor:   0.3333
                showBorder:     true
                width:          ScreenTools.defaultFontPixelWidth * 12
                onClicked: {
229
                    _root.closed()
230 231 232 233 234
                }
            }
        }
    }
}