2 import QtQuick.Controls 1.0
3 import QtQuick.Layouts 1.0
5 import org.openpilot 1.0
7 import "functions.js" as Functions
18 Layout.fillWidth: true
19 Layout.fillHeight: true
28 Layout.fillWidth: true
29 text: "<b>" + qsTr("Log entries") + "</b>"
32 Layout.fillWidth: true
33 Layout.fillHeight: true
34 Layout.preferredHeight: 1000;
35 model: logManager.logEntries
36 enabled: !logManager.disableControls && logManager.boardConnected
38 rowDelegate: Rectangle {
40 color: styleData.selected ? "#ccc" : (styleData.alternate ? "#fff" : "#eee")
44 verticalAlignment: Text.AlignVCenter
49 role: "Flight"; title: qsTr("Flight"); width: 50;
52 verticalAlignment: Text.AlignVCenter
53 text: styleData.value + 1
58 role: "FlightTime"; title: qsTr("Time"); width: 100;
61 verticalAlignment: Text.AlignVCenter
62 text: Functions.microsToTime(styleData.value)
66 role: "Type"; title: "Type"; width: 50;
69 verticalAlignment: Text.AlignVCenter
71 switch(styleData.value) {
72 case 0 : text: qsTr("Empty"); break;
73 case 1 : text: qsTr("Text"); break;
74 case 2 : text: qsTr("UAVO"); break;
75 case 3 : text: qsTr("UAVO(P)"); break;
76 default: text: qsTr("Unknown"); break;
97 text: "<b>" + qsTr("Flights recorded:") + "</b> " + (logStatus.Flight + 1)
101 text: "<b>" + qsTr("Slots used/free:") + "</b> " +
102 logStatus.UsedSlots + "/" + logStatus.FreeSlots
106 text: "<b>" + qsTr("Entries downloaded:") + "</b> " + logManager.logEntriesCount
109 Layout.fillHeight: true
112 id: exportRelativeTimeCB
113 enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected
114 text: qsTr("Adjust timestamps")
115 activeFocusOnPress: true
116 checked: logManager.adjustExportedTimestamps
117 onCheckedChanged: logManager.setAdjustExportedTimestamps(checked)
121 Layout.fillWidth: true
127 Layout.fillWidth: true
130 text: "<b>" + qsTr("Flight to download:") + "</b>"
135 enabled: !logManager.disableControls && logManager.boardConnected
136 model: logManager.flightEntries
142 Layout.fillWidth: true
145 text: qsTr("Download logs")
146 enabled: !logManager.disableControls && logManager.boardConnected
147 activeFocusOnPress: true
148 onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
152 Layout.fillHeight: true
156 Layout.fillWidth: true
160 enabled: !logManager.disableControls && logManager.boardConnected
161 text: qsTr("Clear all logs")
162 activeFocusOnPress: true
163 onClicked: logManager.clearAllLogs()
167 enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected
168 text: qsTr("Export logs...")
169 activeFocusOnPress: true
170 onClicked: logManager.exportLogs()
182 Layout.fillWidth: true
183 text: "<b>" + qsTr("Settings") + "</b>"
187 Layout.fillWidth: true
188 Layout.fillHeight: true
190 text: qsTr("When to log: ")
193 enabled: !logManager.disableControls && logManager.boardConnected
194 model: logManager.logStatuses
195 Layout.preferredWidth: 200
196 currentIndex: logManager.loggingEnabled
197 onCurrentIndexChanged: {
198 logManager.setLoggingEnabled(currentIndex);
205 id: comboEditableDelegate
210 anchors.left: parent.left
211 anchors.verticalCenter: parent.verticalCenter
212 elide: styleData.elideMode
213 text: styleData.value !== undefined ? logManager.logSettings[styleData.value] : ""
214 color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : styleData.textColor
215 visible: !styleData.selected
221 target: loaderEditor.item
222 onCurrentIndexChanged: {
223 logManager.uavoEntries[styleData.row].setting = loaderEditor.item.currentIndex
226 sourceComponent: styleData.selected ? editor : null
231 model: logManager.logSettings
232 currentIndex: styleData.value
240 id: spinnerEditableDelegate
245 anchors.left: parent.left
246 anchors.verticalCenter: parent.verticalCenter
247 elide: styleData.elideMode
248 text: styleData.value !== undefined &&
249 (logManager.uavoEntries[styleData.row].setting === 1 || logManager.uavoEntries[styleData.row].setting === 3) ?
250 parseInt(logManager.uavoEntries[styleData.row].period) + " ms" : "-"
251 color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : styleData.textColor
252 //visible: !styleData.selected && (logManager.uavoEntries[styleData.row].setting <= 1)
253 enabled: (logManager.uavoEntries[styleData.row].setting > 1)
259 target: loaderEditor.item
261 logManager.uavoEntries[styleData.row].period = loaderEditor.item.value
264 sourceComponent: styleData.selected &&
265 (logManager.uavoEntries[styleData.row].setting === 1 || logManager.uavoEntries[styleData.row].setting === 3) ? editor : null
272 maximumValue: 1000 * 60 * 60 //1h
275 value: styleData.value
284 Layout.fillWidth: true
285 Layout.fillHeight: true
286 Layout.preferredHeight: 1000;
287 model: logManager.uavoEntries
288 enabled: !logManager.disableControls && logManager.boardConnected
290 rowDelegate: Rectangle {
292 color: styleData.selected ? "#ccc" : (styleData.alternate ? "#fff" : "#eee")
297 title: qsTr("UAVObject");
301 verticalAlignment: Text.AlignVCenter
302 anchors.leftMargin: 5
303 color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : styleData.textColor
304 text: styleData.value
311 title: qsTr("Settings");
313 delegate: comboEditableDelegate
318 title: qsTr("Period");
320 delegate: spinnerEditableDelegate
324 Layout.fillWidth: true
325 Layout.fillHeight: true
328 enabled: !logManager.disableControls && logManager.boardConnected
329 text: qsTr("Load...")
330 tooltip: qsTr("Loads settings for all objects from a file.")
331 activeFocusOnPress: true
332 onClicked: logManager.loadSettings()
335 enabled: !logManager.disableControls && logManager.boardConnected
336 text: qsTr("Save...")
337 tooltip: qsTr("Saves settings for all objects in a file.")
338 activeFocusOnPress: true
339 onClicked: logManager.saveSettings()
342 enabled: !logManager.disableControls && logManager.boardConnected
344 tooltip: qsTr("Resets all settings to the values currently set on the board.")
345 activeFocusOnPress: true
346 onClicked: logManager.resetSettings(false)
349 enabled: !logManager.disableControls && logManager.boardConnected
351 tooltip: qsTr("Clears all settings to default values.")
352 activeFocusOnPress: true
353 onClicked: logManager.resetSettings(true)
356 Layout.fillWidth: true
359 enabled: !logManager.disableControls && logManager.boardConnected
360 text: qsTr("Save to board")
361 tooltip: qsTr("Saves the logging configurations to the boards flash memory.")
362 activeFocusOnPress: true
363 onClicked: logManager.saveSettingsToBoard()
370 Layout.fillWidth: true
374 enabled: !logManager.disableControls
375 text: qsTr("Settings...")
376 activeFocusOnPress: true
377 property bool showSettings: false
379 showSettings = !showSettings;
380 settingsTab.visible = showSettings;
381 exportTab.visible = !showSettings;
382 text = (showSettings ? qsTr("Logs...") : qsTr("Settings..."));
386 Layout.fillWidth: true
390 enabled: logManager.disableControls
392 activeFocusOnPress: true
393 onClicked: logManager.cancelExportLogs()
397 enabled: !logManager.disableControls
400 activeFocusOnPress: true
401 onClicked: logDialog.close()