2013-11-21 12:10:06 +01:00
|
|
|
import QtQuick 2.1
|
2013-11-20 12:24:34 +01:00
|
|
|
import QtQuick.Controls 1.0
|
2013-11-20 16:24:57 +01:00
|
|
|
import QtQuick.Layouts 1.0
|
|
|
|
|
|
|
|
import org.openpilot 1.0
|
2013-11-20 12:24:34 +01:00
|
|
|
|
2013-11-25 17:58:29 +01:00
|
|
|
import "functions.js" as Functions
|
|
|
|
|
2013-11-20 12:24:34 +01:00
|
|
|
Rectangle {
|
2013-11-20 16:24:57 +01:00
|
|
|
width: 600
|
|
|
|
height: 400
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2013-11-20 21:08:26 +01:00
|
|
|
anchors.margins: 10
|
2013-11-20 16:24:57 +01:00
|
|
|
spacing: 10
|
2013-11-21 18:07:48 +01:00
|
|
|
Rectangle {
|
2013-11-21 12:10:06 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2013-11-21 18:07:48 +01:00
|
|
|
border.width: 1
|
|
|
|
radius: 4
|
2013-11-20 16:56:43 +01:00
|
|
|
ColumnLayout {
|
2014-03-06 00:41:48 +01:00
|
|
|
id: exportTab
|
2013-11-21 18:07:48 +01:00
|
|
|
anchors.margins: 10
|
|
|
|
anchors.fill: parent
|
2014-03-06 00:41:48 +01:00
|
|
|
visible: true
|
2013-11-20 16:56:43 +01:00
|
|
|
Text {
|
2013-11-21 18:07:48 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
text: "<b>" + qsTr("Log entries") + "</b>"
|
2013-11-20 16:56:43 +01:00
|
|
|
}
|
2013-11-21 18:07:48 +01:00
|
|
|
TableView {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2014-02-26 14:44:45 +01:00
|
|
|
Layout.preferredHeight: 1000;
|
2013-11-21 18:07:48 +01:00
|
|
|
model: logManager.logEntries
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
2013-11-25 14:59:23 +01:00
|
|
|
|
2014-03-06 23:30:55 +01:00
|
|
|
rowDelegate: Rectangle {
|
|
|
|
height: 22
|
|
|
|
color: styleData.selected ? "#ccc" : (styleData.alternate ? "#fff" : "#eee")
|
|
|
|
}
|
|
|
|
|
2013-11-25 14:59:23 +01:00
|
|
|
itemDelegate: Text {
|
2014-03-06 23:30:55 +01:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2013-11-25 14:59:23 +01:00
|
|
|
text: styleData.value
|
|
|
|
}
|
|
|
|
|
|
|
|
TableViewColumn {
|
|
|
|
role: "Flight"; title: qsTr("Flight"); width: 50;
|
|
|
|
delegate:
|
|
|
|
Text {
|
2014-03-06 23:30:55 +01:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2013-11-25 14:59:23 +01:00
|
|
|
text: styleData.value + 1
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
TableViewColumn {
|
2014-03-06 23:30:55 +01:00
|
|
|
role: "FlightTime"; title: qsTr("Time"); width: 100;
|
2013-11-25 17:58:29 +01:00
|
|
|
delegate:
|
|
|
|
Text {
|
2014-03-06 23:30:55 +01:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2013-11-25 17:58:29 +01:00
|
|
|
text: Functions.millisToTime(styleData.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TableViewColumn {
|
2014-03-06 23:30:55 +01:00
|
|
|
role: "Type"; title: "Type"; width: 60;
|
2013-11-25 14:59:23 +01:00
|
|
|
delegate:
|
|
|
|
Text {
|
2014-03-06 23:30:55 +01:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2013-11-25 14:59:23 +01:00
|
|
|
text: {
|
|
|
|
switch(styleData.value) {
|
|
|
|
case 0 : text: qsTr("Empty"); break;
|
|
|
|
case 1 : text: qsTr("Text"); break;
|
|
|
|
case 2 : text: qsTr("UAVO"); break;
|
|
|
|
default: text: qsTr("Unknown"); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-03-06 23:30:55 +01:00
|
|
|
TableViewColumn {
|
|
|
|
role: "LogString";
|
|
|
|
title: qsTr("Data");
|
|
|
|
width: 280
|
|
|
|
}
|
2013-11-20 16:56:43 +01:00
|
|
|
}
|
2013-11-21 18:07:48 +01:00
|
|
|
|
2013-11-21 12:10:06 +01:00
|
|
|
RowLayout {
|
2013-11-21 18:07:48 +01:00
|
|
|
anchors.margins: 10
|
|
|
|
spacing: 10
|
2014-02-26 14:44:45 +01:00
|
|
|
|
2013-11-21 18:07:48 +01:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 10
|
|
|
|
Text {
|
|
|
|
id: totalFlights
|
|
|
|
text: "<b>" + qsTr("Flights recorded: ") + "</b>" + (logStatus.Flight + 1)
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
id: totalEntries
|
|
|
|
text: "<b>" + qsTr("Entries logged (free): ") + "</b>" +
|
|
|
|
logStatus.UsedSlots + " (" + logStatus.FreeSlots + ")"
|
|
|
|
}
|
2014-02-26 14:44:45 +01:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: exportRelativeTimeCB
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected
|
2014-02-26 14:44:45 +01:00
|
|
|
text: qsTr("Adjust timestamps")
|
|
|
|
activeFocusOnPress: true
|
|
|
|
checked: logManager.adjustExportedTimestamps
|
|
|
|
onCheckedChanged: logManager.setAdjustExportedTimestamps(checked)
|
|
|
|
}
|
2013-11-21 18:07:48 +01:00
|
|
|
}
|
2013-11-21 12:10:06 +01:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2013-11-21 18:07:48 +01:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 10
|
|
|
|
RowLayout {
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: "<b>" + qsTr("Flight to download:") + "</b>"
|
|
|
|
}
|
2013-11-20 16:24:57 +01:00
|
|
|
|
2013-11-21 18:07:48 +01:00
|
|
|
ComboBox {
|
|
|
|
id: flightCombo
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
2013-11-26 22:52:24 +01:00
|
|
|
model: logManager.flightEntries
|
2013-11-21 18:07:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
2014-02-26 14:44:45 +01:00
|
|
|
spacing: 10
|
2013-11-21 18:07:48 +01:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: qsTr("Download logs")
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
2013-11-21 18:07:48 +01:00
|
|
|
activeFocusOnPress: true
|
|
|
|
onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
|
2013-11-21 12:10:06 +01:00
|
|
|
}
|
|
|
|
}
|
2014-02-26 14:44:45 +01:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2014-02-26 15:56:20 +01:00
|
|
|
Button {
|
|
|
|
id: clearButton
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
2014-02-26 15:56:20 +01:00
|
|
|
text: qsTr("Clear all logs")
|
|
|
|
activeFocusOnPress: true
|
|
|
|
onClicked: logManager.clearAllLogs()
|
|
|
|
}
|
2014-02-26 14:44:45 +01:00
|
|
|
Button {
|
|
|
|
id: exportButton
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected
|
2014-02-26 14:44:45 +01:00
|
|
|
text: qsTr("Export logs...")
|
|
|
|
activeFocusOnPress: true
|
|
|
|
onClicked: logManager.exportLogs()
|
|
|
|
}
|
|
|
|
}
|
2013-11-21 12:10:06 +01:00
|
|
|
}
|
2013-11-20 16:24:57 +01:00
|
|
|
}
|
|
|
|
}
|
2014-03-06 00:41:48 +01:00
|
|
|
ColumnLayout {
|
|
|
|
id: settingsTab
|
|
|
|
visible: false
|
|
|
|
anchors.margins: 10
|
|
|
|
anchors.fill: parent
|
|
|
|
Text {
|
|
|
|
Layout.fillWidth: true
|
2014-03-08 13:47:41 +01:00
|
|
|
text: "<b>" + qsTr("Settings") + "</b>"
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Text {
|
|
|
|
text: qsTr("When to log: ")
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
|
|
|
model: logManager.logStatuses
|
|
|
|
currentIndex: logSettings.getLoggingEnabled()
|
|
|
|
}
|
|
|
|
|
2014-03-06 00:41:48 +01:00
|
|
|
}
|
2014-03-07 18:06:50 +01:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: comboEditableDelegate
|
|
|
|
Item {
|
|
|
|
|
|
|
|
Text {
|
|
|
|
width: parent.width
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
elide: styleData.elideMode
|
|
|
|
text: styleData.value !== undefined ? logManager.logSettings[styleData.value] : ""
|
|
|
|
color: styleData.textColor
|
|
|
|
visible: !styleData.selected
|
|
|
|
}
|
|
|
|
Loader {
|
|
|
|
id: loaderEditor
|
|
|
|
anchors.fill: parent
|
|
|
|
Connections {
|
|
|
|
target: loaderEditor.item
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
logManager.uavoEntries[styleData.row].setting = loaderEditor.item.currentIndex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sourceComponent: styleData.selected ? editor : null
|
|
|
|
Component {
|
|
|
|
id: editor
|
|
|
|
ComboBox {
|
|
|
|
id: combo
|
|
|
|
model: logManager.logSettings
|
|
|
|
currentIndex: styleData.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-08 17:28:46 +01:00
|
|
|
Component {
|
|
|
|
id: spinnerEditableDelegate
|
|
|
|
Item {
|
|
|
|
|
|
|
|
Text {
|
|
|
|
width: parent.width
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
elide: styleData.elideMode
|
|
|
|
text: styleData.value !== undefined && (logManager.uavoEntries[styleData.row].setting > 1) ?
|
|
|
|
parseInt(logManager.uavoEntries[styleData.row].period) + " ms" : "-"
|
|
|
|
color: styleData.textColor
|
|
|
|
//visible: !styleData.selected && (logManager.uavoEntries[styleData.row].setting <= 1)
|
|
|
|
enabled: (logManager.uavoEntries[styleData.row].setting > 1)
|
|
|
|
}
|
|
|
|
Loader {
|
|
|
|
id: loaderEditor
|
|
|
|
anchors.fill: parent
|
|
|
|
Connections {
|
|
|
|
target: loaderEditor.item
|
|
|
|
onValueChanged: {
|
|
|
|
logManager.uavoEntries[styleData.row].period = loaderEditor.item.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sourceComponent: styleData.selected && (logManager.uavoEntries[styleData.row].setting > 1) ? editor : null
|
|
|
|
Component {
|
|
|
|
id: editor
|
|
|
|
SpinBox {
|
|
|
|
id: spinner
|
|
|
|
decimals: 0
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 1000 * 60 * 60 //1h
|
|
|
|
suffix: "ms"
|
|
|
|
stepSize: 10
|
|
|
|
value: styleData.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-06 00:41:48 +01:00
|
|
|
TableView {
|
2014-03-07 18:06:50 +01:00
|
|
|
id: settingsTable
|
2014-03-06 00:41:48 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.preferredHeight: 1000;
|
|
|
|
model: logManager.uavoEntries
|
2014-03-08 12:14:19 +01:00
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
2014-03-06 00:41:48 +01:00
|
|
|
|
2014-03-06 23:30:55 +01:00
|
|
|
rowDelegate: Rectangle {
|
|
|
|
height: 22
|
|
|
|
color: styleData.selected ? "#ccc" : (styleData.alternate ? "#fff" : "#eee")
|
|
|
|
}
|
|
|
|
|
2014-03-06 00:41:48 +01:00
|
|
|
TableViewColumn {
|
2014-03-06 23:30:55 +01:00
|
|
|
role: "name";
|
2014-03-06 00:41:48 +01:00
|
|
|
title: qsTr("UAVObject");
|
2014-03-08 17:28:46 +01:00
|
|
|
width: 250;
|
2014-03-06 00:41:48 +01:00
|
|
|
delegate:
|
|
|
|
Text {
|
2014-03-06 23:30:55 +01:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2014-03-06 00:41:48 +01:00
|
|
|
anchors.leftMargin: 5
|
|
|
|
text: styleData.value
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-03-06 23:30:55 +01:00
|
|
|
|
2014-03-06 00:41:48 +01:00
|
|
|
TableViewColumn {
|
2014-03-06 23:30:55 +01:00
|
|
|
role: "setting";
|
|
|
|
title: qsTr("Settings");
|
2014-03-08 17:28:46 +01:00
|
|
|
width: 160;
|
2014-03-07 18:06:50 +01:00
|
|
|
delegate: comboEditableDelegate
|
2014-03-06 00:41:48 +01:00
|
|
|
}
|
2014-03-08 17:28:46 +01:00
|
|
|
|
|
|
|
TableViewColumn {
|
|
|
|
role: "period";
|
|
|
|
title: qsTr("Period");
|
|
|
|
width: 120;
|
|
|
|
delegate: spinnerEditableDelegate
|
|
|
|
}
|
2014-03-06 00:41:48 +01:00
|
|
|
}
|
2014-03-08 13:47:41 +01:00
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
Button {
|
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
|
|
|
text: qsTr("Load...")
|
|
|
|
activeFocusOnPress: true
|
2014-03-08 17:28:46 +01:00
|
|
|
onClicked: logManager.loadSettings()
|
2014-03-08 13:47:41 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
|
|
|
text: qsTr("Save...")
|
|
|
|
activeFocusOnPress: true
|
2014-03-08 17:28:46 +01:00
|
|
|
onClicked: logManager.saveSettings()
|
2014-03-08 13:47:41 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
|
|
|
text: qsTr("Reset")
|
|
|
|
activeFocusOnPress: true
|
2014-03-08 17:28:46 +01:00
|
|
|
onClicked: logManager.resetSettings()
|
2014-03-08 13:47:41 +01:00
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
|
|
|
text: qsTr("Apply to board")
|
|
|
|
activeFocusOnPress: true
|
2014-03-08 17:28:46 +01:00
|
|
|
onClicked: logManager.applySettingsToBoard()
|
2014-03-08 13:47:41 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
enabled: !logManager.disableControls && logManager.boardConnected
|
|
|
|
text: qsTr("Save to board")
|
|
|
|
activeFocusOnPress: true
|
2014-03-08 17:28:46 +01:00
|
|
|
onClicked: logManager.saveSettingsToBoard()
|
2014-03-08 13:47:41 +01:00
|
|
|
}
|
|
|
|
}
|
2014-03-06 00:41:48 +01:00
|
|
|
}
|
2013-11-20 16:24:57 +01:00
|
|
|
}
|
|
|
|
|
2013-11-20 21:08:26 +01:00
|
|
|
RowLayout {
|
2013-11-20 16:24:57 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 40
|
2014-03-06 00:41:48 +01:00
|
|
|
Button {
|
|
|
|
id: settingsButton
|
|
|
|
enabled: !logManager.disableControls
|
2014-03-08 13:47:41 +01:00
|
|
|
text: qsTr("Settings...")
|
2014-03-06 00:41:48 +01:00
|
|
|
activeFocusOnPress: true
|
|
|
|
property bool showSettings: false
|
|
|
|
onClicked: {
|
|
|
|
showSettings = !showSettings;
|
|
|
|
settingsTab.visible = showSettings;
|
|
|
|
exportTab.visible = !showSettings;
|
2014-03-08 13:47:41 +01:00
|
|
|
text = (showSettings ? qsTr("Logs...") : qsTr("Settings..."));
|
2014-03-06 00:41:48 +01:00
|
|
|
}
|
|
|
|
}
|
2013-11-20 21:08:26 +01:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2013-11-30 13:02:52 +01:00
|
|
|
Button {
|
|
|
|
id: cancelButton
|
|
|
|
enabled: logManager.disableControls
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
activeFocusOnPress: true
|
|
|
|
onClicked: logManager.cancelExportLogs()
|
|
|
|
}
|
2013-11-20 21:08:26 +01:00
|
|
|
Button {
|
|
|
|
id: okButton
|
2013-11-26 17:00:01 +01:00
|
|
|
enabled: !logManager.disableControls
|
2013-11-20 16:24:57 +01:00
|
|
|
text: qsTr("OK")
|
2013-11-30 13:02:52 +01:00
|
|
|
isDefault: true
|
2013-11-20 21:08:26 +01:00
|
|
|
activeFocusOnPress: true
|
2013-11-20 16:24:57 +01:00
|
|
|
onClicked: dialog.close()
|
|
|
|
}
|
|
|
|
}
|
2013-11-20 12:24:34 +01:00
|
|
|
}
|
|
|
|
}
|