AirspaceControl.qml 34.9 KB
Newer Older
Gus Grubba's avatar
Gus Grubba committed
1 2 3 4 5 6
import QtQuick                  2.3
import QtQuick.Controls         1.2
import QtQuick.Controls.Styles  1.4
import QtQuick.Dialogs          1.2
import QtQuick.Layouts          1.2
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:           true
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
32
    property bool   _dirty:             false
Gus Grubba's avatar
Gus Grubba committed
33 34 35 36 37 38

    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"
39
    readonly property color     _colorLightGray:    "#a0a0a0"
Gus Grubba's avatar
Gus Grubba committed
40 41 42
    readonly property color     _colorMidBrown:     "#3a322f"
    readonly property color     _colorYellow:       "#d7c61d"
    readonly property color     _colorWhite:        "#ffffff"
Gus Grubba's avatar
Gus Grubba committed
43 44
    readonly property color     _colorRed:          "#aa1200"
    readonly property color     _colorGreen:        "#125f00"
Gus Grubba's avatar
Gus Grubba committed
45 46 47 48 49 50

    QGCPalette {
        id: qgcPal
        colorGroupEnabled: enabled
    }

Gus Grubba's avatar
Gus Grubba committed
51 52 53 54 55 56 57 58
    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;
    }

59 60 61 62 63 64 65 66 67 68 69 70
    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;
    }

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

Gus Grubba's avatar
Gus Grubba committed
81 82 83 84 85
    //---------------------------------------------------------------
    //-- Colapsed State
    Rectangle {
        id:         colapsedRect
        width:      parent.width
Gus Grubba's avatar
Gus Grubba committed
86
        height:     _colapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0
Gus Grubba's avatar
Gus Grubba committed
87
        color:      QGroundControl.airspaceManager.connected ? (_validAdvisories ? getAispaceColor(QGroundControl.airspaceManager.advisories.airspaceColor) : _colorGray) : _colorGray
Gus Grubba's avatar
Gus Grubba committed
88
        radius:     _radius
Gus Grubba's avatar
Gus Grubba committed
89
        visible:    _colapsed
Gus Grubba's avatar
Gus Grubba committed
90 91 92 93 94 95 96 97 98 99
        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
100 101
                source:                 "qrc:/airmap/advisory-icon.svg"
                color:                  _textColor
Gus Grubba's avatar
Gus Grubba committed
102 103
                anchors.verticalCenter: parent.verticalCenter
            }
104 105
            Column {
                spacing:                0
Gus Grubba's avatar
Gus Grubba committed
106
                anchors.verticalCenter: parent.verticalCenter
107 108 109 110 111 112 113 114 115 116
                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
117
            }
Gus Grubba's avatar
Gus Grubba committed
118 119 120 121 122
            Item {
                width:  ScreenTools.defaultFontPixelWidth
                height: 1
            }
            AirspaceWeather {
123
                iconHeight:             ScreenTools.defaultFontPixelHeight * 2
Gus Grubba's avatar
Gus Grubba committed
124
                visible:                QGroundControl.airspaceManager.weatherInfo.valid && QGroundControl.airspaceManager.connected
125
                contentColor:           _textColor
Gus Grubba's avatar
Gus Grubba committed
126 127
                anchors.verticalCenter: parent.verticalCenter
            }
Gus Grubba's avatar
Gus Grubba committed
128 129 130 131 132 133
            QGCLabel {
                text:                   qsTr("Not Connected")
                color:                  qgcPal.text
                visible:                !QGroundControl.airspaceManager.connected
                anchors.verticalCenter: parent.verticalCenter
            }
Gus Grubba's avatar
Gus Grubba committed
134
        }
Gus Grubba's avatar
Gus Grubba committed
135 136 137 138 139
        QGCColoredImage {
            width:                  height
            height:                 ScreenTools.defaultFontPixelWidth * 2.5
            sourceSize.height:      height
            source:                 "qrc:/airmap/expand.svg"
140
            color:                  _textColor
141
            fillMode:               Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
142
            visible:                QGroundControl.airspaceManager.connected
Gus Grubba's avatar
Gus Grubba committed
143 144 145 146
            anchors.right:          parent.right
            anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
            anchors.verticalCenter: parent.verticalCenter
        }
