Newer
Older
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.Palette 1.0
Rectangle {
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 28
property real _valueWidth: ScreenTools.defaultFontPixelWidth * 24
property int _selectedCount: 0
property real _columnSpacing: ScreenTools.defaultFontPixelHeight * 0.25
property bool _uploadedSelected: false
Connections {
target: QGroundControl.mavlinkLogManager
onSelectedCountChanged: {
var selected = 0
for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
//-- If an uploaded file is selected, disable "Upload" button
if(logFile.uploaded) {
_uploadedSelected = true
}
}
function saveItems()
{
QGroundControl.mavlinkSystemID = parseInt(sysidField.text)
QGroundControl.mavlinkLogManager.videoURL = videoUrlField.text
QGroundControl.mavlinkLogManager.feedback = feedbackTextArea.text
QGroundControl.mavlinkLogManager.emailAddress = emailField.text
QGroundControl.mavlinkLogManager.description = descField.text
QGroundControl.mavlinkLogManager.uploadURL = urlField.text
QGroundControl.mavlinkLogManager.emailAddress = emailField.text
if(autoUploadCheck.checked && QGroundControl.mavlinkLogManager.emailAddress === "") {
autoUploadCheck.checked = false
} else {
QGroundControl.mavlinkLogManager.enableAutoUpload = autoUploadCheck.checked
}
}
MessageDialog {
id: emptyEmailDialog
visible: false
icon: StandardIcon.Warning
standardButtons: StandardButton.Close
title: qsTr("MAVLink Logging")
text: qsTr("Please enter an email address before uploading MAVLink log files.")
clip: true
anchors.fill: parent
anchors.margins: ScreenTools.defaultFontPixelWidth
contentHeight: settingsColumn.height
width: __mavlinkRoot.width
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.margins: ScreenTools.defaultFontPixelWidth
//-----------------------------------------------------------------
//-- Ground Station
Item {
width: __mavlinkRoot.width * 0.8
height: gcsLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
id: gcsLabel
text: qsTr("Ground Station")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
height: gcsColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
width: __mavlinkRoot.width * 0.8
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Column {
id: gcsColumn
anchors.centerIn: parent
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: sysidField.baseline
}
QGCTextField {
id: sysidField
text: QGroundControl.mavlinkSystemID.toString()
width: _valueWidth
inputMethodHints: Qt.ImhFormattedNumbersOnly
anchors.verticalCenter: parent.verticalCenter
onEditingFinished: {
saveItems();
}
}
}
//-----------------------------------------------------------------
//-- Mavlink Heartbeats
QGCCheckBox {
text: qsTr("Emit heartbeat")
checked: QGroundControl.multiVehicleManager.gcsHeartBeatEnabled
onClicked: {
QGroundControl.multiVehicleManager.gcsHeartBeatEnabled = checked
}
}
//-----------------------------------------------------------------
//-- Mavlink Version Check
QGCCheckBox {
text: qsTr("Only accept MAVs with same protocol version")
checked: QGroundControl.isVersionCheckEnabled
onClicked: {
QGroundControl.isVersionCheckEnabled = checked
}
}
}
}
//-----------------------------------------------------------------
Item {
width: __mavlinkRoot.width * 0.8
height: mavlogLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
id: mavlogLabel
text: qsTr("MAVLink 2.0 Logging (PX4 Firmware Only)")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: mavlogColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
width: __mavlinkRoot.width * 0.8
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Column {
id: mavlogColumn
width: gcsColumn.width
anchors.centerIn: parent
//-----------------------------------------------------------------
//-- Manual Start/Stop
Row {
spacing: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
width: _labelWidth
text: qsTr("Manual Start/Stop:")
anchors.verticalCenter: parent.verticalCenter
}
text: qsTr("Start Logging")
width: (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
enabled: !QGroundControl.mavlinkLogManager.logRunning && QGroundControl.mavlinkLogManager.canStartLog
onClicked: QGroundControl.mavlinkLogManager.startLogging()
anchors.verticalCenter: parent.verticalCenter
}
QGCButton {
text: qsTr("Stop Logging")
width: (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
enabled: QGroundControl.mavlinkLogManager.logRunning
onClicked: QGroundControl.mavlinkLogManager.stopLogging()
anchors.verticalCenter: parent.verticalCenter
}
}
//-----------------------------------------------------------------
//-- Enable auto log on arming
QGCCheckBox {
text: qsTr("Enable automatic logging")
checked: QGroundControl.mavlinkLogManager.enableAutoStart
onClicked: {
QGroundControl.mavlinkLogManager.enableAutoStart = checked
}
}
}
}
//-----------------------------------------------------------------
//-- Mavlink Logging
Item {
width: __mavlinkRoot.width * 0.8
height: logLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
id: logLabel
text: qsTr("MAVLink 2.0 Log Uploads (PX4 Firmware Only)")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: logColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
width: __mavlinkRoot.width * 0.8
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Column {
id: logColumn
anchors.centerIn: parent
//-----------------------------------------------------------------
//-- Email address Field
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: emailField.baseline
text: qsTr("Email address for Log Upload:")
}
QGCTextField {
id: emailField
text: QGroundControl.mavlinkLogManager.emailAddress
width: _valueWidth
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
anchors.verticalCenter: parent.verticalCenter
onEditingFinished: {
saveItems();
}
}
}
//-----------------------------------------------------------------
//-- Description Field
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: descField.baseline
text: qsTr("Default Description:")
}
QGCTextField {
id: descField
text: QGroundControl.mavlinkLogManager.description
width: _valueWidth
anchors.verticalCenter: parent.verticalCenter
onEditingFinished: {
saveItems();
}
}
}
//-----------------------------------------------------------------
//-- Upload URL
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: urlField.baseline
text: qsTr("Default Upload URL")
}
QGCTextField {
id: urlField
text: QGroundControl.mavlinkLogManager.uploadURL
width: _valueWidth
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
anchors.verticalCenter: parent.verticalCenter
onEditingFinished: {
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
saveItems();
}
}
}
//-----------------------------------------------------------------
//-- Video URL
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: videoUrlField.baseline
text: qsTr("Video URL:")
}
QGCTextField {
id: videoUrlField
text: QGroundControl.mavlinkLogManager.videoURL
width: _valueWidth
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
anchors.verticalCenter: parent.verticalCenter
}
}
//-----------------------------------------------------------------
//-- Wind Speed
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: windCombo.baseline
text: qsTr("Wind Speed:")
}
QGCComboBox {
id: windCombo
width: _valueWidth
model: ListModel {
id: windItems
ListElement { text: "Please Select"; value: -1 }
ListElement { text: "Calm"; value: 0 }
ListElement { text: "Breeze"; value: 5 }
ListElement { text: "Gale"; value: 8 }
ListElement { text: "Storm"; value: 10 }
}
onActivated: {
saveItems();
QGroundControl.mavlinkLogManager.windSpeed = windItems.get(index).value
//console.log('Set Wind: ' + windItems.get(index).value)
}
Component.onCompleted: {
for(var i = 0; i < windItems.count; i++) {
if(windItems.get(i).value === QGroundControl.mavlinkLogManager.windSpeed) {
windCombo.currentIndex = i;
//console.log('Wind: ' + windItems.get(i).value)
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
break;
}
}
}
}
}
//-----------------------------------------------------------------
//-- Flight Rating
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
anchors.baseline: ratingCombo.baseline
text: qsTr("Flight Rating:")
}
QGCComboBox {
id: ratingCombo
width: _valueWidth
model: ListModel {
id: ratingItems
ListElement { text: "Please Select"; value: "notset"}
ListElement { text: "Crashed (Pilot Error)"; value: "crash_pilot" }
ListElement { text: "Crashed (Software or Hardware issue)"; value: "crash_sw_hw" }
ListElement { text: "Unsatisfactory"; value: "unsatisfactory" }
ListElement { text: "Good"; value: "good" }
ListElement { text: "Great"; value: "great" }
}
onActivated: {
saveItems();
QGroundControl.mavlinkLogManager.rating = ratingItems.get(index).value
//console.log('Set Rating: ' + ratingItems.get(index).value)
}
Component.onCompleted: {
for(var i = 0; i < ratingItems.count; i++) {
if(ratingItems.get(i).value === QGroundControl.mavlinkLogManager.rating) {
ratingCombo.currentIndex = i;
//console.log('Rating: ' + ratingItems.get(i).value)
break;
}
}
}
}
}
//-----------------------------------------------------------------
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
//-- Feedback
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: _labelWidth
text: qsTr("Additional Feedback:")
}
TextArea {
id: feedbackTextArea
width: _valueWidth
height: ScreenTools.defaultFontPixelHeight * 4
frameVisible: false
font.pointSize: ScreenTools.defaultFontPointSize
text: QGroundControl.mavlinkLogManager.feedback
style: TextAreaStyle {
textColor: qgcPal.windowShade
backgroundColor: qgcPal.text
}
}
}
//-----------------------------------------------------------------
//-- Public Log
QGCCheckBox {
text: qsTr("Make this log publicly available")
checked: QGroundControl.mavlinkLogManager.publicLog
onClicked: {
QGroundControl.mavlinkLogManager.publicLog = checked
}
}
//-----------------------------------------------------------------
checked: QGroundControl.mavlinkLogManager.enableAutoUpload
saveItems();
if(checked && QGroundControl.mavlinkLogManager.emailAddress === "")
emptyEmailDialog.open()
//-----------------------------------------------------------------
//-- Delete log after upload
QGCCheckBox {
text: qsTr("Delete log file after uploading")
checked: QGroundControl.mavlinkLogManager.deleteAfterUpload
enabled: autoUploadCheck.checked
onClicked: {
QGroundControl.mavlinkLogManager.deleteAfterUpload = checked
}
}
}
}
//-----------------------------------------------------------------
//-- Log Files
Item {
width: __mavlinkRoot.width * 0.8
height: logFilesLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
id: logFilesLabel
text: qsTr("Saved Log Files")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: logFilesColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
width: __mavlinkRoot.width * 0.8
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Column {
id: logFilesColumn
anchors.horizontalCenter: parent.horizontalCenter
anchors.centerIn: parent
orientation: ListView.Vertical
model: QGroundControl.mavlinkLogManager.logFiles
anchors.centerIn: parent
spacing: ScreenTools.defaultFontPixelWidth
QGCCheckBox {
width: ScreenTools.defaultFontPixelWidth * 4
checked: object.selected
onClicked: {
object.selected = checked
}
}
QGCLabel {
text: object.name
color: object.writing ? qgcPal.warningText : qgcPal.text
text: Number(object.size).toLocaleString(Qt.locale(), 'f', 0)
color: object.writing ? qgcPal.warningText : qgcPal.text
anchors.verticalCenter: parent.verticalCenter
}
QGCLabel {
visible: object.uploaded
width: ScreenTools.defaultFontPixelWidth * 20;
horizontalAlignment: Text.AlignRight
anchors.verticalCenter: parent.verticalCenter
width: ScreenTools.defaultFontPixelWidth * 20;
height: ScreenTools.defaultFontPixelHeight
anchors.verticalCenter: parent.verticalCenter
minimumValue: 0
maximumValue: 100
value: object.progress * 100.0
}
}
}
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCButton {
enabled: !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
onClicked: {
for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
logFile.selected = true
}
}
}
QGCButton {
enabled: !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
onClicked: {
for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
logFile.selected = false
}
}
}
QGCButton {
enabled: _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
onClicked: deleteDialog.open()
MessageDialog {
id: deleteDialog
visible: false
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
title: qsTr("Delete Selected Log Files")
text: qsTr("Confirm deleting selected log files?")
onYes: {
QGroundControl.mavlinkLogManager.deleteLog()
}
}
}
QGCButton {
enabled: _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning && !_uploadedSelected
visible: !QGroundControl.mavlinkLogManager.uploading
saveItems();
if(QGroundControl.mavlinkLogManager.emailAddress === "")
emptyEmailDialog.open()
else
uploadDialog.open()
}
MessageDialog {
id: uploadDialog
visible: false
icon: StandardIcon.Question
standardButtons: StandardButton.Yes | StandardButton.No
title: qsTr("Upload Selected Log Files")
text: qsTr("Confirm uploading selected log files?")
onYes: {
QGroundControl.mavlinkLogManager.uploadLog()
}
}
}
QGCButton {
enabled: QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
visible: QGroundControl.mavlinkLogManager.uploading
onClicked: cancelDialog.open()
MessageDialog {
id: cancelDialog
visible: false
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
title: qsTr("Cancel Upload")
text: qsTr("Confirm canceling the upload process?")
onYes: {
QGroundControl.mavlinkLogManager.cancelUpload()
}
}
}
}