QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
LogReplayStatusBar.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4import QtQuick.Dialogs
5
6import QGroundControl
7import QGroundControl.Controls
8
9Rectangle {
10 id: _root
11 height: visible ? (rowLayout.height + (_margins * 2)) : 0
12 color: qgcPal.window
13
14 property real _margins: ScreenTools.defaultFontPixelHeight / 4
15 property var _logReplayLink: null
16
17 function pickLogFile() {
18 if (globals.activeVehicle) {
19 QGroundControl.showMessageDialog(_root, qsTr("Log Replay"), qsTr("You must close all connections prior to replaying a log."))
20 return
21 }
22
23 filePicker.openForLoad()
24 }
25
26 QGCPalette { id: qgcPal }
27
28 QGCFileDialog {
29 id: filePicker
30 title: qsTr("Select Telemetery Log")
31 nameFilters: [ qsTr("Telemetry Logs (*.%1)").arg(_logFileExtension), qsTr("All Files (*)") ]
32 folder: QGroundControl.settingsManager.appSettings.telemetrySavePath
33 onAcceptedForLoad: (file) => {
34 controller.link = QGroundControl.linkManager.startLogReplay(file)
35 close()
36 }
37
38 property string _logFileExtension: QGroundControl.settingsManager.appSettings.telemetryFileExtension
39 }
40
41 LogReplayLinkController {
42 id: controller
43
44 onPercentCompleteChanged: (percentComplete) => slider.updatePercentComplete(percentComplete)
45 }
46
47 RowLayout {
48 id: rowLayout
49 anchors {
50 margins: _margins
51 top: parent.top
52 left: parent.left
53 right: parent.right
54 }
55
56 QGCButton {
57 enabled: controller.link
58 text: controller.isPlaying ? qsTr("Pause") : qsTr("Play")
59 onClicked: controller.isPlaying = !controller.isPlaying
60 }
61
62 QGCComboBox {
63 textRole: "text"
64 currentIndex: 3
65
66 model: ListModel {
67 ListElement { text: "0.1"; value: 0.1 }
68 ListElement { text: "0.25"; value: 0.25 }
69 ListElement { text: "0.5"; value: 0.5 }
70 ListElement { text: "1x"; value: 1 }
71 ListElement { text: "2x"; value: 2 }
72 ListElement { text: "5x"; value: 5 }
73 ListElement { text: "10x"; value: 10 }
74 }
75
76 onActivated: (index) => { controller.playbackSpeed = model.get(currentIndex).value }
77 }
78
79 QGCLabel { text: controller.playheadTime }
80
81 Slider {
82 id: slider
83 Layout.fillWidth: true
84 from: 0
85 to: 100
86 enabled: controller.link
87
88 property bool manualUpdate: false
89
90 function updatePercentComplete(percentComplete) {
91 manualUpdate = true
92 value = percentComplete
93 manualUpdate = false
94 }
95
96 onValueChanged: {
97 if (!manualUpdate) {
98 controller.percentComplete = value
99 }
100 }
101 }
102
103 QGCLabel { text: controller.totalTime }
104
105 QGCButton {
106 text: qsTr("Load Telemetry Log")
107 onClicked: pickLogFile()
108 visible: !controller.link
109 }
110
111 QGCButton {
112 text: qsTr("Close")
113 onClicked: {
114 var activeVehicle = QGroundControl.multiVehicleManager.activeVehicle
115 if (activeVehicle) {
116 activeVehicle.closeVehicle()
117 }
118 QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar.rawValue = false
119 }
120 }
121 }
122}