Gus Grubba's avatar
Gus Grubba committed
147
        MouseArea {
Gus Grubba's avatar
Gus Grubba committed
148 149
            anchors.fill:           parent
            enabled:                QGroundControl.airspaceManager.connected
Gus Grubba's avatar
Gus Grubba committed
150
            onClicked:  {
151
                QGroundControl.airspaceManager.airspaceVisible = true
Gus Grubba's avatar
Gus Grubba committed
152
            }
Gus Grubba's avatar
Gus Grubba committed
153 154 155 156 157 158 159
        }
    }
    //---------------------------------------------------------------
    //-- Expanded State
    Rectangle {
        id:         expandedRect
        width:      parent.width
Gus Grubba's avatar
Gus Grubba committed
160
        height:     !_colapsed ? expandedCol.height + ScreenTools.defaultFontPixelHeight : 0
161
        color:      _validAdvisories ? getAispaceColor(QGroundControl.airspaceManager.advisories.airspaceColor) : _colorGray
Gus Grubba's avatar
Gus Grubba committed
162
        radius:     _radius
Gus Grubba's avatar
Gus Grubba committed
163
        visible:    !_colapsed
Gus Grubba's avatar
Gus Grubba committed
164 165 166 167 168 169
        MouseArea {
            anchors.fill:   parent
            onWheel:        { wheel.accepted = true; }
            onPressed:      { mouse.accepted = true; }
            onReleased:     { mouse.accepted = true; }
        }
Gus Grubba's avatar
Gus Grubba committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
        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"
191
                        color:                  _textColor
192
                        fillMode:               Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
193 194 195 196 197 198 199
                        anchors.verticalCenter: parent.verticalCenter
                    }
                    Column {
                        spacing:                0
                        anchors.verticalCenter: parent.verticalCenter
                        QGCLabel {
                            text:               qsTr("Airspace")
200
                            color:              _textColor
Gus Grubba's avatar
Gus Grubba committed
201 202
                        }
                        QGCLabel {
203
                            text:               _validAdvisories ? QGroundControl.airspaceManager.advisories.advisories.count + qsTr(" Advisories") : ""
204 205
                            color:              _textColor
                            visible:            _validAdvisories
Gus Grubba's avatar
Gus Grubba committed
206 207 208
                            font.pointSize:     ScreenTools.smallFontPointSize
                        }
                    }
Gus Grubba's avatar
Gus Grubba committed
209 210 211 212 213
                    Item {
                        width:  ScreenTools.defaultFontPixelWidth
                        height: 1
                    }
                    AirspaceWeather {
214
                        visible:                QGroundControl.airspaceManager.weatherInfo.valid && showColapse
215
                        contentColor:           _textColor
Gus Grubba's avatar
Gus Grubba committed
216 217
                        anchors.verticalCenter: parent.verticalCenter
                    }
Gus Grubba's avatar
Gus Grubba committed
218
                }
Gus Grubba's avatar
Gus Grubba committed
219 220 221 222 223
                QGCColoredImage {
                    width:                  height
                    height:                 ScreenTools.defaultFontPixelWidth * 2.5
                    sourceSize.height:      height
                    source:                 "qrc:/airmap/colapse.svg"
224
                    color:                  _textColor
Gus Grubba's avatar
Gus Grubba committed
225
                    visible:                showColapse
226
                    fillMode:               Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
227 228 229 230 231
                    anchors.right:          parent.right
                    anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
                    anchors.verticalCenter: parent.verticalCenter
                    MouseArea {
                        anchors.fill:   parent
232 233
                        enabled:        showColapse
                        onClicked:      QGroundControl.airspaceManager.airspaceVisible = false
Gus Grubba's avatar
Gus Grubba committed
234 235
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
236
                AirspaceWeather {
237
                    visible:                QGroundControl.airspaceManager.weatherInfo.valid && !showColapse
238
                    contentColor:           _textColor
Gus Grubba's avatar
Gus Grubba committed
239 240 241 242
                    anchors.right:          parent.right
                    anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
                    anchors.verticalCenter: parent.verticalCenter
                }
Gus Grubba's avatar
Gus Grubba committed
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
            }
            //-- 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
272
                            spacing:                    ScreenTools.defaultFontPixelHeight * 0.25
Gus Grubba's avatar
Gus Grubba committed
273 274 275 276 277 278 279 280 281 282 283
                            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 {
284 285 286 287
                                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
288
                            }
289
                            Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.125; }
