7import QGroundControl.Controls
10 Layout.fillWidth: true
11 heading: qsTr("MAVLink 2.0 Log Uploads (PX4 Pro Only)")
12 visible: QGroundControl.corePlugin.options.showPX4LogTransferOptions && _isPX4
14 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
15 property bool _isPX4: _activeVehicle ? _activeVehicle.px4Firmware : true
16 property var _mavlinkLogManager: _activeVehicle ? _activeVehicle.mavlinkLogManager : null
17 property bool _disableDataPersistence: QGroundControl.settingsManager.appSettings.disableAllPersistence.rawValue
18 property real _valueWidth: ScreenTools.defaultFontPixelWidth * 24
20 function saveItems() {
21 if (!_mavlinkLogManager) return
22 _mavlinkLogManager.videoURL = videoUrlField.text
23 _mavlinkLogManager.feedback = feedbackTextArea.text
24 _mavlinkLogManager.emailAddress = emailField.text
25 _mavlinkLogManager.description = descField.text
26 _mavlinkLogManager.uploadURL = urlField.text
27 if (autoUploadCheck.checked && _mavlinkLogManager.emailAddress === "") {
28 autoUploadCheck.checked = false
29 _mavlinkLogManager.enableAutoUpload = false
31 _mavlinkLogManager.enableAutoUpload = autoUploadCheck.checked
38 buttons: MessageDialog.Close
39 title: qsTr("MAVLink Logging")
40 text: qsTr("Please enter an email address before uploading MAVLink log files.")
44 Layout.fillWidth: true
45 spacing: ScreenTools.defaultFontPixelWidth
48 text: qsTr("Email address for Log Upload:")
49 Layout.fillWidth: true
54 Layout.fillWidth: true
55 text: _mavlinkLogManager ? _mavlinkLogManager.emailAddress : ""
56 enabled: !_disableDataPersistence
57 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
58 onEditingFinished: saveItems()
63 Layout.fillWidth: true
64 spacing: ScreenTools.defaultFontPixelWidth
67 text: qsTr("Default Description:")
68 Layout.fillWidth: true
73 Layout.fillWidth: true
74 text: _mavlinkLogManager ? _mavlinkLogManager.description : ""
75 enabled: !_disableDataPersistence
76 onEditingFinished: saveItems()
81 Layout.fillWidth: true
82 spacing: ScreenTools.defaultFontPixelWidth
85 text: qsTr("Default Upload URL:")
86 Layout.fillWidth: true
91 Layout.fillWidth: true
92 text: _mavlinkLogManager ? _mavlinkLogManager.uploadURL : ""
93 enabled: !_disableDataPersistence
94 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
95 onEditingFinished: saveItems()
100 Layout.fillWidth: true
101 spacing: ScreenTools.defaultFontPixelWidth
104 text: qsTr("Video URL:")
105 Layout.fillWidth: true
110 Layout.fillWidth: true
111 text: _mavlinkLogManager ? _mavlinkLogManager.videoURL : ""
112 enabled: !_disableDataPersistence
113 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
118 Layout.fillWidth: true
119 label: qsTr("Wind Speed")
120 enabled: !_disableDataPersistence
121 model: [qsTr("Please Select"), qsTr("Calm"), qsTr("Breeze"), qsTr("Gale"), qsTr("Storm")]
123 property var _windValues: [-1, 0, 5, 8, 10]
125 onActivated: (index) => {
127 if (_mavlinkLogManager) _mavlinkLogManager.windSpeed = _windValues[index]
129 Component.onCompleted: {
130 if (!_mavlinkLogManager) return
131 for (var i = 0; i < _windValues.length; i++) {
132 if (_windValues[i] === _mavlinkLogManager.windSpeed) {
133 comboBox.currentIndex = i
141 Layout.fillWidth: true
142 label: qsTr("Flight Rating")
143 enabled: !_disableDataPersistence
144 model: [qsTr("Please Select"), qsTr("Crashed (Pilot Error)"), qsTr("Crashed (Software or Hardware issue)"),
145 qsTr("Unsatisfactory"), qsTr("Good"), qsTr("Great")]
147 property var _ratingValues: ["notset", "crash_pilot", "crash_sw_hw", "unsatisfactory", "good", "great"]
149 onActivated: (index) => {
151 if (_mavlinkLogManager) _mavlinkLogManager.rating = _ratingValues[index]
153 Component.onCompleted: {
154 if (!_mavlinkLogManager) return
155 for (var i = 0; i < _ratingValues.length; i++) {
156 if (_ratingValues[i] === _mavlinkLogManager.rating) {
157 comboBox.currentIndex = i
165 Layout.fillWidth: true
166 spacing: ScreenTools.defaultFontPixelWidth
169 text: qsTr("Additional Feedback:")
170 Layout.alignment: Qt.AlignTop
175 Layout.fillWidth: true
176 Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 4
177 font.pointSize: ScreenTools.defaultFontPointSize
178 text: _mavlinkLogManager ? _mavlinkLogManager.feedback : ""
179 enabled: !_disableDataPersistence
180 color: qgcPal.textFieldText
181 background: Rectangle { color: qgcPal.textField }
185 QGCPalette { id: qgcPal }
188 Layout.fillWidth: true
189 text: qsTr("Make this log publicly available")
190 checked: _mavlinkLogManager ? _mavlinkLogManager.publicLog : false
191 enabled: !_disableDataPersistence
192 onClicked: _mavlinkLogManager.publicLog = checked
197 Layout.fillWidth: true
198 text: qsTr("Enable automatic log uploads")
199 checked: _mavlinkLogManager ? _mavlinkLogManager.enableAutoUpload : false
200 enabled: !_disableDataPersistence
202 const wantsAutoUpload = checked
204 if (wantsAutoUpload && _mavlinkLogManager && _mavlinkLogManager.emailAddress === "")
205 emptyEmailDialog.open()
210 Layout.fillWidth: true
211 text: qsTr("Delete log file after uploading")
212 checked: _mavlinkLogManager ? _mavlinkLogManager.deleteAfterUpload : false
213 enabled: autoUploadCheck.checked && !_disableDataPersistence
214 onClicked: _mavlinkLogManager.deleteAfterUpload = checked