Browse Source

generalSettings.qml: add NMEA udp port selection

QGC4.4
Willian Galvani 7 years ago
parent
commit
671e445d6d
  1. 22
      src/ui/preferences/GeneralSettings.qml

22
src/ui/preferences/GeneralSettings.qml

@ -53,6 +53,9 @@ QGCView {
property bool _isTCP: _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.tcpVideoSource property bool _isTCP: _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.tcpVideoSource
property bool _isMPEGTS: _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.mpegtsVideoSource property bool _isMPEGTS: _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.mpegtsVideoSource
property string gpsDisabled: "Disabled"
property string gpsUdpPort: "UDP Port"
readonly property real _internalWidthRatio: 0.8 readonly property real _internalWidthRatio: 0.8
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
@ -505,7 +508,6 @@ QGCView {
Layout.preferredWidth: _comboFieldWidth Layout.preferredWidth: _comboFieldWidth
model: ListModel { model: ListModel {
ListElement { text: "disabled" }
} }
onActivated: { onActivated: {
@ -514,18 +516,26 @@ QGCView {
} }
} }
Component.onCompleted: { Component.onCompleted: {
model.append({text: gpsDisabled})
model.append({text: gpsUdpPort})
for (var i in QGroundControl.linkManager.serialPorts) { for (var i in QGroundControl.linkManager.serialPorts) {
nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]}) nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]})
} }
var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString); var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString);
nmeaPortCombo.currentIndex = index; nmeaPortCombo.currentIndex = index;
if (QGroundControl.linkManager.serialPorts.length === 0) {
nmeaPortCombo.model.append({text: "Serial <none available>"})
}
} }
} }
QGCLabel { QGCLabel {
visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
text: qsTr("NMEA GPS Baudrate") text: qsTr("NMEA GPS Baudrate")
} }
QGCComboBox { QGCComboBox {
visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
id: nmeaBaudCombo id: nmeaBaudCombo
Layout.preferredWidth: _comboFieldWidth Layout.preferredWidth: _comboFieldWidth
model: [4800, 9600, 19200, 38400, 57600, 115200] model: [4800, 9600, 19200, 38400, 57600, 115200]
@ -540,6 +550,16 @@ QGCView {
nmeaBaudCombo.currentIndex = index; nmeaBaudCombo.currentIndex = index;
} }
} }
QGCLabel {
text: qsTr("NMEA stream UDP port")
visible: nmeaPortCombo.currentText === gpsUdpPort
}
FactTextField {
visible: nmeaPortCombo.currentText === gpsUdpPort
Layout.preferredWidth: _valueFieldWidth
fact: QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
}
} }
} }
} }

Loading…
Cancel
Save