Gus Grubba's avatar
Gus Grubba committed
290 291 292 293 294 295 296 297 298
                            GridLayout {
                                columns:                2
                                anchors.left:           parent.left
                                anchors.right:          parent.right
                                Rectangle {
                                    width:                  regButton.height
                                    height:                 width
                                    radius:                 2
                                    color:                  _colorGray
299
                                    Layout.alignment:       Qt.AlignVCenter
Gus Grubba's avatar
Gus Grubba committed
300
                                    QGCColoredImage {
Gus Grubba's avatar
Gus Grubba committed
301
                                        id:                 pencilIcon
Gus Grubba's avatar
Gus Grubba committed
302 303 304 305 306
                                        width:              height
                                        height:             parent.height * 0.5
                                        sourceSize.height:  height
                                        source:             "qrc:/airmap/pencil.svg"
                                        color:              _colorWhite
307
                                        fillMode:           Image.PreserveAspectFit
Gus Grubba's avatar
Gus Grubba committed
308
                                        anchors.centerIn:   parent
309 310 311 312 313 314 315
                                        MouseArea {
                                            anchors.fill:   parent
                                            onClicked: {
                                                rootLoader.sourceComponent = ruleSelector
                                                mainWindow.disableToolbar()
                                            }
                                        }
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
                    rootLoader.sourceComponent = planView ? flightDetails : flightBrief
381
                    mainWindow.disableToolbar()
382 383
                }
            }
Gus Grubba's avatar
Gus Grubba committed
384 385
            QGCLabel {
                text:           qsTr("Powered by <b>AIRMAP</b>")
386
                color:          _textColor
Gus Grubba's avatar
Gus Grubba committed
387 388 389 390 391
                font.pointSize: ScreenTools.smallFontPointSize
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }
    }
