MavlinkSettings.qml 37.3 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/
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
dogmaphobic's avatar
dogmaphobic committed
15 16

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

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

29 30 31 32 33
    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
34
    property var  _activeVehicle:       QGroundControl.multiVehicleManager.activeVehicle
35
    property var  _showMavlinkLog:      QGroundControl.corePlugin.options.showMavlinkLogOptions
Gus Grubba's avatar
Gus Grubba committed
36

37
    QGCPalette { id: qgcPal }
dogmaphobic's avatar
dogmaphobic committed
38

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

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

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

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

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

                    FactCheckBox {
                        text:   fact.shortDescription
                        fact:   QGroundControl.settingsManager.appSettings.apmStartMavlinkStreams
                    }

Gus Grubba's avatar
Gus Grubba committed
151 152 153 154 155 156
                    QGCCheckBox {
                        text:       qsTr("Only accept MAVs with same protocol version")
                        checked:    QGroundControl.isVersionCheckEnabled
                        onClicked: {
                            QGroundControl.isVersionCheckEnabled = checked
                        }
157 158 159 160
                    }
                }
            }
            //-----------------------------------------------------------------
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 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 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
            //-- 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
247
            //-- Mavlink Logging
248 249 250 251 252
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             mavlogLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
253
                visible:            _showMavlinkLog
