FlightBrief.qml 9.5 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 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
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
    property real baseHeight:  ScreenTools.defaultFontPixelHeight * 22
    property real baseWidth:   ScreenTools.defaultFontPixelWidth  * 40
    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
                        QGCLabel {
65
                            text:           qsTr("No Authorization Required")
66
                            visible:        _flightPermit !== AirspaceFlightPlanProvider.PermitNone
67
                            anchors.horizontalCenter: parent.horizontalCenter
68
                        }
69
                        /*
70 71 72 73 74
                        QGCLabel {
                            text:           qsTr("Automatic authorization to fly in controlled airspace")
                            visible:        _flightPermit !== AirspaceFlightPlanProvider.PermitNone
                            font.pointSize: ScreenTools.smallFontPointSize
                        }
75
                        */
76 77 78 79 80
                        Rectangle {
                            anchors.right:      parent.right
                            anchors.left:       parent.left
                            height:             label.height + (ScreenTools.defaultFontPixelHeight * 0.5)
                            color: {
81
                                if(_flightPermit === AirspaceFlightPlanProvider.PermitPending)
82
                                    return _colorOrange
83
                                if(_flightPermit === AirspaceFlightPlanProvider.PermitAccepted)
84
                                    return _colorGreen
85
                                if(_flightPermit === AirspaceFlightPlanProvider.PermitRejected)
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 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
                                    return _colorRed
                                return _colorGray
                            }
                            QGCLabel {
                                id:     label
                                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")
                                    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
                enabled:        _flightPermit !== AirspaceFlightPlanProvider.PermitNone && _dirty
                visible:        planView
                width:          ScreenTools.defaultFontPixelWidth * 12
                onClicked: {
170
                    QGroundControl.airspaceManager.flightPlan.updateFlightPlan()
171 172 173 174 175 176 177
                }
            }
            QGCButton {
                text:           qsTr("Submit Plan")
                backRadius:     4
                heightFactor:   0.3333
                showBorder:     true
178
                enabled:        _flightPermit === AirspaceFlightPlanProvider.PermitAccepted
179 180 181
                width:          ScreenTools.defaultFontPixelWidth * 12
                visible:        planView
                onClicked: {
Gus Grubba's avatar
Gus Grubba committed
182
                    QGroundControl.airspaceManager.flightPlan.submitFlightPlan()
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
                    mainWindow.enableToolbar()
                    rootLoader.sourceComponent = null
                }
            }
            QGCButton {
                text:           qsTr("Close")
                backRadius:     4
                heightFactor:   0.3333
                showBorder:     true
                width:          ScreenTools.defaultFontPixelWidth * 12
                onClicked: {
                    mainWindow.enableToolbar()
                    rootLoader.sourceComponent = null
                }
            }
        }
    }
}