MavlinkSettings.qml 45.2 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9 10


11 12
import QtQuick                  2.3
import QtQuick.Controls         1.2
13
import QtQuick.Controls.Styles  1.4
14
import QtQuick.Dialogs          1.2
15
import QtQuick.Layouts          1.2
dogmaphobic's avatar
dogmaphobic committed
16 17

import QGroundControl                       1.0
Gus Grubba's avatar
Gus Grubba committed
18
import QGroundControl.FactSystem            1.0
19
import QGroundControl.FactControls          1.0
20 21
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
dogmaphobic's avatar
dogmaphobic committed
22 23 24 25
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.Palette               1.0

Rectangle {
26
    id:             __mavlinkRoot
27
    color:          qgcPal.window
28
    anchors.fill:   parent
dogmaphobic's avatar
dogmaphobic committed
29

30 31 32 33 34
    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
35
    property bool _showMavlinkLog:      QGroundControl.corePlugin.options.showMavlinkLogOptions
36
    property bool _showAPMStreamRates:  QGroundControl.apmFirmwareSupported && QGroundControl.settingsManager.apmMavlinkStreamRateSettings.visible
37 38
    property Fact _disableDataPersistenceFact: QGroundControl.settingsManager.appSettings.disableAllPersistence
    property bool _disableDataPersistence:     _disableDataPersistenceFact ? _disableDataPersistenceFact.rawValue : false
Gus Grubba's avatar
Gus Grubba committed
39

40
    QGCPalette { id: qgcPal }
dogmaphobic's avatar
dogmaphobic committed
41

Gus Grubba's avatar
Gus Grubba committed
42 43 44
    Connections {
        target: QGroundControl.mavlinkLogManager
        onSelectedCountChanged: {
45
            _uploadedSelected = false
Gus Grubba's avatar
Gus Grubba committed
46 47 48
            var selected = 0
            for(var i = 0; i < QGroundControl.mavlinkLogManager.logFiles.count; i++) {
                var logFile = QGroundControl.mavlinkLogManager.logFiles.get(i)
49
                if(logFile.selected) {
Gus Grubba's avatar
Gus Grubba committed
50
                    selected++
51 52 53 54 55
                    //-- If an uploaded file is selected, disable "Upload" button
                    if(logFile.uploaded) {
                        _uploadedSelected = true
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
56 57 58 59 60
            }
            _selectedCount = selected
        }
    }

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    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
77 78 79 80 81
    MessageDialog {
        id:         emptyEmailDialog
        visible:    false
        icon:       StandardIcon.Warning
        standardButtons: StandardButton.Close
82 83
        title:      qsTr("MAVLink Logging")
        text:       qsTr("Please enter an email address before uploading MAVLink log files.")
Gus Grubba's avatar
Gus Grubba committed
84 85
    }

Don Gagne's avatar
Don Gagne committed
86
    QGCFlickable {
dogmaphobic's avatar
dogmaphobic committed
87 88 89 90
        clip:               true
        anchors.fill:       parent
        anchors.margins:    ScreenTools.defaultFontPixelWidth
        contentHeight:      settingsColumn.height
Don Gagne's avatar
Don Gagne committed
91
        contentWidth:       settingsColumn.width
Gus Grubba's avatar
Gus Grubba committed
92
        flickableDirection: Flickable.VerticalFlick
dogmaphobic's avatar
dogmaphobic committed
93 94 95

        Column {
            id:                 settingsColumn
Gus Grubba's avatar
Gus Grubba committed
96 97
            width:              __mavlinkRoot.width
            spacing:            ScreenTools.defaultFontPixelHeight * 0.5
dogmaphobic's avatar
dogmaphobic committed
98 99
            anchors.margins:    ScreenTools.defaultFontPixelWidth
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
100 101 102 103 104 105
            //-- Ground Station
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             gcsLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
106
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
107 108 109
                    id:             gcsLabel
                    text:           qsTr("Ground Station")
                    font.family:    ScreenTools.demiboldFontFamily
110
                }
Gus Grubba's avatar
Gus Grubba committed
111 112 113 114 115 116 117 118 119
            }
            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
120
                    spacing:    _columnSpacing
Gus Grubba's avatar
Gus Grubba committed
121 122 123 124 125 126
                    anchors.centerIn: parent
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   sysidField.baseline
127
                            text:               qsTr("MAVLink System ID:")
Gus Grubba's avatar
Gus Grubba committed
128 129 130 131 132 133 134 135
                        }
                        QGCTextField {
                            id:     sysidField
                            text:   QGroundControl.mavlinkSystemID.toString()
                            width:  _valueWidth
                            inputMethodHints:       Qt.ImhFormattedNumbersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
136
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
137 138 139
                            }
                        }
                    }
