AirspaceControl.qml 29.6 KB
Newer Older
1 2 3 4
import QtQuick                  2.11
import QtQuick.Controls         2.4
import QtQuick.Layouts          1.11
import QtQuick.Dialogs          1.3
Gus Grubba's avatar
Gus Grubba committed
5 6
import QtQuick.Controls.Styles  1.4
import QtQml                    2.2
7
import QtGraphicalEffects       1.0
Gus Grubba's avatar
Gus Grubba committed
8 9

import QGroundControl               1.0
10 11
import QGroundControl.Airmap        1.0
import QGroundControl.Airspace      1.0
Gus Grubba's avatar
Gus Grubba committed
12 13 14
import QGroundControl.Controls      1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0
15 16
import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
Gus Grubba's avatar
Gus Grubba committed
17 18 19 20

Item {
    id:     _root
    width:  parent.width
Gus Grubba's avatar
Gus Grubba committed
21
    height: _colapsed ? colapsedRect.height : expandedRect.height
Gus Grubba's avatar
Gus Grubba committed
22

Gus Grubba's avatar
Gus Grubba committed
23
    property bool   showColapse:        true
24
    property bool   planView:           false
Gus Grubba's avatar
Gus Grubba committed
25

26
    property color  _airspaceColor:     _validAdvisories ? getAispaceColor(QGroundControl.airspaceManager.advisories.airspaceColor) : _colorGray
Gus Grubba's avatar
Gus Grubba committed
27 28
    property bool   _validRules:        QGroundControl.airspaceManager.connected && QGroundControl.airspaceManager.ruleSets.valid
    property bool   _validAdvisories:   QGroundControl.airspaceManager.connected && QGroundControl.airspaceManager.advisories.valid
29
    property color  _textColor:         qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
30 31
    property bool   _colapsed:          !QGroundControl.airspaceManager.airspaceVisible || !QGroundControl.airspaceManager.connected
    property int    _flightPermit:      QGroundControl.airspaceManager.flightPlan.flightPermitStatus
Gus Grubba's avatar
Gus Grubba committed
32 33 34 35 36 37

    readonly property real      _radius:            ScreenTools.defaultFontPixelWidth * 0.5
    readonly property color     _colorOrange:       "#d75e0d"
    readonly property color     _colorBrown:        "#3c2b24"
    readonly property color     _colorLightBrown:   "#5a4e49"
    readonly property color     _colorGray:         "#615c61"
38
    readonly property color     _colorLightGray:    "#a0a0a0"
Gus Grubba's avatar
Gus Grubba committed
39 40 41
    readonly property color     _colorMidBrown:     "#3a322f"
    readonly property color     _colorYellow:       "#d7c61d"
    readonly property color     _colorWhite:        "#ffffff"
Gus Grubba's avatar
Gus Grubba committed
42 43
    readonly property color     _colorRed:          "#aa1200"
    readonly property color     _colorGreen:        "#125f00"
44 45
    readonly property real      _baseHeight:        ScreenTools.defaultFontPixelHeight * 22
    readonly property real      _baseWidth:         ScreenTools.defaultFontPixelWidth  * 40
Gus Grubba's avatar
Gus Grubba committed
46 47 48 49 50 51

    QGCPalette {
        id: qgcPal
        colorGroupEnabled: enabled
    }

Gus Grubba's avatar
Gus Grubba committed
52 53 54 55 56 57 58 59
    function getAispaceColor(color) {
        if(color === AirspaceAdvisoryProvider.Green)  return _colorGreen;
        if(color === AirspaceAdvisoryProvider.Yellow) return _colorYellow;
        if(color === AirspaceAdvisoryProvider.Orange) return _colorOrange;
        if(color === AirspaceAdvisoryProvider.Red)    return _colorRed;
        return _colorGray;
    }

60 61 62 63 64 65 66 67 68 69 70 71
    function hasBriefRules() {
        if(QGroundControl.airspaceManager.flightPlan.rulesViolation.count > 0)
            return true;
        if(QGroundControl.airspaceManager.flightPlan.rulesInfo.count > 0)
            return true;
        if(QGroundControl.airspaceManager.flightPlan.rulesReview.count > 0)
            return true;
        if(QGroundControl.airspaceManager.flightPlan.rulesFollowing.count > 0)
            return true;
        return false;
    }

72 73
    on_AirspaceColorChanged: {
       if(_validAdvisories) {
74
           if(QGroundControl.airspaceManager.advisories.airspaceColor === AirspaceAdvisoryProvider.Yellow) {
75 76 77 78 79 80 81
               _textColor = "#000000"
               return
           }
       }
       _textColor = _colorWhite
    }

Gus Grubba's avatar
Gus Grubba committed
82 83 84 85 86
    //---------------------------------------------------------------
    //-- Colapsed State
    Rectangle {
        id:         colapsedRect
        width:      parent.width
Gus Grubba's avatar
Gus Grubba committed
87
        height:     _colapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0
Gus Grubba's avatar
Gus Grubba committed
88
        color:      QGroundControl.airspaceManager.connected ? (_validAdvisories ? getAispaceColor(QGroundControl.airspaceManager.advisories.airspaceColor) : _colorGray) : _colorGray
Gus Grubba's avatar
Gus Grubba committed
89
        radius:     _radius
Gus Grubba's avatar
Gus Grubba committed
90
        visible:    _colapsed
Gus Grubba's avatar
Gus Grubba committed
91 92 93 94 95 96 97 98 99 100
        Row {
            id:                     colapsedRow
            spacing:                ScreenTools.defaultFontPixelWidth
            anchors.left:           parent.left
            anchors.leftMargin:     ScreenTools.defaultFontPixelWidth
            anchors.verticalCenter: parent.verticalCenter
            QGCColoredImage {
                width:                  height
                height:                 ScreenTools.defaultFontPixelWidth * 2.5
                sourceSize.height:      height
101 102
                source:                 "qrc:/airmap/advisory-icon.svg"
                color:                  _textColor
Gus Grubba's avatar
Gus Grubba committed
103 104
                anchors.verticalCenter: parent.verticalCenter
            }
105 106
            Column {
                spacing:                0
Gus Grubba's avatar
Gus Grubba committed
107
                anchors.verticalCenter: parent.verticalCenter
108 109 110 111 112 113 114 115 116 117
                QGCLabel {
                    text:               qsTr("Airspace")
                    color:              _textColor
                }
                QGCLabel {
                    text:               _validAdvisories ? QGroundControl.airspaceManager.advisories.advisories.count + qsTr(" Advisories") : ""
                    color:              _textColor
                    visible:            _validAdvisories
                    font.pointSize:     ScreenTools.smallFontPointSize
                }
Gus Grubba's avatar
Gus Grubba committed
118
            }
Gus Grubba's avatar
Gus Grubba committed
119 120 121 122 123
            Item {
                width:  ScreenTools.defaultFontPixelWidth
                height: 1
            }
            AirspaceWeather {
124
                iconHeight:             ScreenTools.defaultFontPixelHeight * 2
Gus Grubba's avatar
Gus Grubba committed
125
                visible:                QGroundControl.airspaceManager.weatherInfo.valid && QGroundControl.airspaceManager.connected
126
                contentColor:           _textColor
Gus Grubba's avatar
Gus Grubba committed
127 128
                anchors.verticalCenter: parent.verticalCenter
            }
Gus Grubba's avatar
Gus Grubba committed
129 130 131 132 133 134
            QGCLabel {
                text:                   qsTr("Not Connected")
                color:                  qgcPal.text
                visible:                !QGroundControl.airspaceManager.connected
                anchors.verticalCenter: parent.verticalCenter
            }
Gus Grubba's avatar
Gus Grubba committed
135
        }
Gus Grubba's avatar
Gus Grubba committed
136 137 138 139 140
        QGCColoredImage {
            width:                  height
            height:                 ScreenTools.defaultFontPixelWidth * 2.5
            sourceSize.height:      height
            source:                 "qrc:/airmap/expand.svg"
141
            color:                  _textColor
142
            fillMode:               Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
143
            visible:                QGroundControl.airspaceManager.connected
Gus Grubba's avatar
Gus Grubba committed
144 145 146 147
            anchors.right:          parent.right
            anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
            anchors.verticalCenter: parent.verticalCenter
        }
Gus Grubba's avatar
Gus Grubba committed
148
        MouseArea {
Gus Grubba's avatar
Gus Grubba committed
149 150
            anchors.fill:           parent
            enabled:                QGroundControl.airspaceManager.connected
Gus Grubba's avatar
Gus Grubba committed
151
            onClicked:  {
152
                QGroundControl.airspaceManager.airspaceVisible = true
Gus Grubba's avatar
Gus Grubba committed
153
            }
Gus Grubba's avatar
Gus Grubba committed
154 155 156 157 158 159 160
        }
    }
    //---------------------------------------------------------------
    //-- Expanded State
    Rectangle {
        id:         expandedRect
        width:      parent.width
Gus Grubba's avatar
Gus Grubba committed
161
        height:     !_colapsed ? expandedCol.height + ScreenTools.defaultFontPixelHeight : 0
162
        color:      _validAdvisories ? getAispaceColor(QGroundControl.airspaceManager.advisories.airspaceColor) : _colorGray
Gus Grubba's avatar
Gus Grubba committed
163
        radius:     _radius
Gus Grubba's avatar
Gus Grubba committed
164
        visible:    !_colapsed
Gus Grubba's avatar
Gus Grubba committed
165 166 167 168 169 170
        MouseArea {
            anchors.fill:   parent
            onWheel:        { wheel.accepted = true; }
            onPressed:      { mouse.accepted = true; }
            onReleased:     { mouse.accepted = true; }
        }
Gus Grubba's avatar
Gus Grubba committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
        Column {
            id:                     expandedCol
            spacing:                ScreenTools.defaultFontPixelHeight * 0.5
            anchors.left:           parent.left
            anchors.right:          parent.right
            anchors.verticalCenter: parent.verticalCenter
            //-- Header
            Item {
                height:             expandedRow.height
                anchors.left:       parent.left
                anchors.right:      parent.right
                Row {
                    id:                         expandedRow
                    spacing:                    ScreenTools.defaultFontPixelWidth
                    anchors.left:               parent.left
                    anchors.leftMargin:         ScreenTools.defaultFontPixelWidth
                    QGCColoredImage {
                        width:                  height
                        height:                 ScreenTools.defaultFontPixelWidth * 2.5
                        sourceSize.height:      height
                        source:                 "qrc:/airmap/advisory-icon.svg"
192
                        color:                  _textColor
193
                        fillMode:               Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
194 195 196 197 198 199 200
                        anchors.verticalCenter: parent.verticalCenter
                    }
                    Column {
                        spacing:                0
                        anchors.verticalCenter: parent.verticalCenter
                        QGCLabel {
                            text:               qsTr("Airspace")
201
                            color:              _textColor
Gus Grubba's avatar
Gus Grubba committed
202 203
                        }
                        QGCLabel {
204
                            text:               _validAdvisories ? QGroundControl.airspaceManager.advisories.advisories.count + qsTr(" Advisories") : ""
205 206
                            color:              _textColor
                            visible:            _validAdvisories
Gus Grubba's avatar
Gus Grubba committed
207 208 209
                            font.pointSize:     ScreenTools.smallFontPointSize
                        }
                    }
Gus Grubba's avatar
Gus Grubba committed
210 211 212 213 214
                    Item {
                        width:  ScreenTools.defaultFontPixelWidth
                        height: 1
                    }
                    AirspaceWeather {
215
                        visible:                QGroundControl.airspaceManager.weatherInfo.valid && showColapse
216
                        contentColor:           _textColor
Gus Grubba's avatar
Gus Grubba committed
217 218
                        anchors.verticalCenter: parent.verticalCenter
                    }
Gus Grubba's avatar
Gus Grubba committed
219
                }
Gus Grubba's avatar
Gus Grubba committed
220 221 222 223 224
                QGCColoredImage {
                    width:                  height
                    height:                 ScreenTools.defaultFontPixelWidth * 2.5
                    sourceSize.height:      height
                    source:                 "qrc:/airmap/colapse.svg"
225
                    color:                  _textColor
Gus Grubba's avatar
Gus Grubba committed
226
                    visible:                showColapse
227
                    fillMode:               Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
228 229 230 231 232
                    anchors.right:          parent.right
                    anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
                    anchors.verticalCenter: parent.verticalCenter
                    MouseArea {
                        anchors.fill:   parent
233 234
                        enabled:        showColapse
                        onClicked:      QGroundControl.airspaceManager.airspaceVisible = false
Gus Grubba's avatar
Gus Grubba committed
235 236
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
237
                AirspaceWeather {
238
                    visible:                QGroundControl.airspaceManager.weatherInfo.valid && !showColapse
239
                    contentColor:           _textColor
Gus Grubba's avatar
Gus Grubba committed
240 241 242 243
                    anchors.right:          parent.right
                    anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
                    anchors.verticalCenter: parent.verticalCenter
                }
Gus Grubba's avatar
Gus Grubba committed
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
            }
            //-- Contents (Brown Box)
            Rectangle {
                color:                      _colorBrown
                height:                     airspaceCol.height + ScreenTools.defaultFontPixelHeight
                radius:                     _radius
                anchors.left:               parent.left
                anchors.leftMargin:         ScreenTools.defaultFontPixelWidth * 0.5
                anchors.right:              parent.right
                anchors.rightMargin:        ScreenTools.defaultFontPixelWidth * 0.5
                Column {
                    id:                     airspaceCol
                    spacing:                ScreenTools.defaultFontPixelHeight * 0.5
                    anchors.left:           parent.left
                    anchors.leftMargin:     ScreenTools.defaultFontPixelWidth  * 0.5
                    anchors.right:          parent.right
                    anchors.rightMargin:    ScreenTools.defaultFontPixelWidth  * 0.5
                    anchors.verticalCenter: parent.verticalCenter
                    //-- Regulations
                    Rectangle {
                        color:                          _colorLightBrown
                        height:                         regCol.height + ScreenTools.defaultFontPixelHeight
                        radius:                         _radius
                        anchors.left:                   parent.left
                        anchors.leftMargin:             ScreenTools.defaultFontPixelWidth * 0.5
                        anchors.right:                  parent.right
                        anchors.rightMargin:            ScreenTools.defaultFontPixelWidth * 0.5
                        Column {
                            id:                         regCol
273
                            spacing:                    ScreenTools.defaultFontPixelHeight * 0.25
Gus Grubba's avatar
Gus Grubba committed
274 275 276 277 278 279 280 281 282 283 284
                            anchors.left:               parent.left
                            anchors.leftMargin:         ScreenTools.defaultFontPixelWidth  * 0.5
                            anchors.right:              parent.right
                            anchors.rightMargin:        ScreenTools.defaultFontPixelWidth  * 0.5
                            anchors.verticalCenter:     parent.verticalCenter
                            QGCLabel {
                                text:                   qsTr("Airspace Regulations")
                                color:                  _colorWhite
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            QGCLabel {
285 286 287 288
                                text:                       qsTr("Advisories based on the selected rules.")
                                color:                      _colorWhite
                                anchors.horizontalCenter:   parent.horizontalCenter
                                font.pointSize:             ScreenTools.smallFontPointSize
Gus Grubba's avatar
Gus Grubba committed
289
                            }
290
                            Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.125; }
Gus Grubba's avatar
Gus Grubba committed
291 292 293 294 295 296 297 298 299
                            GridLayout {
                                columns:                2
                                anchors.left:           parent.left
                                anchors.right:          parent.right
                                Rectangle {
                                    width:                  regButton.height
                                    height:                 width
                                    radius:                 2
                                    color:                  _colorGray
300
                                    Layout.alignment:       Qt.AlignVCenter
Gus Grubba's avatar
Gus Grubba committed
301
                                    QGCColoredImage {
Gus Grubba's avatar
Gus Grubba committed
302
                                        id:                 pencilIcon
Gus Grubba's avatar
Gus Grubba committed
303 304 305 306 307
                                        width:              height
                                        height:             parent.height * 0.5
                                        sourceSize.height:  height
                                        source:             "qrc:/airmap/pencil.svg"
                                        color:              _colorWhite
308
                                        fillMode:           Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
309
                                        anchors.centerIn:   parent
310 311 312
                                        MouseArea {
                                            anchors.fill:   parent
                                            onClicked: {
313
                                                ruleSelector.open()
314 315
                                            }
                                        }
Gus Grubba's avatar
Gus Grubba committed
316 317 318 319
                                    }
                                }
                                Rectangle {
                                    id:                     regButton
320
                                    height:                 ScreenTools.defaultFontPixelHeight * 1.5
Gus Grubba's avatar
Gus Grubba committed
321 322 323 324
                                    radius:                 2
                                    color:                  _colorMidBrown
                                    Layout.fillWidth:       true
                                    QGCLabel {
325
                                        id:                     regLabel
326
                                        text:                   _validRules ? QGroundControl.airspaceManager.ruleSets.selectedRuleSets : qsTr("None")
327 328 329 330 331 332 333 334
                                        elide:                  Text.ElideRight
                                        horizontalAlignment:    Text.AlignHCenter
                                        color:                  _colorWhite
                                        anchors.left:           parent.left
                                        anchors.leftMargin:     ScreenTools.defaultFontPixelWidth  * 0.5
                                        anchors.right:          parent.right
                                        anchors.rightMargin:    ScreenTools.defaultFontPixelWidth  * 0.5
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
335 336 337 338 339
                                    }
                                }
                            }
                        }
                    }
Gus Grubba's avatar
Gus Grubba committed
340 341
                    Flickable {
                        clip:               true
342
                        height:             ScreenTools.defaultFontPixelHeight * 8
Gus Grubba's avatar
Gus Grubba committed
343 344 345 346 347 348 349 350 351 352 353 354
                        contentHeight:      advisoryCol.height
                        flickableDirection: Flickable.VerticalFlick
                        anchors.left:       parent.left
                        anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5
                        anchors.right:      parent.right
                        anchors.rightMargin:ScreenTools.defaultFontPixelWidth * 0.5
                        Column {
                            id:             advisoryCol
                            spacing:        ScreenTools.defaultFontPixelHeight * 0.5
                            anchors.right:  parent.right
                            anchors.left:   parent.left
                            Repeater {
355
                                model:      _validAdvisories ? QGroundControl.airspaceManager.advisories.advisories : []
Gus Grubba's avatar
Gus Grubba committed
356 357 358 359 360 361 362 363 364 365 366
                                delegate: AirspaceRegulation {
                                    regTitle:            object.typeStr
                                    regText:             object.name
                                    regColor:            getAispaceColor(object.color)
                                    anchors.right:       parent.right
                                    anchors.rightMargin: ScreenTools.defaultFontPixelWidth
                                    anchors.left:        parent.left
                                    anchors.leftMargin:  ScreenTools.defaultFontPixelWidth
                                }
                            }
                        }
Gus Grubba's avatar
Gus Grubba committed
367 368 369 370
                    }
                }
            }
            //-- Footer
371
            QGCButton {
372
                text:           planView ? qsTr("File Flight Plan") : qsTr("Flight Brief")
373 374 375 376
                backRadius:     4
                heightFactor:   0.3333
                showBorder:     true
                width:          ScreenTools.defaultFontPixelWidth * 16
377
                visible:        _flightPermit !== AirspaceFlightPlanProvider.PermitNone
378
                anchors.horizontalCenter: parent.horizontalCenter
379
                onClicked: {
380
                    planView ? flightDetails.open() : flightBrief.open()
381 382
                }
            }
Gus Grubba's avatar
Gus Grubba committed
383 384
            QGCLabel {
                text:           qsTr("Powered by <b>AIRMAP</b>")
385
                color:          _textColor
Gus Grubba's avatar
Gus Grubba committed
386 387 388 389 390
                font.pointSize: ScreenTools.smallFontPointSize
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }
    }
391 392
    //---------------------------------------------------------------
    //-- Rule Selector
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
    Popup {
        id:                 ruleSelector
        width:              rulesCol.width  + ScreenTools.defaultFontPixelWidth
        height:             rulesCol.height + ScreenTools.defaultFontPixelHeight
        modal:              true
        focus:              true
        parent:             Overlay.overlay
        closePolicy:        Popup.CloseOnEscape | Popup.CloseOnPressOutside

        property var _popupTarget: null
        property var _arrowTarget: null

        onVisibleChanged: {
            if(visible) {
                _popupTarget = mainWindow.contentItem.mapFromItem(_root, 0, 0)
                _arrowTarget = mainWindow.contentItem.mapFromItem(pencilIcon, 0, 0)
409
            }
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
        }

        x:                  _popupTarget ? _popupTarget.x - width - (ScreenTools.defaultFontPixelWidth * 5) : 0
        y:                  _popupTarget ? _popupTarget.y + mainWindow.header.height : 0

        background: Rectangle {
            anchors.fill:   parent
            color:          qgcPal.window
            radius:         ScreenTools.defaultFontPixelWidth
        }

        Column {
            id:             rulesCol
            spacing:        ScreenTools.defaultFontPixelHeight * 0.5
            anchors.centerIn: parent
            //-- Regulations
426
            Rectangle {
427 428 429 430 431 432 433 434 435 436
                color:      qgcPal.windowShade
                height:     rulesTitle.height + ScreenTools.defaultFontPixelHeight
                width:      parent.width * 0.95
                radius:     _radius
                anchors.horizontalCenter: parent.horizontalCenter
                QGCLabel {
                    id:         rulesTitle
                    text:       qsTr("Airspace Regulation Options")
                    anchors.centerIn: parent
                }
437
            }
438 439 440 441 442 443
            Flickable {
                clip:           true
                width:          ScreenTools.defaultFontPixelWidth  * 30
                height:         ScreenTools.defaultFontPixelHeight * 14
                contentHeight:  rulesetCol.height
                flickableDirection: Flickable.VerticalFlick
444
                Column {
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
                    id:         rulesetCol
                    spacing:    ScreenTools.defaultFontPixelHeight * 0.25
                    anchors.right: parent.right
                    anchors.left:  parent.left
                    anchors.rightMargin:    ScreenTools.defaultFontPixelWidth * 2
                    anchors.leftMargin:     ScreenTools.defaultFontPixelWidth * 2
                    Item {
                        width:  1
                        height: 1
                    }
                    QGCLabel {
                        text:           qsTr("PICK ONE REGULATION")
                        font.pointSize: ScreenTools.smallFontPointSize
                        anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
                    }
                    Repeater {
                        model:    _validRules ? QGroundControl.airspaceManager.ruleSets.ruleSets : []
                        delegate: RuleSelector {
                            visible:             object.selectionType === AirspaceRuleSet.Pickone
                            rule:                object
                            autoExclusive:       true
                            anchors.right:       parent.right
                            anchors.rightMargin: ScreenTools.defaultFontPixelWidth
                            anchors.left:        parent.left
                            anchors.leftMargin:  ScreenTools.defaultFontPixelWidth
470 471
                        }
                    }
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
                    Item {
                        width:  1
                        height: 1
                    }
                    QGCLabel {
                        text:           qsTr("OPTIONAL")
                        font.pointSize: ScreenTools.smallFontPointSize
                        anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
                    }
                    Repeater {
                        model:    _validRules ? QGroundControl.airspaceManager.ruleSets.ruleSets : []
                        delegate: RuleSelector {
                            visible:             object.selectionType === AirspaceRuleSet.Optional
                            rule:                object
                            anchors.right:       parent.right
                            anchors.rightMargin: ScreenTools.defaultFontPixelWidth
                            anchors.left:        parent.left
                            anchors.leftMargin:  ScreenTools.defaultFontPixelWidth
                        }
                    }
                    Item {
                        width:  1
                        height: 1
                    }
                    QGCLabel {
                        text:           qsTr("REQUIRED")
                        font.pointSize: ScreenTools.smallFontPointSize
                        anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
                    }
                    Repeater {
                        model:    _validRules ? QGroundControl.airspaceManager.ruleSets.ruleSets : []
                        delegate: RuleSelector {
                            visible:             object.selectionType === AirspaceRuleSet.Required
                            rule:                object
                            enabled:             false
                            anchors.right:       parent.right
                            anchors.rightMargin: ScreenTools.defaultFontPixelWidth
                            anchors.left:        parent.left
                            anchors.leftMargin:  ScreenTools.defaultFontPixelWidth
511 512 513 514
                        }
                    }
                }
            }
515 516 517 518 519 520 521 522 523 524 525 526
        }

        //-- Arrow
        QGCColoredImage {
            id:                 arrowIcon
            width:              height
            height:             ScreenTools.defaultFontPixelHeight * 2
            sourceSize.height:  height
            source:             "qrc:/airmap/right-arrow.svg"
            color:              qgcPal.window
            anchors.left:       parent.right
            y:                  ruleSelector._arrowTarget ? (ruleSelector._arrowTarget.y - height) : 0
527 528
        }
    }
529

530 531
    //---------------------------------------------------------------
    //-- Flight Details
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
    Popup {
        id:                 flightDetails
        width:              flDetailsRow.width  + (ScreenTools.defaultFontPixelWidth  * 4)
        height:             flDetailsRow.height + (ScreenTools.defaultFontPixelHeight * 2)
        modal:              true
        focus:              true
        parent:             Overlay.overlay
        x:                  Math.round((mainWindow.width  - width)  * 0.5)
        y:                  Math.round((mainWindow.height - height) * 0.5)
        closePolicy:        Popup.NoAutoClose
        background: Rectangle {
            anchors.fill:   parent
            color:          qgcPal.window
            radius:         ScreenTools.defaultFontPixelWidth
        }
        Row {
            id:             flDetailsRow
            spacing:        ScreenTools.defaultFontPixelWidth
            anchors.centerIn: parent
            //---------------------------------------------------------
            //-- Flight Details
            FlightDetails {
                id:         _flightDetails
                baseHeight: _baseHeight
                baseWidth:  _baseWidth
557
            }
558 559
            //---------------------------------------------------------
            //-- Divider
560
            Rectangle {
561 562 563 564 565
                color:      qgcPal.text
                width:      1
                height:     parent.height
                opacity:    0.25
                anchors.verticalCenter: parent.verticalCenter
566
            }
567 568 569 570 571 572
            //---------------------------------------------------------
            //-- Flight Brief
            FlightBrief {
                baseHeight: _baseHeight
                baseWidth:  _baseWidth
                onClosed:   flightDetails.close()
573
            }
574 575 576 577
        }
    }
    //---------------------------------------------------------------
    //-- Flight Brief
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
    Popup {
        id:                 flightBrief
        width:              flightBriedItem.width  + (ScreenTools.defaultFontPixelWidth  * 4)
        height:             flightBriedItem.height + (ScreenTools.defaultFontPixelHeight * 2)
        modal:              true
        focus:              true
        parent:             Overlay.overlay
        x:                  Math.round((mainWindow.width  - width)  * 0.5)
        y:                  Math.round((mainWindow.height - height) * 0.5)
        closePolicy:        Popup.NoAutoClose
        background: Rectangle {
            anchors.fill:   parent
            color:          qgcPal.window
            radius:         ScreenTools.defaultFontPixelWidth
        }
        //---------------------------------------------------------
        //-- Flight Brief
        FlightBrief {
            id:             flightBriedItem
            baseHeight:     _baseHeight
            baseWidth:      _baseWidth
            onClosed:       flightBrief.close()
            anchors.centerIn: parent
601 602
        }
    }
Gus Grubba's avatar
Gus Grubba committed
603
}