Skip to content
MavlinkSettings.qml 43.4 KiB
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 QtQuick.Controls.Styles  1.4
Don Gagne's avatar
Don Gagne committed
import QtQuick.Dialogs          1.2
Don Gagne's avatar
 
Don Gagne committed
import QtQuick.Layouts          1.2
dogmaphobic's avatar
dogmaphobic committed

import QGroundControl                       1.0
Gus Grubba's avatar
Gus Grubba committed
import QGroundControl.FactSystem            1.0
Don Gagne's avatar
 
Don Gagne committed
import QGroundControl.FactControls          1.0
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
dogmaphobic's avatar
dogmaphobic committed
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.Palette               1.0

Rectangle {
    id:             __mavlinkRoot
    color:          qgcPal.window
    anchors.fill:   parent
    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
    property bool _showMavlinkLog:      QGroundControl.corePlugin.options.showMavlinkLogOptions
Don Gagne's avatar
 
Don Gagne committed
    property bool _showAPMStreamRates:  QGroundControl.apmFirmwareSupported && QGroundControl.settingsManager.apmMavlinkStreamRateSettings.visible
    property Fact _disableDataPersistenceFact: QGroundControl.settingsManager.appSettings.disableAllPersistence
    property bool _disableDataPersistence:     _disableDataPersistenceFact ? _disableDataPersistenceFact.rawValue : false
    QGCPalette { id: qgcPal }
Gus Grubba's avatar
Gus Grubba committed
    Connections {
        target: QGroundControl.mavlinkLogManager
        onSelectedCountChanged: {
            _uploadedSelected = false
Gus Grubba's avatar
Gus Grubba committed
            var selected = 0
            for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
                var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
                if(logFile.selected) {
Gus Grubba's avatar
Gus Grubba committed
                    selected++
                    //-- If an uploaded file is selected, disable "Upload" button
                    if(logFile.uploaded) {
                        _uploadedSelected = true
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
            }
            _selectedCount = selected
        }
    }

    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
        }
    }

Gus Grubba's avatar
Gus Grubba committed
    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.")