140

Gus Grubba's avatar
Gus Grubba committed
141 142 143 144 145 146 147
                    QGCCheckBox {
                        text:       qsTr("Emit heartbeat")
                        checked:    QGroundControl.multiVehicleManager.gcsHeartBeatEnabled
                        onClicked: {
                            QGroundControl.multiVehicleManager.gcsHeartBeatEnabled = checked
                        }
                    }
148

Gus Grubba's avatar
Gus Grubba committed
149 150 151 152 153 154
                    QGCCheckBox {
                        text:       qsTr("Only accept MAVs with same protocol version")
                        checked:    QGroundControl.isVersionCheckEnabled
                        onClicked: {
                            QGroundControl.isVersionCheckEnabled = checked
                        }
155
                    }
156 157 158 159 160

                    FactCheckBox {
                        id:         mavlinkForwardingChecked
                        text:       qsTr("Enable MAVLink forwarding")
                        fact:       QGroundControl.settingsManager.appSettings.forwardMavlink
161
                        visible:    QGroundControl.settingsManager.appSettings.forwardMavlink.visible
162 163 164 165 166 167 168
                    }

                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   mavlinkForwardingHostNameField.baseline
169
                            visible:            QGroundControl.settingsManager.appSettings.forwardMavlinkHostName.visible
170 171 172 173 174 175
                            text:               qsTr("Host name:")
                        }
                        FactTextField {
                            id:                     mavlinkForwardingHostNameField
                            fact:                   QGroundControl.settingsManager.appSettings.forwardMavlinkHostName
                            width:                  _valueWidth
176
                            visible:                QGroundControl.settingsManager.appSettings.forwardMavlinkHostName.visible
177
                            enabled:                QGroundControl.settingsManager.appSettings.forwardMavlink.rawValue
178 179 180 181 182 183
                            anchors.verticalCenter: parent.verticalCenter
                        }

                    }
                   QGCLabel {
                        text:       qsTr("<i> Changing the host name requires restart of application. </i>")
184
                        visible:    QGroundControl.settingsManager.appSettings.forwardMavlinkHostName.visible
185
                    }
186 187 188
                }
            }
            //-----------------------------------------------------------------
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
            //-- 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 {
