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