6import QGroundControl.Controls
10 pageComponent: pageComponent
11 pageDescription: qsTr("Onboard Logs allows you to download binary log files from your vehicle. Click Refresh to get list of available logs.")
13 function _updateNavigationBlocked() {
14 if (OnboardLogController.downloadingLogs) {
15 globals.navigationBlockedReason = qsTr("Wait for the log download to complete or cancel it first")
17 globals.navigationBlockedReason = ""
22 target: OnboardLogController
23 function onDownloadingLogsChanged() { onboardLogPage._updateNavigationBlocked() }
26 Component.onCompleted: _updateNavigationBlocked()
27 Component.onDestruction: globals.navigationBlockedReason = ""
34 height: availableHeight
36 Component.onCompleted: OnboardLogController.refresh()
39 Layout.fillWidth: true
40 Layout.fillHeight: true
41 contentWidth: gridLayout.width
42 contentHeight: gridLayout.height
46 rows: OnboardLogController.model.count + 1
48 flow: GridLayout.TopToBottom
49 columnSpacing: ScreenTools.defaultFontPixelWidth
52 Item { } // First column is for checkboxes, so add empty item to align headers with log entries
55 model: OnboardLogController.model
58 objectName: "onboardLogCheckbox_" + index
60 Binding on checkState {
61 value: object.selected ? Qt.Checked : Qt.Unchecked
64 onClicked: object.selected = checked
68 QGCLabel { text: qsTr("Id") }
71 model: OnboardLogController.model
73 QGCLabel { text: object.id }
76 QGCLabel { text: qsTr("Date") }
79 model: OnboardLogController.model
82 objectName: "onboardLogDate_" + index
85 if (!object.received) {
89 // getUTCFullYear() is NaN for an invalid date
90 const year = object.time.getUTCFullYear()
91 if (Number.isNaN(year) || year < 2010) {
92 return qsTr("Date Unknown")
95 return object.time.toLocaleString(undefined)
100 QGCLabel { text: qsTr("Size") }
103 model: OnboardLogController.model
105 QGCLabel { text: object.sizeStr }
108 QGCLabel { text: qsTr("Status") }
111 model: OnboardLogController.model
114 objectName: "onboardLogStatus_" + index
122 spacing: ScreenTools.defaultFontPixelWidth
123 Layout.alignment: Qt.AlignTop
124 Layout.fillWidth: false
127 objectName: "onboardLog_refreshButton"
128 Layout.fillWidth: true
129 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs
130 text: qsTr("Refresh")
133 if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) {
134 QGroundControl.showMessageDialog(onboardLogPage, qsTr("Onboard Log Refresh"), qsTr("You must be connected to a vehicle in order to download onboard logs."))
138 OnboardLogController.refresh()
143 objectName: "onboardLog_selectAllButton"
144 Layout.fillWidth: true
145 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.model.count > 0)
146 text: OnboardLogController.allLogsSelected ? qsTr("Deselect All") : qsTr("Select All")
147 onClicked: OnboardLogController.selectAll(!OnboardLogController.allLogsSelected)
151 objectName: "onboardLog_downloadButton"
152 Layout.fillWidth: true
153 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.selectedCount > 0)
154 text: qsTr("Download")
157 if (ScreenTools.isMobile) {
158 OnboardLogController.download()
162 fileDialog.title = qsTr("Select save directory")
163 fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath
164 fileDialog.selectFolder = true
165 fileDialog.openForLoad()
170 onAcceptedForLoad: (file) => {
171 OnboardLogController.download(file)
178 objectName: "onboardLog_sortButton"
179 Layout.fillWidth: true
180 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.model.count > 1)
181 text: OnboardLogController.sortAscending ? qsTr("Sort Descending") : qsTr("Sort Ascending")
182 onClicked: OnboardLogController.toggleSortByDate()
186 objectName: "onboardLog_eraseSelectedButton"
187 Layout.fillWidth: true
188 visible: OnboardLogController.transport === "ftp"
189 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.selectedCount > 0)
190 text: qsTr("Erase Selected")
191 onClicked: QGroundControl.showMessageDialog(
193 qsTr("Delete Selected Onboard Log Files"),
194 qsTr("The selected onboard log files will be erased permanently. Is this really what you want?"),
195 Dialog.Yes | Dialog.No,
196 function() { OnboardLogController.eraseSelected() }
201 objectName: "onboardLog_eraseAllButton"
202 Layout.fillWidth: true
203 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.model.count > 0)
204 text: qsTr("Erase All")
205 onClicked: QGroundControl.showMessageDialog(
207 qsTr("Delete All Onboard Log Files"),
208 qsTr("All onboard log files will be erased permanently. Is this really what you want?"),
209 Dialog.Yes | Dialog.No,
210 function() { OnboardLogController.eraseAll() }
215 objectName: "onboardLog_cancelButton"
216 Layout.fillWidth: true
218 enabled: OnboardLogController.requestingList || OnboardLogController.downloadingLogs
219 onClicked: OnboardLogController.cancel()