230
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateRawSensors : null
231 232 233 234 235 236
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extended Status") }
                        FactComboBox {
237
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtendedStatus : null
238 239 240 241 242 243
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("RC Channel") }
                        FactComboBox {
244
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateRCChannels : null
245 246 247 248 249 250
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Position") }
                        FactComboBox {
251
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRatePosition : null
252 253 254 255 256 257
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extra 1") }
                        FactComboBox {
258
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtra1 : null
259 260 261 262 263 264
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extra 2") }
                        FactComboBox {
265
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtra2 : null
266 267 268 269 270 271
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }

                        QGCLabel { text:  qsTr("Extra 3") }
                        FactComboBox {
272
                            fact:                   QGroundControl.settingsManager.apmMavlinkStreamRateSettings ? QGroundControl.settingsManager.apmMavlinkStreamRateSettings.streamRateExtra3 : null
273 274 275 276 277 278 279
                            indexModel:             false
                            Layout.preferredWidth:  _valueWidth
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
            //-- 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
314
                            text:               activeVehicle ? activeVehicle.mavlinkSentCount : qsTr("Not Connected")
315 316 317 318 319 320 321 322 323 324 325 326 327 328
                            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
329
                            text:               activeVehicle ? activeVehicle.mavlinkReceivedCount : qsTr("Not Connected")
330 331 332 333 334 335 336 337 338 339 340 341 342 343
                            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
344
                            text:               activeVehicle ? activeVehicle.mavlinkLossCount : qsTr("Not Connected")
345 346 347 348 349 350 351 352 353 354 355 356 357 358
                            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
359
                            text:               activeVehicle ? activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : qsTr("Not Connected")
360 361 362 363 364 365
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
366
            //-- Mavlink Logging
367 368 369 370 371
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             mavlogLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
372
                visible:            _showMavlinkLog
373 374
                QGCLabel {
                    id:             mavlogLabel
375
                    text:           qsTr("MAVLink 2.0 Logging (PX4 Pro Only)")
376 377 378 379 380 381 382 383 384
                    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
385
                visible:        _showMavlinkLog
386 387 388
                Column {
                    id:         mavlogColumn
                    width:      gcsColumn.width
Gus Grubba's avatar
Gus Grubba committed
389
                    spacing:    _columnSpacing
390 391 392 393 394 395
                    anchors.centerIn: parent
                    //-----------------------------------------------------------------
                    //-- Manual Start/Stop
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
Gus Grubba's avatar
Gus Grubba committed
396 397 398 399 400
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Manual Start/Stop:")
                            anchors.verticalCenter: parent.verticalCenter
                        }
401
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
402 403
                            text:               qsTr("Start Logging")
                            width:              (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
404
                            enabled:            !QGroundControl.mavlinkLogManager.logRunning && QGroundControl.mavlinkLogManager.canStartLog && !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
405 406
                            onClicked:          QGroundControl.mavlinkLogManager.startLogging()
                            anchors.verticalCenter: parent.verticalCenter
407 408
                        }
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
409 410
                            text:               qsTr("Stop Logging")
                            width:              (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
411
                            enabled:            QGroundControl.mavlinkLogManager.logRunning && !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
412 413 414 415 416 417 418 419 420
                            onClicked:          QGroundControl.mavlinkLogManager.stopLogging()
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Enable auto log on arming
                    QGCCheckBox {
                        text:       qsTr("Enable automatic logging")
                        checked:    QGroundControl.mavlinkLogManager.enableAutoStart
421
                        enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
422 423
                        onClicked: {
                            QGroundControl.mavlinkLogManager.enableAutoStart = checked
424 425 426 427 428 429
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
            //-- Mavlink Logging
Gus Grubba's avatar
Gus Grubba committed
430 431 432 433 434
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             logLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
435
                visible:            _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
436 437
                QGCLabel {
                    id:             logLabel
438
                    text:           qsTr("MAVLink 2.0 Log Uploads (PX4 Pro Only)")
Gus Grubba's avatar
Gus Grubba committed
439 440 441 442 443 444 445 446 447
                    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
448
                visible:        _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
449 450
                Column {
                    id:         logColumn
Gus Grubba's avatar
Gus Grubba committed
451
                    spacing:    _columnSpacing
Gus Grubba's avatar
Gus Grubba committed
452 453 454 455 456 457 458 459 460 461 462
                    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 {
463 464 465
                            id:         emailField
                            text:       QGroundControl.mavlinkLogManager.emailAddress
                            width:      _valueWidth
466
                            enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
467 468 469
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
470
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
471 472 473 474 475 476 477 478 479 480 481 482 483
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Description Field
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   descField.baseline
                            text:               qsTr("Default Description:")
                        }
                        QGCTextField {
484 485 486
                            id:         descField
                            text:       QGroundControl.mavlinkLogManager.description
                            width:      _valueWidth
487
                            enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
488 489
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
490
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
491 492 493 494 495 496 497 498 499 500 501 502 503
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Upload URL
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   urlField.baseline
                            text:               qsTr("Default Upload URL")
                        }
                        QGCTextField {
504 505 506
                            id:         urlField
                            text:       QGroundControl.mavlinkLogManager.uploadURL
                            width:      _valueWidth
507
                            enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
508 509 510
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
511 512 513 514 515 516 517 518 519 520 521 522 523 524
                                saveItems();
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Video URL
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   videoUrlField.baseline
                            text:               qsTr("Video URL:")
                        }
                        QGCTextField {
525 526 527
                            id:         videoUrlField
                            text:       QGroundControl.mavlinkLogManager.videoURL
                            width:      _valueWidth
528
                            enabled:    !_disableDataPersistence
529 530 531 532 533 534 535 536 537 538 539 540 541 542
                            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 {
543 544
                            id:         windCombo
                            width:      _valueWidth
545
                            enabled:    !_disableDataPersistence
546
                            textRole:   "text"
547 548 549 550 551 552 553 554 555 556 557
                            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
558
                                //console.log('Set Wind: ' + windItems.get(index).value)
559 560 561 562 563
                            }
                            Component.onCompleted: {
                                for(var i = 0; i < windItems.count; i++) {
                                    if(windItems.get(i).value === QGroundControl.mavlinkLogManager.windSpeed) {
                                        windCombo.currentIndex = i;
564
                                        //console.log('Wind: ' + windItems.get(i).value)
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Flight Rating
                    Row {
                        spacing:                ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   ratingCombo.baseline
                            text:               qsTr("Flight Rating:")
                        }
                        QGCComboBox {
581 582
                            id:         ratingCombo
                            width:      _valueWidth
583
                            enabled:    !_disableDataPersistence
584
                            textRole:   "text"
585 586 587 588 589 590 591 592 593 594 595 596
                            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
597
                                //console.log('Set Rating: ' + ratingItems.get(index).value)
598 599 600 601 602
                            }
                            Component.onCompleted: {
                                for(var i = 0; i < ratingItems.count; i++) {
                                    if(ratingItems.get(i).value === QGroundControl.mavlinkLogManager.rating) {
                                        ratingCombo.currentIndex = i;
603
                                        //console.log('Rating: ' + ratingItems.get(i).value)
604 605 606
                                        break;
                                    }
                                }
Gus Grubba's avatar
Gus Grubba committed
607 608 609 610
                            }
                        }
                    }
                    //-----------------------------------------------------------------
611 612 613 614 615 616 617 618 619 620 621 622 623 624
                    //-- 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
625
                            enabled:            !_disableDataPersistence
626 627 628 629 630 631 632 633 634 635 636
                            style: TextAreaStyle {
                                textColor:          qgcPal.windowShade
                                backgroundColor:    qgcPal.text
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Public Log
                    QGCCheckBox {
                        text:       qsTr("Make this log publicly available")
                        checked:    QGroundControl.mavlinkLogManager.publicLog
637
                        enabled:    !_disableDataPersistence
638 639 640 641 642
                        onClicked: {
                            QGroundControl.mavlinkLogManager.publicLog = checked
                        }
                    }
                    //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
643 644
                    //-- Automatic Upload
                    QGCCheckBox {
645
                        id:         autoUploadCheck
Gus Grubba's avatar
Gus Grubba committed
646
                        text:       qsTr("Enable automatic log uploads")
647
                        checked:    QGroundControl.mavlinkLogManager.enableAutoUpload
648
                        enabled:    !_disableDataPersistence
Gus Grubba's avatar
Gus Grubba committed
649
                        onClicked: {
650 651
                            saveItems();
                            if(checked && QGroundControl.mavlinkLogManager.emailAddress === "")
652
                                emptyEmailDialog.open()
Gus Grubba's avatar
Gus Grubba committed
653 654
                        }
                    }
655 656 657 658 659
                    //-----------------------------------------------------------------
                    //-- Delete log after upload
                    QGCCheckBox {
                        text:       qsTr("Delete log file after uploading")
                        checked:    QGroundControl.mavlinkLogManager.deleteAfterUpload
660
                        enabled:    autoUploadCheck.checked && !_disableDataPersistence
661 662 663 664
                        onClicked: {
                            QGroundControl.mavlinkLogManager.deleteAfterUpload = checked
                        }
                    }
dogmaphobic's avatar
dogmaphobic committed
665 666 667
                }
            }
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
668 669 670 671 672 673
            //-- Log Files
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             logFilesLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
674
                visible:            _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
675 676 677 678 679 680 681 682 683 684 685 686
                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
687
                visible:        _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
688 689
                Column {
                    id:         logFilesColumn
Gus Grubba's avatar
Gus Grubba committed
690
                    spacing:    _columnSpacing * 4
Gus Grubba's avatar
Gus Grubba committed
691
                    anchors.centerIn: parent
Gus Grubba's avatar
Gus Grubba committed
692
                    width:          ScreenTools.defaultFontPixelWidth * 68
Gus Grubba's avatar
Gus Grubba committed
693
                    Rectangle {
Gus Grubba's avatar
Gus Grubba committed
694
                        width:          ScreenTools.defaultFontPixelWidth  * 64
Gus Grubba's avatar
Gus Grubba committed
695
                        height:         ScreenTools.defaultFontPixelHeight * 14
Gus Grubba's avatar
Gus Grubba committed
696
                        anchors.horizontalCenter: parent.horizontalCenter
Gus Grubba's avatar
Gus Grubba committed
697
                        color:          qgcPal.window
Gus Grubba's avatar
Gus Grubba committed
698 699
                        border.color:   qgcPal.text
                        border.width:   0.5
Don Gagne's avatar
Don Gagne committed
700
                        QGCListView {
Gus Grubba's avatar
Gus Grubba committed
701
                            width:          ScreenTools.defaultFontPixelWidth  * 56
Gus Grubba's avatar
Gus Grubba committed
702
                            height:         ScreenTools.defaultFontPixelHeight * 12
Gus Grubba's avatar
Gus Grubba committed
703 704 705
                            anchors.centerIn: parent
                            orientation:    ListView.Vertical
                            model:          QGroundControl.mavlinkLogManager.logFiles
Gus Grubba's avatar
Gus Grubba committed
706
                            clip:           true
Gus Grubba's avatar
Gus Grubba committed
707
                            delegate: Rectangle {
Gus Grubba's avatar
Gus Grubba committed
708
                                width:          ScreenTools.defaultFontPixelWidth  * 52
Gus Grubba's avatar
Gus Grubba committed
709
                                height:         selectCheck.height
Gus Grubba's avatar
Gus Grubba committed
710
                                color:          qgcPal.window
Gus Grubba's avatar
Gus Grubba committed
711
                                Row {
Gus Grubba's avatar
Gus Grubba committed
712
                                    width:  ScreenTools.defaultFontPixelWidth  * 50
Gus Grubba's avatar
Gus Grubba committed
713 714 715
                                    anchors.centerIn: parent
                                    spacing: ScreenTools.defaultFontPixelWidth
                                    QGCCheckBox {
Gus Grubba's avatar
Gus Grubba committed
716
                                        id:         selectCheck
Gus Grubba's avatar
Gus Grubba committed
717 718
                                        width:      ScreenTools.defaultFontPixelWidth * 4
                                        checked:    object.selected
Gus Grubba's avatar
Gus Grubba committed
719
                                        enabled:    !object.writing && !object.uploading
Gus Grubba's avatar
Gus Grubba committed
720
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
721 722 723 724 725 726
                                        onClicked:  {
                                            object.selected = checked
                                        }
                                    }
                                    QGCLabel {
                                        text:       object.name
Gus Grubba's avatar
Gus Grubba committed
727
                                        width:      ScreenTools.defaultFontPixelWidth * 28
728
                                        color:      object.writing ? qgcPal.warningText : qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
729
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
730 731
                                    }
                                    QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
732
                                        text:       Number(object.size).toLocaleString(Qt.locale(), 'f', 0)
Gus Grubba's avatar
Gus Grubba committed
733
                                        visible:    !object.uploading && !object.uploaded
Gus Grubba's avatar
Gus Grubba committed
734
                                        width:      ScreenTools.defaultFontPixelWidth * 20;
735
                                        color:      object.writing ? qgcPal.warningText : qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
736
                                        horizontalAlignment: Text.AlignRight
Gus Grubba's avatar
Gus Grubba committed
737 738 739
                                        anchors.verticalCenter: parent.verticalCenter
                                    }
                                    QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
740
                                        text:      qsTr("Uploaded")
Gus Grubba's avatar
Gus Grubba committed
741 742 743 744
                                        visible:    object.uploaded
                                        width:      ScreenTools.defaultFontPixelWidth * 20;
                                        horizontalAlignment: Text.AlignRight
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
745 746
                                    }
                                    ProgressBar {
Gus Grubba's avatar
Gus Grubba committed
747
                                        visible:    object.uploading && !object.uploaded
Gus Grubba's avatar
Gus Grubba committed
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762
                                        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
763
                            text:      qsTr("Check All")
764
                            enabled:    !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
765 766 767 768 769 770 771 772
                            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
773
                            text:      qsTr("Check None")
774
                            enabled:    !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
775 776 777 778 779 780 781 782
                            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
783
                            text:      qsTr("Delete Selected")
784
                            enabled:    _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
785 786 787 788 789 790 791 792 793 794 795 796 797 798
                            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
799
                            text:      qsTr("Upload Selected")
800
                            enabled:    _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning && !_uploadedSelected
801
                            visible:    !QGroundControl.mavlinkLogManager.uploading
Gus Grubba's avatar
Gus Grubba committed
802
                            onClicked:  {
803
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821
                                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
822
                            text:      qsTr("Cancel")
823 824
                            enabled:    QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
                            visible:    QGroundControl.mavlinkLogManager.uploading
Gus Grubba's avatar
Gus Grubba committed
825 826 827 828 829 830 831 832 833 834 835 836 837 838
                            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()
                                }
                            }
                        }
                    }
dogmaphobic's avatar
dogmaphobic committed
839 840 841 842 843
                }
            }
        }
    }
}