392 393 394 395 396 397 398 399 400 401
    //---------------------------------------------------------------
    //-- Rule Selector
    Component {
        id:             ruleSelector
        Rectangle {
            width:      mainWindow.width
            height:     mainWindow.height
            color:      Qt.rgba(0,0,0,0.1)
            MouseArea {
                anchors.fill:   parent
Gus Grubba's avatar
Gus Grubba committed
402
                onWheel:   { wheel.accepted = true; }
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
                onClicked: {
                    mainWindow.enableToolbar()
                    rootLoader.sourceComponent = null
                }
            }
            Rectangle {
                id:             ruleSelectorShadow
                anchors.fill:   ruleSelectorRect
                radius:         ruleSelectorRect.radius
                color:          qgcPal.window
                visible:        false
            }
            DropShadow {
                anchors.fill:       ruleSelectorShadow
                visible:            ruleSelectorRect.visible
                horizontalOffset:   4
                verticalOffset:     4
                radius:             32.0
                samples:            65
                color:              Qt.rgba(0,0,0,0.75)
                source:             ruleSelectorShadow
            }
            Rectangle {
                id:                 ruleSelectorRect
Gus Grubba's avatar
Gus Grubba committed
427 428
                x:                  0
                y:                  0
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
                color:              qgcPal.window
                width:              rulesCol.width  + ScreenTools.defaultFontPixelWidth
                height:             rulesCol.height + ScreenTools.defaultFontPixelHeight
                radius:             ScreenTools.defaultFontPixelWidth
                Column {
                    id:             rulesCol
                    spacing:        ScreenTools.defaultFontPixelHeight * 0.5
                    anchors.centerIn: parent
                    //-- Regulations
                    Rectangle {
                        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
                        }
                    }
                    Flickable {
                        clip:           true
                        width:          ScreenTools.defaultFontPixelWidth  * 30
                        height:         ScreenTools.defaultFontPixelHeight * 14
                        contentHeight:  rulesetCol.height
                        flickableDirection: Flickable.VerticalFlick
                        Column {
                            id:         rulesetCol
Gus Grubba's avatar
Gus Grubba committed
458
                            spacing:    ScreenTools.defaultFontPixelHeight * 0.25
459 460
                            anchors.right: parent.right
                            anchors.left:  parent.left
Gus Grubba's avatar
Gus Grubba committed
461 462 463 464 465 466
                            anchors.rightMargin:    ScreenTools.defaultFontPixelWidth * 2
                            anchors.leftMargin:     ScreenTools.defaultFontPixelWidth * 2
                            Item {
                                width:  1
                                height: 1
                            }
467
                            ExclusiveGroup { id: rulesGroup }
468
                            QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
469
                                text:           qsTr("PICK ONE REGULATION")
470
                                font.pointSize: ScreenTools.smallFontPointSize
Gus Grubba's avatar
Gus Grubba committed
471
                                anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
472 473
                            }
                            Repeater {
474
                                model:    _validRules ? QGroundControl.airspaceManager.ruleSets.ruleSets : []
Gus Grubba's avatar
Gus Grubba committed
475
                                delegate: RuleSelector {
476
                                    visible:             object.selectionType === AirspaceRuleSet.Pickone
Gus Grubba's avatar
Gus Grubba committed
477
                                    rule:                object
478
                                    exclusiveGroup:      rulesGroup
Gus Grubba's avatar
Gus Grubba committed
479
                                    anchors.right:       parent.right
480
                                    anchors.rightMargin: ScreenTools.defaultFontPixelWidth
Gus Grubba's avatar
Gus Grubba committed
481 482 483 484 485 486 487 488 489 490 491 492 493 494
                                    anchors.left:        parent.left
                                    anchors.leftMargin:  ScreenTools.defaultFontPixelWidth
                                }
                            }
                            Item {
                                width:  1
                                height: 1
                            }
                            QGCLabel {
                                text:           qsTr("OPTIONAL")
                                font.pointSize: ScreenTools.smallFontPointSize
                                anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
                            }
                            Repeater {
495
                                model:    _validRules ? QGroundControl.airspaceManager.ruleSets.ruleSets : []
Gus Grubba's avatar
Gus Grubba committed
496
                                delegate: RuleSelector {
497
                                    visible:             object.selectionType === AirspaceRuleSet.Optional
Gus Grubba's avatar
Gus Grubba committed
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
                                    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 {
515
                                model:    _validRules ? QGroundControl.airspaceManager.ruleSets.ruleSets : []
Gus Grubba's avatar
Gus Grubba committed
516
                                delegate: RuleSelector {
517
                                    visible:             object.selectionType === AirspaceRuleSet.Required
Gus Grubba's avatar
Gus Grubba committed
518
                                    rule:                object
519
                                    required:            true
Gus Grubba's avatar
Gus Grubba committed
520 521 522
                                    anchors.right:       parent.right
                                    anchors.rightMargin: ScreenTools.defaultFontPixelWidth
                                    anchors.left:        parent.left
523 524 525 526 527 528 529
                                    anchors.leftMargin:  ScreenTools.defaultFontPixelWidth
                                }
                            }
                        }
                    }
                }
            }
Gus Grubba's avatar
Gus Grubba committed
530 531 532 533 534 535 536 537 538 539 540
            //-- Arrow
            QGCColoredImage {
                id:                 arrowIconShadow
                anchors.fill:       arrowIcon
                sourceSize.height:  height
                source:             "qrc:/airmap/right-arrow.svg"
                color:              qgcPal.window
                visible:            false
            }
            DropShadow {
                anchors.fill:       arrowIconShadow
541
                visible:            ruleSelectorRect.visible && qgcPal.globalTheme === QGCPalette.Dark
Gus Grubba's avatar
Gus Grubba committed
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
                horizontalOffset:   4
                verticalOffset:     4
                radius:             32.0
                samples:            65
                color:              Qt.rgba(0,0,0,0.75)
                source:             arrowIconShadow
            }
            QGCColoredImage {
                id:                 arrowIcon
                width:              height
                height:             ScreenTools.defaultFontPixelHeight * 2
                sourceSize.height:  height
                source:             "qrc:/airmap/right-arrow.svg"
                color:              ruleSelectorRect.color
                anchors.left:       ruleSelectorRect.right
                anchors.top:        ruleSelectorRect.top
                anchors.topMargin:  (ScreenTools.defaultFontPixelHeight * 4) - (height * 0.5) + (pencilIcon.height * 0.5)
            }
560 561
            Component.onCompleted: {
                mainWindow.disableToolbar()
Gus Grubba's avatar
Gus Grubba committed
562 563 564
                var target = mainWindow.mapFromItem(pencilIcon, 0, 0)
                ruleSelectorRect.x = target.x - ruleSelectorRect.width - (ScreenTools.defaultFontPixelWidth * 7)
                ruleSelectorRect.y = target.y - (ScreenTools.defaultFontPixelHeight * 4)
565 566 567
            }
        }
    }