254 255
                QGCLabel {
                    id:             mavlogLabel
256
                    text:           qsTr("MAVLink 2.0 Logging (PX4 Firmware Only)")
257 258 259 260 261 262 263 264 265
                    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
266
                visible:        _showMavlinkLog
267 268 269
                Column {
                    id:         mavlogColumn
                    width:      gcsColumn.width
Gus Grubba's avatar
Gus Grubba committed
270
                    spacing:    _columnSpacing
271 272 273 274 275 276
                    anchors.centerIn: parent
                    //-----------------------------------------------------------------
                    //-- Manual Start/Stop
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
Gus Grubba's avatar
Gus Grubba committed
277 278 279 280 281
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Manual Start/Stop:")
                            anchors.verticalCenter: parent.verticalCenter
                        }
282
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
283 284 285 286 287
                            text:               qsTr("Start Logging")
                            width:              (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
                            enabled:            !QGroundControl.mavlinkLogManager.logRunning && QGroundControl.mavlinkLogManager.canStartLog
                            onClicked:          QGroundControl.mavlinkLogManager.startLogging()
                            anchors.verticalCenter: parent.verticalCenter
288 289
                        }
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
290 291 292 293 294 295 296 297 298 299 300 301 302 303
                            text:               qsTr("Stop Logging")
                            width:              (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5)
                            enabled:            QGroundControl.mavlinkLogManager.logRunning
                            onClicked:          QGroundControl.mavlinkLogManager.stopLogging()
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Enable auto log on arming
                    QGCCheckBox {
                        text:       qsTr("Enable automatic logging")
                        checked:    QGroundControl.mavlinkLogManager.enableAutoStart
                        onClicked: {
                            QGroundControl.mavlinkLogManager.enableAutoStart = checked
304 305 306 307 308 309
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
            //-- Mavlink Logging
Gus Grubba's avatar
Gus Grubba committed
310 311 312 313 314
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             logLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
315
                visible:            _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
316 317
                QGCLabel {
                    id:             logLabel
318
                    text:           qsTr("MAVLink 2.0 Log Uploads (PX4 Firmware Only)")
Gus Grubba's avatar
Gus Grubba committed
319 320 321 322 323 324 325 326 327
                    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
328
                visible:        _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
329 330
                Column {
                    id:         logColumn
Gus Grubba's avatar
Gus Grubba committed
331
                    spacing:    _columnSpacing
Gus Grubba's avatar
Gus Grubba committed
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
                    anchors.centerIn: parent
                    //-----------------------------------------------------------------
                    //-- Email address Field
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   emailField.baseline
                            text:               qsTr("Email address for Log Upload:")
                        }
                        QGCTextField {
                            id:     emailField
                            text:   QGroundControl.mavlinkLogManager.emailAddress
                            width:  _valueWidth
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
349
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Description Field
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   descField.baseline
                            text:               qsTr("Default Description:")
                        }
                        QGCTextField {
                            id:     descField
                            text:   QGroundControl.mavlinkLogManager.description
                            width:  _valueWidth
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
368
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Upload URL
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   urlField.baseline
                            text:               qsTr("Default Upload URL")
                        }
                        QGCTextField {
                            id:     urlField
                            text:   QGroundControl.mavlinkLogManager.uploadURL
                            width:  _valueWidth
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                            onEditingFinished: {
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
                                saveItems();
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Video URL
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   videoUrlField.baseline
                            text:               qsTr("Video URL:")
                        }
                        QGCTextField {
                            id:     videoUrlField
                            text:   QGroundControl.mavlinkLogManager.videoURL
                            width:  _valueWidth
                            inputMethodHints:       Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
                            anchors.verticalCenter: parent.verticalCenter
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Wind Speed
                    Row {
                        spacing:                ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   windCombo.baseline
                            text:               qsTr("Wind Speed:")
                        }
                        QGCComboBox {
                            id:                 windCombo
                            width:              _valueWidth
                            model: ListModel {
                                id: windItems
                                ListElement { text: "Please Select"; value: -1 }
                                ListElement { text: "Calm";     value: 0 }
                                ListElement { text: "Breeze";   value: 5 }
                                ListElement { text: "Gale";     value: 8 }
                                ListElement { text: "Storm";    value: 10 }
                            }
                            onActivated: {
                                saveItems();
                                QGroundControl.mavlinkLogManager.windSpeed = windItems.get(index).value
432
                                //console.log('Set Wind: ' + windItems.get(index).value)
433 434 435 436 437
                            }
                            Component.onCompleted: {
                                for(var i = 0; i < windItems.count; i++) {
                                    if(windItems.get(i).value === QGroundControl.mavlinkLogManager.windSpeed) {
                                        windCombo.currentIndex = i;
438
                                        //console.log('Wind: ' + windItems.get(i).value)
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Flight Rating
                    Row {
                        spacing:                ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            anchors.baseline:   ratingCombo.baseline
                            text:               qsTr("Flight Rating:")
                        }
                        QGCComboBox {
                            id:                 ratingCombo
                            width:              _valueWidth
                            model: ListModel {
                                id: ratingItems
                                ListElement { text: "Please Select";            value: "notset"}
                                ListElement { text: "Crashed (Pilot Error)";    value: "crash_pilot" }
                                ListElement { text: "Crashed (Software or Hardware issue)";   value: "crash_sw_hw" }
                                ListElement { text: "Unsatisfactory";           value: "unsatisfactory" }
                                ListElement { text: "Good";                     value: "good" }
                                ListElement { text: "Great";                    value: "great" }
                            }
                            onActivated: {
                                saveItems();
                                QGroundControl.mavlinkLogManager.rating = ratingItems.get(index).value
469
                                //console.log('Set Rating: ' + ratingItems.get(index).value)
470 471 472 473 474
                            }
                            Component.onCompleted: {
                                for(var i = 0; i < ratingItems.count; i++) {
                                    if(ratingItems.get(i).value === QGroundControl.mavlinkLogManager.rating) {
                                        ratingCombo.currentIndex = i;
475
                                        //console.log('Rating: ' + ratingItems.get(i).value)
476 477 478
                                        break;
                                    }
                                }
Gus Grubba's avatar
Gus Grubba committed
479 480 481 482
                            }
                        }
                    }
                    //-----------------------------------------------------------------
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
                    //-- Feedback
                    Row {
                        spacing:                ScreenTools.defaultFontPixelWidth
                        QGCLabel {
                            width:              _labelWidth
                            text:               qsTr("Additional Feedback:")
                        }
                        TextArea {
                            id:                 feedbackTextArea
                            width:              _valueWidth
                            height:             ScreenTools.defaultFontPixelHeight * 4
                            frameVisible:       false
                            font.pointSize:     ScreenTools.defaultFontPointSize
                            text:               QGroundControl.mavlinkLogManager.feedback
                            style: TextAreaStyle {
                                textColor:          qgcPal.windowShade
                                backgroundColor:    qgcPal.text
                            }
                        }
                    }
                    //-----------------------------------------------------------------
                    //-- Public Log
                    QGCCheckBox {
                        text:       qsTr("Make this log publicly available")
                        checked:    QGroundControl.mavlinkLogManager.publicLog
                        onClicked: {
                            QGroundControl.mavlinkLogManager.publicLog = checked
                        }
                    }
                    //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
513 514
                    //-- Automatic Upload
                    QGCCheckBox {
515
                        id:         autoUploadCheck
Gus Grubba's avatar
Gus Grubba committed
516
                        text:       qsTr("Enable automatic log uploads")
517
                        checked:    QGroundControl.mavlinkLogManager.enableAutoUpload
Gus Grubba's avatar
Gus Grubba committed
518
                        onClicked: {
519 520
                            saveItems();
                            if(checked && QGroundControl.mavlinkLogManager.emailAddress === "")
521
                                emptyEmailDialog.open()
Gus Grubba's avatar
Gus Grubba committed
522 523
                        }
                    }
524 525 526 527 528
                    //-----------------------------------------------------------------
                    //-- Delete log after upload
                    QGCCheckBox {
                        text:       qsTr("Delete log file after uploading")
                        checked:    QGroundControl.mavlinkLogManager.deleteAfterUpload
529
                        enabled:    autoUploadCheck.checked
530 531 532 533
                        onClicked: {
                            QGroundControl.mavlinkLogManager.deleteAfterUpload = checked
                        }
                    }
dogmaphobic's avatar
dogmaphobic committed
534 535 536
                }
            }
            //-----------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
537 538 539 540 541 542
            //-- Log Files
            Item {
                width:              __mavlinkRoot.width * 0.8
                height:             logFilesLabel.height
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                anchors.horizontalCenter: parent.horizontalCenter
543
                visible:            _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
544 545 546 547 548 549 550 551 552 553 554 555
                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
556
                visible:        _showMavlinkLog
Gus Grubba's avatar
Gus Grubba committed
557 558
                Column {
                    id:         logFilesColumn
Gus Grubba's avatar
Gus Grubba committed
559
                    spacing:    _columnSpacing * 4
Gus Grubba's avatar
Gus Grubba committed
560
                    anchors.centerIn: parent
Gus Grubba's avatar
Gus Grubba committed
561
                    width:          ScreenTools.defaultFontPixelWidth * 68
Gus Grubba's avatar
Gus Grubba committed
562
                    Rectangle {
Gus Grubba's avatar
Gus Grubba committed
563
                        width:          ScreenTools.defaultFontPixelWidth  * 64
Gus Grubba's avatar
Gus Grubba committed
564
                        height:         ScreenTools.defaultFontPixelHeight * 14
Gus Grubba's avatar
Gus Grubba committed
565
                        anchors.horizontalCenter: parent.horizontalCenter
Gus Grubba's avatar
Gus Grubba committed
566
                        color:          qgcPal.window
Gus Grubba's avatar
Gus Grubba committed
567 568
                        border.color:   qgcPal.text
                        border.width:   0.5
Don Gagne's avatar
Don Gagne committed
569
                        QGCListView {
Gus Grubba's avatar
Gus Grubba committed
570
                            width:          ScreenTools.defaultFontPixelWidth  * 56
Gus Grubba's avatar
Gus Grubba committed
571
                            height:         ScreenTools.defaultFontPixelHeight * 12
Gus Grubba's avatar
Gus Grubba committed
572 573 574
                            anchors.centerIn: parent
                            orientation:    ListView.Vertical
                            model:          QGroundControl.mavlinkLogManager.logFiles
Gus Grubba's avatar
Gus Grubba committed
575
                            clip:           true
Gus Grubba's avatar
Gus Grubba committed
576
                            delegate: Rectangle {
Gus Grubba's avatar
Gus Grubba committed
577
                                width:          ScreenTools.defaultFontPixelWidth  * 52
Gus Grubba's avatar
Gus Grubba committed
578
                                height:         selectCheck.height
Gus Grubba's avatar
Gus Grubba committed
579
                                color:          qgcPal.window
Gus Grubba's avatar
Gus Grubba committed
580
                                Row {
Gus Grubba's avatar
Gus Grubba committed
581
                                    width:  ScreenTools.defaultFontPixelWidth  * 50
Gus Grubba's avatar
Gus Grubba committed
582 583 584
                                    anchors.centerIn: parent
                                    spacing: ScreenTools.defaultFontPixelWidth
                                    QGCCheckBox {
Gus Grubba's avatar
Gus Grubba committed
585
                                        id:         selectCheck
Gus Grubba's avatar
Gus Grubba committed
586 587
                                        width:      ScreenTools.defaultFontPixelWidth * 4
                                        checked:    object.selected
Gus Grubba's avatar
Gus Grubba committed
588
                                        enabled:    !object.writing && !object.uploading
Gus Grubba's avatar
Gus Grubba committed
589
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
590 591 592 593 594 595
                                        onClicked:  {
                                            object.selected = checked
                                        }
                                    }
                                    QGCLabel {
                                        text:       object.name
Gus Grubba's avatar
Gus Grubba committed
596
                                        width:      ScreenTools.defaultFontPixelWidth * 28
597
                                        color:      object.writing ? qgcPal.warningText : qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
598
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
599 600
                                    }
                                    QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
601
                                        text:       Number(object.size).toLocaleString(Qt.locale(), 'f', 0)
Gus Grubba's avatar
Gus Grubba committed
602
                                        visible:    !object.uploading && !object.uploaded
Gus Grubba's avatar
Gus Grubba committed
603
                                        width:      ScreenTools.defaultFontPixelWidth * 20;
604
                                        color:      object.writing ? qgcPal.warningText : qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
605
                                        horizontalAlignment: Text.AlignRight
Gus Grubba's avatar
Gus Grubba committed
606 607 608
                                        anchors.verticalCenter: parent.verticalCenter
                                    }
                                    QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
609
                                        text:      qsTr("Uploaded")
Gus Grubba's avatar
Gus Grubba committed
610 611 612 613
                                        visible:    object.uploaded
                                        width:      ScreenTools.defaultFontPixelWidth * 20;
                                        horizontalAlignment: Text.AlignRight
                                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
614 615
                                    }
                                    ProgressBar {
Gus Grubba's avatar
Gus Grubba committed
616
                                        visible:    object.uploading && !object.uploaded
Gus Grubba's avatar
Gus Grubba committed
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
                                        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
632
                            text:      qsTr("Check All")
633
                            enabled:    !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
634 635 636 637 638 639 640 641
                            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
642
                            text:      qsTr("Check None")
643
                            enabled:    !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
644 645 646 647 648 649 650 651
                            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
652
                            text:      qsTr("Delete Selected")
653
                            enabled:    _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
Gus Grubba's avatar
Gus Grubba committed
654 655 656 657 658 659 660 661 662 663 664 665 666 667
                            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
668
                            text:      qsTr("Upload Selected")
669
                            enabled:    _selectedCount > 0 && !QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning && !_uploadedSelected
670
                            visible:    !QGroundControl.mavlinkLogManager.uploading
Gus Grubba's avatar
Gus Grubba committed
671
                            onClicked:  {
672
                                saveItems();
Gus Grubba's avatar
Gus Grubba committed
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
                                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
691
                            text:      qsTr("Cancel")
692 693
                            enabled:    QGroundControl.mavlinkLogManager.uploading && !QGroundControl.mavlinkLogManager.logRunning
                            visible:    QGroundControl.mavlinkLogManager.uploading
Gus Grubba's avatar
Gus Grubba committed
694 695 696 697 698 699 700 701 702 703 704 705 706 707
                            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
708 709 710 711 712
                }
            }
        }
    }
}