QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
OnboardLogFtpPage.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4import Qt.labs.qmlmodels
5
6import QGroundControl
7import QGroundControl.Controls
8
9AnalyzePage {
10 id: onboardLogFtpPage
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.")
13
14 Component {
15 id: pageComponent
16
17 RowLayout {
18 width: availableWidth
19 height: availableHeight
20
21 QGCFlickable {
22 Layout.fillWidth: true
23 Layout.fillHeight: true
24 contentWidth: gridLayout.width
25 contentHeight: gridLayout.height
26
27 GridLayout {
28 id: gridLayout
29 rows: OnboardLogFtpController.model.count + 1
30 columns: 5
31 flow: GridLayout.TopToBottom
32 columnSpacing: ScreenTools.defaultFontPixelWidth
33 rowSpacing: 0
34
35 QGCCheckBox {
36 id: headerCheckBox
37 enabled: false
38 }
39
40 Repeater {
41 model: OnboardLogFtpController.model
42
43 QGCCheckBox {
44 Binding on checkState {
45 value: object.selected ? Qt.Checked : Qt.Unchecked
46 }
47
48 onClicked: object.selected = checked
49 }
50 }
51
52 QGCLabel { text: qsTr("Id") }
53
54 Repeater {
55 model: OnboardLogFtpController.model
56
57 QGCLabel { text: object.id }
58 }
59
60 QGCLabel { text: qsTr("Date") }
61
62 Repeater {
63 model: OnboardLogFtpController.model
64
65 QGCLabel {
66 text: {
67 if (!object.received) {
68 return ""
69 }
70
71 if (object.time.getUTCFullYear() < 2010) {
72 return qsTr("Date Unknown")
73 }
74
75 return object.time.toLocaleString(undefined)
76 }
77 }
78 }
79
80 QGCLabel { text: qsTr("Size") }
81
82 Repeater {
83 model: OnboardLogFtpController.model
84
85 QGCLabel { text: object.sizeStr }
86 }
87
88 QGCLabel { text: qsTr("Status") }
89
90 Repeater {
91 model: OnboardLogFtpController.model
92
93 QGCLabel { text: object.status }
94 }
95 }
96 }
97
98 ColumnLayout {
99 spacing: ScreenTools.defaultFontPixelWidth
100 Layout.alignment: Qt.AlignTop
101 Layout.fillWidth: false
102
103 QGCButton {
104 Layout.fillWidth: true
105 enabled: !OnboardLogFtpController.requestingList && !OnboardLogFtpController.downloadingLogs
106 text: qsTr("Refresh")
107
108 onClicked: {
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."))
111 return
112 }
113
114 OnboardLogFtpController.refresh()
115 }
116 }
117
118 QGCButton {
119 Layout.fillWidth: true
120 enabled: !OnboardLogFtpController.requestingList && !OnboardLogFtpController.downloadingLogs
121 text: qsTr("Download")
122
123 onClicked: {
124 var logsSelected = false
125 for (var i = 0; i < OnboardLogFtpController.model.count; i++) {
126 if (OnboardLogFtpController.model.get(i).selected) {
127 logsSelected = true
128 break
129 }
130 }
131
132 if (!logsSelected) {
133 QGroundControl.showMessageDialog(onboardLogFtpPage, qsTr("Log Download"), qsTr("You must select at least one log file to download."))
134 return
135 }
136
137 if (ScreenTools.isMobile) {
138 OnboardLogFtpController.download()
139 return
140 }
141
142 fileDialog.title = qsTr("Select save directory")
143 fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath
144 fileDialog.selectFolder = true
145 fileDialog.openForLoad()
146 }
147
148 QGCFileDialog {
149 id: fileDialog
150 onAcceptedForLoad: (file) => {
151 OnboardLogFtpController.download(file)
152 close()
153 }
154 }
155 }
156
157 QGCButton {
158 Layout.fillWidth: true
159 text: qsTr("Cancel")
160 enabled: OnboardLogFtpController.requestingList || OnboardLogFtpController.downloadingLogs
161 onClicked: OnboardLogFtpController.cancel()
162 }
163 }
164 }
165 }
166}