568 569 570 571 572 573 574 575 576
    //---------------------------------------------------------------
    //-- Flight Details
    Component {
        id:             flightDetails
        Rectangle {
            id:         flightDetailsRoot
            width:      mainWindow.width
            height:     mainWindow.height
            color:      Qt.rgba(0,0,0,0.1)
577 578
            property real baseHeight:  ScreenTools.defaultFontPixelHeight * 22
            property real baseWidth:   ScreenTools.defaultFontPixelWidth  * 40
579 580 581 582
            Component.onCompleted: {
                _dirty = false
                mainWindow.disableToolbar()
            }
583 584
            MouseArea {
                anchors.fill:   parent
Gus Grubba's avatar
Gus Grubba committed
585
                hoverEnabled:   true
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
                onWheel:        { wheel.accepted = true; }
                onPressed:      { mouse.accepted = true; }
                onReleased:     { mouse.accepted = true; }
            }
            Rectangle {
                id:             flightDetailsShadow
                anchors.fill:   flightDetailsRect
                radius:         flightDetailsRect.radius
                color:          qgcPal.window
                visible:        false
            }
            DropShadow {
                anchors.fill:       flightDetailsShadow
                visible:            flightDetailsRect.visible
                horizontalOffset:   4
                verticalOffset:     4
                radius:             32.0
                samples:            65
                color:              Qt.rgba(0,0,0,0.75)
                source:             flightDetailsShadow
            }
            Rectangle {
                id:                 flightDetailsRect
                color:              qgcPal.window
                width:              flDetailsRow.width  + (ScreenTools.defaultFontPixelWidth  * 4)
                height:             flDetailsRow.height + (ScreenTools.defaultFontPixelHeight * 2)
                radius:             ScreenTools.defaultFontPixelWidth
                anchors.centerIn:   parent
                Row {
                    id:             flDetailsRow
                    spacing:        ScreenTools.defaultFontPixelWidth
                    anchors.centerIn: parent
                    //---------------------------------------------------------
                    //-- Flight Details
620 621 622
                    FlightDetails {
                        baseHeight:  flightDetailsRoot.baseHeight
                        baseWidth:   flightDetailsRoot.baseWidth
623 624 625 626 627 628 629 630 631 632 633 634
                    }
                    //---------------------------------------------------------
                    //-- Divider
                    Rectangle {
                        color:      qgcPal.text
                        width:      1
                        height:     parent.height
                        opacity:    0.25
                        anchors.verticalCenter: parent.verticalCenter
                    }
                    //---------------------------------------------------------
                    //-- Flight Brief
635 636 637
                    FlightBrief {
                        baseHeight:  flightDetailsRoot.baseHeight
                        baseWidth:   flightDetailsRoot.baseWidth
638 639 640
                    }
                }
            }
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
        }
    }
    //---------------------------------------------------------------
    //-- Flight Brief
    Component {
        id:             flightBrief
        Rectangle {
            id:         flightBriefRoot
            width:      mainWindow.width
            height:     mainWindow.height
            color:      Qt.rgba(0,0,0,0.1)
            property real baseHeight:  ScreenTools.defaultFontPixelHeight * 22
            property real baseWidth:   ScreenTools.defaultFontPixelWidth  * 40
            Component.onCompleted: {
                _dirty = false
                mainWindow.disableToolbar()
            }
            MouseArea {
                anchors.fill:   parent
                hoverEnabled:   true
                onWheel:        { wheel.accepted = true; }
                onPressed:      { mouse.accepted = true; }
                onReleased:     { mouse.accepted = true; }
            }
            Rectangle {
                id:             flightBriefShadow
                anchors.fill:   flightBriefRect
                radius:         flightBriefRect.radius
                color:          qgcPal.window
                visible:        false
            }
            DropShadow {
                anchors.fill:       flightBriefShadow
                visible:            flightBriefRect.visible
                horizontalOffset:   4
                verticalOffset:     4
                radius:             32.0
                samples:            65
                color:              Qt.rgba(0,0,0,0.75)
                source:             flightBriefShadow
            }
            Rectangle {
                id:                 flightBriefRect
                color:              qgcPal.window
                width:              flightBriedItem.width  + (ScreenTools.defaultFontPixelWidth  * 4)
                height:             flightBriedItem.height + (ScreenTools.defaultFontPixelHeight * 2)
                radius:             ScreenTools.defaultFontPixelWidth
                anchors.centerIn:   parent
                //---------------------------------------------------------
                //-- Flight Brief
                FlightBrief {
                    id:             flightBriedItem
                    baseHeight:     flightBriefRoot.baseHeight
                    baseWidth:      flightBriefRoot.baseWidth
                    anchors.centerIn: parent
696 697 698 699
                }
            }
        }
    }
Gus Grubba's avatar
Gus Grubba committed
700
}