"Fossies" - the Fresh Open Source Software Archive

Member "flightgear-2020.3.8/src/GUI/qml/LocationNavaidView.qml" (24 Mar 2021, 5333 Bytes) of package /linux/privat/flightgear-2020.3.8.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) QML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "LocationNavaidView.qml": 2020.3.7_vs_2020.3.8.

    1 import QtQuick 2.4
    2 import FlightGear 1.0
    3 import FlightGear.Launcher 1.0
    4 import "."
    5 
    6 Item {
    7     property alias location: navaidData.guid
    8     property alias geod: diagram.geod
    9 
   10     Positioned {
   11         id: navaidData
   12         onGuidChanged: {
   13             if (guid > 0) {
   14                 diagram.navaid = guid
   15                 _location.setBaseLocation(this)
   16             }
   17         }
   18     }
   19 
   20     GettingStartedScope.controller: tips.controller
   21 
   22     NavaidDiagram {
   23         id: diagram
   24         anchors.fill: parent
   25 
   26         offsetEnabled: _location.offsetEnabled
   27         offsetBearing: _location.offsetRadial
   28         offsetDistance: _location.offsetDistance
   29         heading: _location.heading
   30 
   31         GettingStartedTip {
   32             tipId: "locationNavDiagram"
   33             anchors.centerIn: parent
   34             arrow: GettingStartedTip.NoArrow
   35             text: qsTr("Drag here to move the map. Mouse-wheel zooms in and out.")
   36         }
   37     }
   38 
   39     Rectangle {
   40         id: panel
   41 
   42         color: "transparent"
   43         border.width: 1
   44         border.color: Style.frameColor
   45 
   46         anchors {
   47             left: parent.left
   48             right: parent.right
   49             bottom: parent.bottom
   50             margins: Style.strutSize
   51         }
   52 
   53         height: selectionGrid.height + Style.margin * 2
   54 
   55         // set opacity here only, so we don't make the whole summary pannel translucent
   56         Rectangle {
   57             id: background
   58             anchors.fill: parent
   59             z: -1
   60             opacity: Style.panelOpacity
   61             color: "white"
   62         }
   63 
   64         Column {
   65             id: selectionGrid
   66             spacing: Style.margin
   67             width: parent.width
   68 
   69             StyledText { // heading text
   70                 id: headingText
   71                 anchors {
   72                     left: parent.left
   73                     right: parent.right
   74                     margins: Style.margin
   75                 }
   76 
   77                 text: qsTr("Position: %1").arg(geod.toString(0));
   78                 font.pixelSize: Style.headingFontPixelSize
   79                 Binding {
   80                     when: navaidData.valid
   81                     target: headingText
   82                     property: "text"
   83                     value: qsTr("Navaid: %1 / %2").arg(navaidData.ident).arg(navaidData.name)
   84                 }
   85             }
   86 
   87             Row {
   88                 height: childrenRect.height
   89                 width: parent.width
   90                 spacing: Style.margin
   91 
   92                 ToggleSwitch {
   93                     id: airspeedToggle
   94                     checked: _location.speedEnabled
   95                     onCheckedChanged: _location.speedEnabled = checked;
   96                 }
   97 
   98                 NumericalEdit {
   99                     label: qsTr("Airspeed:")
  100                     enabled: _location.speedEnabled
  101                     quantity: _location.airspeed
  102                     onCommit: _location.airspeed = newValue
  103                     unitsMode: Units.Speed
  104                 }
  105 
  106                 Item {
  107                     // padding
  108                     width: Style.strutSize
  109                     height: 1
  110                 }
  111 
  112                 ToggleSwitch {
  113                     id: headingToggle
  114                     checked: _location.headingEnabled
  115                     function toggle(newChecked) {
  116                         _location.headingEnabled  = newChecked;
  117                     }
  118                 }
  119 
  120                 NumericalEdit {
  121                     label: qsTr("Heading:")
  122                     // FIXME: support passing a magnetic heading to FG
  123                     // or compute magvar ourselves
  124                     unitsMode: Units.HeadingOnlyTrue
  125                     enabled: _location.headingEnabled
  126                     quantity: _location.heading
  127                     onCommit: _location.heading = newValue
  128                 }
  129             }
  130 
  131             LocationAltitudeRow
  132             {
  133                 width: parent.width
  134                 unitsMode: Units.AltitudeIncludingMeters
  135             }
  136 
  137             // offset row
  138             Row {
  139                 ToggleSwitch {
  140                     id: offsetToggle
  141                     label: qsTr("Offset ")
  142                     anchors.verticalCenter: parent.verticalCenter
  143                     checked: _location.offsetEnabled
  144                     onCheckedChanged: {
  145                         _location.offsetEnabled = checked
  146                     }
  147                 }
  148 
  149                 NumericalEdit {
  150                     id: offsetNmEdit
  151                     quantity: _location.offsetDistance
  152                     onCommit: _location.offsetDistance = newValue
  153                     live: true
  154                     anchors.verticalCenter: parent.verticalCenter
  155                     enabled: offsetToggle.checked
  156                     unitsMode: Units.Distance
  157                 }
  158 
  159                 NumericalEdit {
  160                     label: qsTr(" on bearing ")
  161                     unitsMode: Units.HeadingOnlyTrue
  162                     enabled: offsetToggle.checked
  163                     quantity: _location.offsetRadial
  164                     onCommit: _location.offsetRadial = newValue
  165                     live: true
  166                 }
  167             }
  168         } // main layout column
  169     } // main panel rectangle
  170 
  171 
  172     GettingStartedTipLayer {
  173         id: tips
  174         anchors.fill: parent
  175         scopeId: "locationNavDetails"
  176     }
  177 }