4import Qt.labs.qmlmodels
7import QGroundControl.Controls
11 pageComponent: pageComponent
12 pageDescription: qsTr("Onboard Logs (FTP) lists log files on the vehicle's SD card via MAVLink FTP. Click Refresh to query the vehicle.")
19 height: availableHeight
22 Layout.fillWidth: true
23 Layout.fillHeight: true
24 contentWidth: gridLayout.width
25 contentHeight: gridLayout.height
29 rows: OnboardLogFtpController.model.count + 1
31 flow: GridLayout.TopToBottom
32 columnSpacing: ScreenTools.defaultFontPixelWidth
41 model: OnboardLogFtpController.model
44 Binding on checkState {
45 value: object.selected ? Qt.Checked : Qt.Unchecked
48 onClicked: object.selected = checked
52 QGCLabel { text: qsTr("Id") }
55 model: OnboardLogFtpController.model
57 QGCLabel { text: object.id }
60 QGCLabel { text: qsTr("Date") }
63 model: OnboardLogFtpController.model
67 if (!object.received) {
71 if (object.time.getUTCFullYear() < 2010) {
72 return qsTr("Date Unknown")
75 return object.time.toLocaleString(undefined)
80 QGCLabel { text: qsTr("Size") }
83 model: OnboardLogFtpController.model
85 QGCLabel { text: object.sizeStr }
88 QGCLabel { text: qsTr("Status") }
91 model: OnboardLogFtpController.model
93 QGCLabel { text: object.status }
99 spacing: ScreenTools.defaultFontPixelWidth
100 Layout.alignment: Qt.AlignTop
101 Layout.fillWidth: false
104 Layout.fillWidth: true
105 enabled: !OnboardLogFtpController.requestingList && !OnboardLogFtpController.downloadingLogs
106 text: qsTr("Refresh")
109 if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) {
110 QGroundControl.showMessageDialog(onboardLogFtpPage, qsTr("Log Refresh"), qsTr("You must be connected to a vehicle in order to download logs."))
114 OnboardLogFtpController.refresh()
119 Layout.fillWidth: true
120 enabled: !OnboardLogFtpController.requestingList && !OnboardLogFtpController.downloadingLogs
121 text: qsTr("Download")
124 var logsSelected = false
125 for (var i = 0; i < OnboardLogFtpController.model.count; i++) {
126 if (OnboardLogFtpController.model.get(i).selected) {
133 QGroundControl.showMessageDialog(onboardLogFtpPage, qsTr("Log Download"), qsTr("You must select at least one log file to download."))
137 if (ScreenTools.isMobile) {
138 OnboardLogFtpController.download()
142 fileDialog.title = qsTr("Select save directory")
143 fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath
144 fileDialog.selectFolder = true
145 fileDialog.openForLoad()
150 onAcceptedForLoad: (file) => {
151 OnboardLogFtpController.download(file)
158 Layout.fillWidth: true
160 enabled: OnboardLogFtpController.requestingList || OnboardLogFtpController.downloadingLogs
161 onClicked: OnboardLogFtpController.cancel()