QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
RemoteIDGpsLocation.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6import QGroundControl.FactControls
7
8SettingsGroupLayout {
9 heading: qsTr("NMEA External GPS")
10 Layout.fillWidth: true
11 visible: !ScreenTools.isMobile
12 && QGroundControl.settingsManager.autoConnectSettings.nmeaSource.userVisible
13 && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.userVisible
14 && _locationType !== RemoteIDSettings.LocationType.TAKEOFF
15
16 property int _locationType: QGroundControl.settingsManager.remoteIDSettings.locationType.value
17
18 readonly property var _autoConnectSettings: QGroundControl.settingsManager.autoConnectSettings
19 readonly property bool _serialSource: _autoConnectSettings.nmeaSource.rawValue === AutoConnectSettings.NmeaSourceSerial
20
21 LabelledFactComboBox {
22 label: qsTr("Source")
23 fact: _autoConnectSettings.nmeaSource
24 Layout.fillWidth: true
25 }
26
27 LabelledComboBox {
28 id: nmeaPortCombo
29 label: qsTr("Device")
30 Layout.fillWidth: true
31 visible: _serialSource
32
33 model: ListModel { }
34
35 onActivated: (index) => {
36 if (index !== -1 && QGroundControl.linkManager.serialPorts.length !== 0) {
37 _autoConnectSettings.autoConnectNmeaPort.value = comboBox.textAt(index);
38 }
39 }
40 Component.onCompleted: {
41 if (QGroundControl.linkManager.serialPorts.length === 0) {
42 nmeaPortCombo.model.append({text: qsTr("<none available>")})
43 } else {
44 for (var i in QGroundControl.linkManager.serialPorts) {
45 nmeaPortCombo.model.append({text: QGroundControl.linkManager.serialPorts[i]})
46 }
47 }
48 var index = nmeaPortCombo.comboBox.find(_autoConnectSettings.autoConnectNmeaPort.valueString);
49 nmeaPortCombo.currentIndex = index;
50 }
51 }
52
53 LabelledComboBox {
54 id: nmeaBaudCombo
55 label: qsTr("Baudrate")
56 Layout.fillWidth: true
57 visible: _serialSource
58 model: QGroundControl.linkManager.serialBaudRates
59
60 onActivated: (index) => {
61 if (index !== -1) {
62 QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = parseInt(comboBox.textAt(index));
63 }
64 }
65 Component.onCompleted: {
66 var index = nmeaBaudCombo.comboBox.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
67 nmeaBaudCombo.currentIndex = index;
68 }
69 }
70
71 LabelledFactTextField {
72 label: qsTr("UDP Port")
73 fact: QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
74 Layout.fillWidth: true
75 visible: _autoConnectSettings.nmeaSource.rawValue === AutoConnectSettings.NmeaSourceUdp
76 }
77}