Don Gagne's avatar
Don Gagne committed
    QGCFlickable {
dogmaphobic's avatar
dogmaphobic committed
        clip:               true
        anchors.fill:       parent
        anchors.margins:    ScreenTools.defaultFontPixelWidth
        contentHeight:      settingsColumn.height
Don Gagne's avatar
Don Gagne committed
        contentWidth:       settingsColumn.width
Gus Grubba's avatar
Gus Grubba committed
        flickableDirection: Flickable.VerticalFlick
dogmaphobic's avatar
dogmaphobic committed

        Column {
            id:                 settingsColumn
Gus Grubba's avatar
Gus Grubba committed
            width:              __mavlinkRoot.width
            spacing:            ScreenTools.defaultFontPixelHeight * 0.5
dogmaphobic's avatar
dogmaphobic committed
            anchors.margins:    ScreenTools.defaultFontPixelWidth
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
            //-- Ground Station
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             gcsLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
                    id:             gcsLabel
                    text:           qsTr("Ground Station")
                    font.family:    ScreenTools.demiboldFontFamily
Gus Grubba's avatar
Gus Grubba committed
            }
            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
Gus Grubba's avatar
Gus Grubba committed
                    spacing:    _columnSpacing
Gus Grubba's avatar
Gus Grubba committed
                    anchors.centerIn: parent
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   sysidField.baseline
                            text:               qsTr("MAVLink System ID:")
Gus Grubba's avatar
Gus Grubba committed
                        }
                        QGCTextField {
                            id:     sysidField
                            text:   QGroundControl.mavlinkSystemID.toString()
                            width:  _valueWidth
                            inputMethodHints:       Qt.ImhFormattedNumbersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
Don Gagne's avatar
 
Don Gagne committed

Gus Grubba's avatar
Gus Grubba committed
                    QGCCheckBox {
                        text:       qsTr("Emit heartbeat")
                        checked:    QGroundControl.multiVehicleManager.gcsHeartBeatEnabled
                        onClicked: {
                            QGroundControl.multiVehicleManager.gcsHeartBeatEnabled = checked
                        }
                    }
Don Gagne's avatar
 
Don Gagne committed

Gus Grubba's avatar
Gus Grubba committed
                    QGCCheckBox {
                        text:       qsTr("Only accept MAVs with same protocol version")
                        checked:    QGroundControl.isVersionCheckEnabled
                        onClicked: {
                            QGroundControl.isVersionCheckEnabled = checked
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
Don Gagne's avatar
 
Don Gagne committed
            //-- Stream Rates
            Item {
                id:                         apmStreamRatesLabel
                width:                      __mavlinkRoot.width * 0.8
                height:                     streamRatesLabel.height
                anchors.margins:            ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter:   parent.horizontalCenter
                visible:                    _showAPMStreamRates
                QGCLabel {
                    id:             streamRatesLabel
                    text:           qsTr("Telemetry Stream Rates (ArduPilot Only)")
                    font.family:    ScreenTools.demiboldFontFamily
                }
            }
            Rectangle {
                height:                     streamRatesColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
                width:                      __mavlinkRoot.width * 0.8
                color:                      qgcPal.windowShade
                anchors.margins:            ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter:   parent.horizontalCenter
                visible:                    _showAPMStreamRates

                ColumnLayout {
                    id:                 streamRatesColumn
                    spacing:            ScreenTools.defaultFontPixelHeight / 2
                    anchors.centerIn:   parent

                    property bool allStreamsControlledByVehicle: !QGroundControl.settingsManager.appSettings.apmStartMavlinkStreams.rawValue

                    QGCCheckBox {
                        text:               qsTr("All Streams Controlled By Vehicle Settings")
                        checked:            streamRatesColumn.allStreamsControlledByVehicle
                        onClicked:          QGroundControl.settingsManager.appSettings.apmStartMavlinkStreams.rawValue = !checked
                    }

                    GridLayout {
                        columns:    2
                        enabled:    !streamRatesColumn.allStreamsControlledByVehicle

                        QGCLabel { text:  qsTr("Raw Sensors") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateRawSensors : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extended Status") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtendedStatus : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("RC Channel") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateRCChannels : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Position") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRatePosition : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extra 1") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtra1 : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extra 2") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtra2 : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extra 3") }
                        FactComboBox {
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtra3 : null
Don Gagne's avatar
 
Don Gagne committed
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
            //-- Mavlink Status
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             mavStatusLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
                QGCLabel {
                    id:             mavStatusLabel
                    text:           qsTr("MAVLink Link Status (Current Vehicle)")
                    font.family:    ScreenTools.demiboldFontFamily
                }
            }
            Rectangle {
                height:         mavStatusColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
                width:          __mavlinkRoot.width * 0.8
                color:          qgcPal.windowShade
                anchors.margins: ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
                Column {
                    id:         mavStatusColumn
                    width:      gcsColumn.width
                    spacing:    _columnSpacing
                    anchors.centerIn: parent
                    //-----------------------------------------------------------------
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Total messages sent (computed):")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        QGCLabel {
                            width:              _valueWidth
                            text:               activeVehicle ? activeVehicle.mavlinkSentCount : qsTr("Not Connected")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Total messages received:")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        QGCLabel {
                            width:              _valueWidth
                            text:               activeVehicle ? activeVehicle.mavlinkReceivedCount : qsTr("Not Connected")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Total message loss:")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        QGCLabel {
                            width:              _valueWidth
                            text:               activeVehicle ? activeVehicle.mavlinkLossCount : qsTr("Not Connected")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Loss rate:")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        QGCLabel {
                            width:              _valueWidth
                            text:               activeVehicle ? activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : qsTr("Not Connected")
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
            //-- Mavlink Logging
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             mavlogLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
                visible:            _showMavlinkLog
Don Gagne's avatar
 
Don Gagne committed
                    text:           qsTr("MAVLink 2.0 Logging (PX4 Pro 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
                visible:        _showMavlinkLog
                Column {
                    id:         mavlogColumn
                    width:      gcsColumn.width
Gus Grubba's avatar
Gus Grubba committed
                    spacing:    _columnSpacing
                    anchors.centerIn: parent
                    //-----------------------------------------------------------------
                    //-- Manual Start/Stop
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
Gus Grubba's avatar
Gus Grubba committed
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Manual Start/Stop:")
                            anchors.verticalCenter: parent.verticalCenter
                        }
Gus Grubba's avatar
Gus Grubba committed
                            text:               qsTr("Start Logging")
                            width:              (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
                            enabled:            !QGroundControl.mavlinkLogManager.logRunning && QGroundControl.mavlinkLogManager.canStartLog && !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                            onClicked:          QGroundControl.mavlinkLogManager.startLogging()
                            anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
                            text:               qsTr("Stop Logging")
                            width:              (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
                            enabled:            QGroundControl.mavlinkLogManager.logRunning && !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                            onClicked:          QGroundControl.mavlinkLogManager.stopLogging()
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Enable auto log on arming
                    QGCCheckBox {
                        text:       qsTr("Enable automatic logging")
                        checked:    QGroundControl.mavlinkLogManager.enableAutoStart
                        enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                        onClicked: {
                            QGroundControl.mavlinkLogManager.enableAutoStart = checked
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
            //-- Mavlink Logging
Gus Grubba's avatar
Gus Grubba committed
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             logLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
                visible:            _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
                QGCLabel {
                    id:             logLabel
Don Gagne's avatar
 
Don Gagne committed
                    text:           qsTr("MAVLink 2.0 Log Uploads (PX4 Pro Only)")
Gus Grubba's avatar
Gus Grubba committed
                    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
                visible:        _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
                Column {
                    id:         logColumn
Gus Grubba's avatar
Gus Grubba committed
                    spacing:    _columnSpacing
Gus Grubba's avatar
Gus Grubba committed
                    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
                            enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
Gus Grubba's avatar
Gus Grubba committed
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- 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
                            enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
Gus Grubba's avatar
Gus Grubba committed
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- 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
                            enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
                                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
                            enabled:    !_disableDataPersistence
                            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
                            enabled:    !_disableDataPersistence
                            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)
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Flight Rating
                    Row {
                        spacing:                ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   ratingCombo.baseline
                            text:               qsTr("Flight Rating:")
                        }
                        QGCComboBox {
                            id:         ratingCombo
                            width:      _valueWidth
                            enabled:    !_disableDataPersistence
                            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)
Gus Grubba's avatar
Gus Grubba committed
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- 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
                            enabled:            !_disableDataPersistence
                            style: TextAreaStyle {
                                textColor:          qgcPal.windowShade
                                backgroundColor:    qgcPal.text
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Public Log
                    QGCCheckBox {
                        text:       qsTr("Make this log publicly available")
                        checked:    QGroundControl.mavlinkLogManager.publicLog
                        enabled:    !_disableDataPersistence
                        onClicked: {
                            QGroundControl.mavlinkLogManager.publicLog = checked
                        }
                    }
                    //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
                    //-- Automatic Upload
                    QGCCheckBox {
                        id:         autoUploadCheck
Gus Grubba's avatar
Gus Grubba committed
                        text:       qsTr("Enable automatic log uploads")
                        checked:    QGroundControl.mavlinkLogManager.enableAutoUpload
                        enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
                        onClicked: {
                            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 && !_disableDataPersistence
                        onClicked: {
                            QGroundControl.mavlinkLogManager.deleteAfterUpload = checked
                        }
                    }
dogmaphobic's avatar
dogmaphobic committed
                }
            }
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
            //-- Log Files
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             logFilesLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
                visible:            _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
                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
                visible:        _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
                Column {
                    id:         logFilesColumn
Gus Grubba's avatar
Gus Grubba committed
                    spacing:    _columnSpacing * 4
Gus Grubba's avatar
Gus Grubba committed
                    anchors.centerIn: parent
Gus Grubba's avatar
Gus Grubba committed
                    width:          ScreenTools.defaultFontPixelWidth * 68
Gus Grubba's avatar
Gus Grubba committed
                    Rectangle {
Gus Grubba's avatar
Gus Grubba committed
                        width:          ScreenTools.defaultFontPixelWidth  * 64
Gus Grubba's avatar
Gus Grubba committed
                        height:         ScreenTools.defaultFontPixelHeight * 14
Gus Grubba's avatar
Gus Grubba committed
                        anchors.horizontalCenter: parent.horizontalCenter
Gus Grubba's avatar
Gus Grubba committed
                        color:          qgcPal.window
Gus Grubba's avatar
Gus Grubba committed
                        border.color:   qgcPal.text
                        border.width:   0.5
Don Gagne's avatar
Don Gagne committed
                        QGCListView {
Gus Grubba's avatar
Gus Grubba committed
                            width:          ScreenTools.defaultFontPixelWidth  * 56
Gus Grubba's avatar
Gus Grubba committed
                            height:         ScreenTools.defaultFontPixelHeight * 12
Gus Grubba's avatar
Gus Grubba committed
                            anchors.centerIn: parent
                            orientation:    ListView.Vertical
                            model:          QGroundControl.mavlinkLogManager.logFiles
Gus Grubba's avatar
Gus Grubba committed
                            clip:           true
Gus Grubba's avatar
Gus Grubba committed
                            delegate: Rectangle {
Gus Grubba's avatar
Gus Grubba committed
                                width:          ScreenTools.defaultFontPixelWidth  * 52
Gus Grubba's avatar
Gus Grubba committed
                                height:         selectCheck.height
Gus Grubba's avatar
Gus Grubba committed
                                color:          qgcPal.window
Gus Grubba's avatar
Gus Grubba committed
                                Row {
Gus Grubba's avatar
Gus Grubba committed
                                    width:  ScreenTools.defaultFontPixelWidth  * 50
Gus Grubba's avatar
Gus Grubba committed
                                    anchors.centerIn: parent
                                    spacing: ScreenTools.defaultFontPixelWidth
                                    QGCCheckBox {
Gus Grubba's avatar
Gus Grubba committed
                                        id:         selectCheck
Gus Grubba's avatar
Gus Grubba committed
                                        width:      ScreenTools.defaultFontPixelWidth * 4
                                        checked:    object.selected
Gus Grubba's avatar
Gus Grubba committed
                                        enabled:    !object.writing && !object.uploading
Gus Grubba's avatar
Gus Grubba committed
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
                                        onClicked:  {
                                            object.selected = checked
                                        }
                                    }
                                    QGCLabel {
                                        text:       object.name
Gus Grubba's avatar
Gus Grubba committed
                                        width:      ScreenTools.defaultFontPixelWidth * 28
                                        color:      object.writing ? qgcPal.warningText : qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
                                    }
                                    QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
                                        text:       Number(object.size).toLocaleString(Qt.locale(), 'f', 0)
Gus Grubba's avatar
Gus Grubba committed
                                        visible:    !object.uploading && !object.uploaded
Gus Grubba's avatar
Gus Grubba committed
                                        width:      ScreenTools.defaultFontPixelWidth * 20;
                                        color:      object.writing ? qgcPal.warningText : qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
                                        horizontalAlignment: Text.AlignRight
Gus Grubba's avatar
Gus Grubba committed
                                        anchors.verticalCenter: parent.verticalCenter
                                    }
                                    QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
                                        text:      qsTr("Uploaded")
Gus Grubba's avatar
Gus Grubba committed
                                        visible:    object.uploaded
                                        width:      ScreenTools.defaultFontPixelWidth * 20;
                                        horizontalAlignment: Text.AlignRight
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
                                    }
                                    ProgressBar {
Gus Grubba's avatar
Gus Grubba committed
                                        visible:    object.uploading && !object.uploaded
Gus Grubba's avatar
Gus Grubba committed
                                        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 {
Gus Grubba's avatar
Gus Grubba committed
                            text:      qsTr("Check All")
                            enabled:    !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
                            onClicked: {
                                for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
                                    var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
                                    logFile.selected = true
                                }
                            }
                        }
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
                            text:      qsTr("Check None")
                            enabled:    !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
                            onClicked: {
                                for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
                                    var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
                                    logFile.selected = false
                                }
                            }
                        }
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
                            text:      qsTr("Delete Selected")
                            enabled:    _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
                            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 {
Gus Grubba's avatar
Gus Grubba committed
                            text:      qsTr("Upload Selected")
                            enabled:    _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning && !_uploadedSelected
                            visible:    !QGroundControl.mavlinkLogManager.uploading
Gus Grubba's avatar
Gus Grubba committed
                            onClicked:  {
Gus Grubba's avatar
Gus Grubba committed
                                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 {
Gus Grubba's avatar
Gus Grubba committed
                            text:      qsTr("Cancel")
                            enabled:    QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
                            visible:    QGroundControl.mavlinkLogManager.uploading
Gus Grubba's avatar
Gus Grubba committed
                            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()
                                }
                            }
                        }
                    }