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.")
18 height: availableHeight
20 Component.onCompleted: OnboardLogController.refresh()
23 Layout.fillWidth: true
24 Layout.fillHeight: true
25 contentWidth: gridLayout.width
26 contentHeight: gridLayout.height
30 rows: OnboardLogController.model.count + 1
32 flow: GridLayout.TopToBottom
33 columnSpacing: ScreenTools.defaultFontPixelWidth
36 Item { } // First column is for checkboxes, so add empty item to align headers with log entries
39 model: OnboardLogController.model
42 objectName: "onboardLogCheckbox_" + index
44 Binding on checkState {
45 value: object.selected ? Qt.Checked : Qt.Unchecked
48 onClicked: object.selected = checked
52 QGCLabel { text: qsTr("Id") }
55 model: OnboardLogController.model
57 QGCLabel { text: object.id }
60 QGCLabel { text: qsTr("Date") }
63 model: OnboardLogController.model
66 objectName: "onboardLogDate_" + index
69 if (!object.received) {
73 // getUTCFullYear() is NaN for an invalid date
74 const year = object.time.getUTCFullYear()
75 if (Number.isNaN(year) || year < 2010) {
76 return qsTr("Date Unknown")
79 return object.time.toLocaleString(undefined)
84 QGCLabel { text: qsTr("Size") }
87 model: OnboardLogController.model
89 QGCLabel { text: object.sizeStr }
92 QGCLabel { text: qsTr("Status") }
95 model: OnboardLogController.model
98 objectName: "onboardLogStatus_" + index
106 spacing: ScreenTools.defaultFontPixelWidth
107 Layout.alignment: Qt.AlignTop
108 Layout.fillWidth: false
111 objectName: "onboardLog_refreshButton"
112 Layout.fillWidth: true
113 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs
114 text: qsTr("Refresh")
117 if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) {
118 QGroundControl.showMessageDialog(onboardLogPage, qsTr("Onboard Log Refresh"), qsTr("You must be connected to a vehicle in order to download onboard logs."))
122 OnboardLogController.refresh()
127 objectName: "onboardLog_selectAllButton"
128 Layout.fillWidth: true
129 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.model.count > 0)
130 text: OnboardLogController.allLogsSelected ? qsTr("Deselect All") : qsTr("Select All")
131 onClicked: OnboardLogController.selectAll(!OnboardLogController.allLogsSelected)
135 objectName: "onboardLog_downloadButton"
136 Layout.fillWidth: true
137 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.selectedCount > 0)
138 text: qsTr("Download")
141 if (ScreenTools.isMobile) {
142 OnboardLogController.download()
146 fileDialog.title = qsTr("Select save directory")
147 fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath
148 fileDialog.selectFolder = true
149 fileDialog.openForLoad()
154 onAcceptedForLoad: (file) => {
155 OnboardLogController.download(file)
162 objectName: "onboardLog_sortButton"
163 Layout.fillWidth: true
164 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.model.count > 1)
165 text: OnboardLogController.sortAscending ? qsTr("Sort Descending") : qsTr("Sort Ascending")
166 onClicked: OnboardLogController.toggleSortByDate()
170 objectName: "onboardLog_eraseSelectedButton"
171 Layout.fillWidth: true
172 visible: OnboardLogController.transport === "ftp"
173 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.selectedCount > 0)
174 text: qsTr("Erase Selected")
175 onClicked: QGroundControl.showMessageDialog(
177 qsTr("Delete Selected Onboard Log Files"),
178 qsTr("The selected onboard log files will be erased permanently. Is this really what you want?"),
179 Dialog.Yes | Dialog.No,
180 function() { OnboardLogController.eraseSelected() }
185 objectName: "onboardLog_eraseAllButton"
186 Layout.fillWidth: true
187 enabled: !OnboardLogController.requestingList && !OnboardLogController.downloadingLogs && (OnboardLogController.model.count > 0)
188 text: qsTr("Erase All")
189 onClicked: QGroundControl.showMessageDialog(
191 qsTr("Delete All Onboard Log Files"),
192 qsTr("All onboard log files will be erased permanently. Is this really what you want?"),
193 Dialog.Yes | Dialog.No,
194 function() { OnboardLogController.eraseAll() }
199 objectName: "onboardLog_cancelButton"
200 Layout.fillWidth: true
202 enabled: OnboardLogController.requestingList || OnboardLogController.downloadingLogs
203 onClicked: OnboardLogController.cancel()