QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
NTRIPSettings.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4import QGroundControl
5import QGroundControl.FactControls
6import QGroundControl.Controls
7import QGroundControl.NTRIP 1.0
8
9SettingsPage {
10 property var _settingsManager: QGroundControl.settingsManager
11 property var _ntrip: _settingsManager.ntripSettings
12 property Fact _enabled: _ntrip.ntripServerConnectEnabled
13
14 SettingsGroupLayout {
15 Layout.fillWidth: true
16 heading: qsTr("NTRIP / RTK")
17 visible: _ntrip.visible
18
19 FactCheckBoxSlider {
20 Layout.fillWidth: true
21 text: _enabled.shortDescription
22 fact: _enabled
23 visible: _enabled.visible
24 }
25 }
26
27 SettingsGroupLayout {
28 Layout.fillWidth: true
29 visible: _ntrip.ntripServerHostAddress.visible || _ntrip.ntripServerPort.visible ||
30 _ntrip.ntripUsername.visible || _ntrip.ntripPassword.visible ||
31 _ntrip.ntripMountpoint.visible || _ntrip.ntripWhitelist.visible ||
32 _ntrip.ntripUseSpartn.visible
33 enabled: _enabled.rawValue
34
35 // Status line
36 QGCLabel {
37 Layout.fillWidth: true
38 Layout.minimumHeight: 30
39 visible: true
40 text: {
41 try {
42 return NTRIPManager ? (NTRIPManager.ntripStatus || "Disconnected") : "NTRIP Manager not available"
43 } catch (e) {
44 return "Disconnected"
45 }
46 }
47 wrapMode: Text.WordWrap
48 color: {
49 try {
50 if (!NTRIPManager) return qgcPal.text
51 var status = NTRIPManager.ntripStatus || ""
52 if (status.toLowerCase().includes("connected")) return qgcPal.colorGreen
53 if (status.toLowerCase().includes("connecting")) return qgcPal.colorOrange
54 if (status.toLowerCase().includes("error") || status.toLowerCase().includes("failed")) return qgcPal.colorRed
55 return qgcPal.text
56 } catch (e) {
57 return qgcPal.text
58 }
59 }
60 }
61
62 LabelledFactTextField {
63 Layout.fillWidth: true
64 label: _ntrip.ntripServerHostAddress.shortDescription
65 fact: _ntrip.ntripServerHostAddress
66 visible: _ntrip.ntripServerHostAddress.visible
67 textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 60
68 }
69
70 LabelledFactTextField {
71 Layout.fillWidth: true
72 label: _ntrip.ntripServerPort.shortDescription
73 fact: _ntrip.ntripServerPort
74 visible: _ntrip.ntripServerPort.visible
75 textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 20
76 }
77
78 LabelledFactTextField {
79 Layout.fillWidth: true
80 label: _ntrip.ntripUsername.shortDescription
81 fact: _ntrip.ntripUsername
82 visible: _ntrip.ntripUsername.visible
83 textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 60
84 }
85
86 LabelledFactTextField {
87 Layout.fillWidth: true
88 label: _ntrip.ntripPassword.shortDescription
89 fact: _ntrip.ntripPassword
90 visible: _ntrip.ntripPassword.visible
91 textField.echoMode: TextInput.Password
92 textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 60
93 }
94
95 LabelledFactTextField {
96 Layout.fillWidth: true
97 label: _ntrip.ntripMountpoint.shortDescription
98 fact: _ntrip.ntripMountpoint
99 visible: _ntrip.ntripMountpoint.visible
100 textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 40
101 }
102
103 LabelledFactTextField {
104 Layout.fillWidth: true
105 label: _ntrip.ntripWhitelist.shortDescription
106 fact: _ntrip.ntripWhitelist
107 visible: _ntrip.ntripWhitelist.visible
108 textFieldPreferredWidth: ScreenTools.defaultFontPixelWidth * 40
109 }
110
111 FactCheckBoxSlider {
112 Layout.fillWidth: true
113 text: _ntrip.ntripUseSpartn.shortDescription
114 fact: _ntrip.ntripUseSpartn
115 visible: _ntrip.ntripUseSpartn.visible
116 enabled: false
117 }
118 }
119}