GeneralSettings.qml 57.7 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
15
import QtQuick.Layouts          1.2
dogmaphobic's avatar
dogmaphobic committed
16 17 18

import QGroundControl                       1.0
import QGroundControl.FactSystem            1.0
19
import QGroundControl.FactControls          1.0
dogmaphobic's avatar
dogmaphobic committed
20 21 22 23
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.Palette               1.0
24
import QGroundControl.Controllers           1.0
25
import QGroundControl.SettingsManager       1.0
dogmaphobic's avatar
dogmaphobic committed
26

27
QGCView {
28
    id:                 _qgcView
29
    viewPanel:          panel
30
    color:              qgcPal.window
31 32
    anchors.fill:       parent
    anchors.margins:    ScreenTools.defaultFontPixelWidth
dogmaphobic's avatar
dogmaphobic committed
33

34
    property Fact _percentRemainingAnnounce:    QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce
35
    property Fact _savePath:                    QGroundControl.settingsManager.appSettings.savePath
36
    property Fact _appFontPointSize:            QGroundControl.settingsManager.appSettings.appFontPointSize
37 38
    property Fact _userBrandImageIndoor:        QGroundControl.settingsManager.brandImageSettings.userBrandImageIndoor
    property Fact _userBrandImageOutdoor:       QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor
39
    property real _labelWidth:                  ScreenTools.defaultFontPixelWidth * 20
40
    property real _comboFieldWidth:             ScreenTools.defaultFontPixelWidth * 28
41
    property real _valueFieldWidth:             ScreenTools.defaultFontPixelWidth * 10
42 43
    property Fact _mapProvider:                 QGroundControl.settingsManager.flightMapSettings.mapProvider
    property Fact _mapType:                     QGroundControl.settingsManager.flightMapSettings.mapType
44
    property Fact _followTarget:                QGroundControl.settingsManager.appSettings.followTarget
Don Gagne's avatar
Don Gagne committed
45
    property real _panelWidth:                  _qgcView.width * _internalWidthRatio
46
    property real _margins:                     ScreenTools.defaultFontPixelWidth
Don Gagne's avatar
Don Gagne committed
47

48 49 50 51 52
    property string _videoSource:               QGroundControl.settingsManager.videoSettings.videoSource.value
    property bool   _isGst:                     QGroundControl.videoManager.isGStreamer
    property bool   _isUDP:                     _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.udpVideoSource
    property bool   _isRTSP:                    _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.rtspVideoSource
    property bool   _isTCP:                     _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.tcpVideoSource
53
    property bool   _isMPEGTS:                  _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.mpegtsVideoSource
54

55 56 57
    property string gpsDisabled: "Disabled"
    property string gpsUdpPort:  "UDP Port"

58
    readonly property real _internalWidthRatio: 0.8
59

60
    QGCPalette { id: qgcPal }
dogmaphobic's avatar
dogmaphobic committed
61

62 63 64
    QGCViewPanel {
        id:             panel
        anchors.fill:   parent
65

66 67 68
        QGCFlickable {
            clip:               true
            anchors.fill:       parent
69 70
            contentHeight:      outerItem.height
            contentWidth:       outerItem.width
71

72 73 74 75
            Item {
                id:     outerItem
                width:  Math.max(panel.width, settingsColumn.width)
                height: settingsColumn.height
76

77 78 79
                ColumnLayout {
                    id:                         settingsColumn
                    anchors.horizontalCenter:   parent.horizontalCenter
80

81 82
                    QGCLabel {
                        id:         unitsSectionLabel
83
                        text:       qsTr("Units")
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
                        visible:    QGroundControl.settingsManager.unitsSettings.visible
                    }
                    Rectangle {
                        Layout.preferredHeight: unitsGrid.height + (_margins * 2)
                        Layout.preferredWidth:  unitsGrid.width + (_margins * 2)
                        color:                  qgcPal.windowShade
                        visible:                miscSectionLabel.visible
                        Layout.fillWidth:       true

                        GridLayout {
                            id:                         unitsGrid
                            anchors.topMargin:          _margins
                            anchors.top:                parent.top
                            Layout.fillWidth:           false
                            anchors.horizontalCenter:   parent.horizontalCenter
                            flow:                       GridLayout.TopToBottom
                            rows:                       4
101

102 103 104 105 106 107
                            Repeater {
                                model: [ qsTr("Distance"), qsTr("Area"), qsTr("Speed"), qsTr("Temperature") ]
                                QGCLabel { text: modelData }
                            }
                            Repeater {
                                model:  [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ]
108
                                FactComboBox {
109 110 111
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   modelData
                                    indexModel:             false
112
                                }
113 114 115
                            }
                        }
                    }
116 117 118

                    Item { width: 1; height: _margins }

119
                    QGCLabel {
120 121 122
                        id:         miscSectionLabel
                        text:       qsTr("Miscellaneous")
                        visible:    QGroundControl.settingsManager.appSettings.visible
123
                    }
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
                    Rectangle {
                        Layout.preferredWidth:  Math.max(comboGrid.width, miscCol.width) + (_margins * 2)
                        Layout.preferredHeight: (pathRow.visible ? pathRow.y + pathRow.height : miscColItem.y + miscColItem.height)  + (_margins * 2)
                        Layout.fillWidth:       true
                        color:                  qgcPal.windowShade
                        visible:                miscSectionLabel.visible

                        Item {
                            id:                 comboGridItem
                            anchors.margins:    _margins
                            anchors.top:        parent.top
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            height:             comboGrid.height

                            GridLayout {
                                id:                         comboGrid
                                anchors.horizontalCenter:   parent.horizontalCenter
                                columns:                    2

                                QGCLabel {
145 146 147 148 149 150 151 152 153 154 155
                                    text:           qsTr("Language")
                                    visible: QGroundControl.settingsManager.appSettings.language.visible
                                }
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   QGroundControl.settingsManager.appSettings.language
                                    indexModel:             false
                                    visible:                QGroundControl.settingsManager.appSettings.language.visible
                                }

                                QGCLabel {
156 157
                                    text:           qsTr("Color Scheme")
                                    visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
158
                                }
159 160 161 162 163
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   QGroundControl.settingsManager.appSettings.indoorPalette
                                    indexModel:             false
                                    visible:                QGroundControl.settingsManager.appSettings.indoorPalette.visible
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

                                QGCLabel {
                                    text:       qsTr("Map Provider")
                                    width:      _labelWidth
                                    visible:    _mapProvider.visible
                                }
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   _mapProvider
                                    indexModel:             false
                                    visible:                _mapProvider.visible
                                }

                                QGCLabel {
                                    text:       qsTr("Map Type")
                                    visible:    _mapType.visible
                                }
                                FactComboBox {
                                    id:                     mapTypes
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   _mapType
                                    indexModel:             false
                                    visible:                _mapType.visible
                                    Connections {
                                        target: QGroundControl.settingsManager.flightMapSettings
                                        onMapTypeChanged: {
                                            mapTypes.model = _mapType.enumStrings
192 193 194
                                        }
                                    }
                                }
195 196 197 198 199 200 201 202 203 204 205

                                QGCLabel {
                                    text:       qsTr("Stream GCS Position")
                                    visible:    _followTarget.visible
                                }
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   _followTarget
                                    indexModel:             false
                                    visible:                _followTarget.visible
                                }
Gus Grubba's avatar
Gus Grubba committed
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 247 248 249 250 251 252 253 254

                        Item {
                            id:                 miscColItem
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            anchors.top:        comboGridItem.bottom
                            height:             miscCol.height

                            ColumnLayout {
                                id:                         miscCol
                                anchors.horizontalCenter:   parent.horizontalCenter
                                spacing:                    _margins

                                RowLayout {
                                    Layout.fillWidth:   false
                                    Layout.alignment:   Qt.AlignHCenter
                                    visible:            _appFontPointSize ? _appFontPointSize.visible : false

                                    QGCLabel {
                                        text:   qsTr("Font Size:")
                                    }
                                    QGCButton {
                                        Layout.preferredWidth:  height
                                        Layout.preferredHeight: baseFontEdit.height
                                        text:                   "-"
                                        onClicked: {
                                            if (_appFontPointSize.value > _appFontPointSize.min) {
                                                _appFontPointSize.value = _appFontPointSize.value - 1
                                            }
                                        }
                                    }
                                    FactTextField {
                                        id:                     baseFontEdit
                                        Layout.preferredWidth:  _valueFieldWidth
                                        fact:                   QGroundControl.settingsManager.appSettings.appFontPointSize
                                    }
                                    QGCButton {
                                        Layout.preferredWidth:  height
                                        Layout.preferredHeight: baseFontEdit.height
                                        text:                   "+"
                                        onClicked: {
                                            if (_appFontPointSize.value < _appFontPointSize.max) {
                                                _appFontPointSize.value = _appFontPointSize.value + 1
                                            }
                                        }
                                    }
Gus Grubba's avatar
Gus Grubba committed
255
                                }
256 257 258 259 260 261 262


                                FactCheckBox {
                                    text:       qsTr("Mute all audio output")
                                    fact:       _audioMuted
                                    visible:    _audioMuted.visible
                                    property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
263
                                }
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294

                                FactCheckBox {
                                    text:       qsTr("AutoLoad Missions")
                                    fact:       _autoLoad
                                    visible:    _autoLoad.visible

                                    property Fact _autoLoad: QGroundControl.settingsManager.appSettings.autoLoadMissions
                                }

                                QGCCheckBox {
                                    id:         clearCheck
                                    text:       qsTr("Clear all settings on next start")
                                    checked:    false
                                    onClicked: {
                                        checked ? clearDialog.visible = true : QGroundControl.clearDeleteAllSettingsNextBoot()
                                    }
                                    MessageDialog {
                                        id:                 clearDialog
                                        visible:            false
                                        icon:               StandardIcon.Warning
                                        standardButtons:    StandardButton.Yes | StandardButton.No
                                        title:              qsTr("Clear Settings")
                                        text:               qsTr("All saved settings will be reset the next time you start %1. Is this really what you want?").arg(QGroundControl.appName)
                                        onYes: {
                                            QGroundControl.deleteAllSettingsNextBoot()
                                            clearDialog.visible = false
                                        }
                                        onNo: {
                                            clearCheck.checked  = false
                                            clearDialog.visible = false
                                        }
295 296
                                    }
                                }
297

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
                                RowLayout {
                                    visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible

                                    QGCCheckBox {
                                        id:         announcePercentCheckbox
                                        text:       qsTr("Announce battery lower than")
                                        checked:    _percentRemainingAnnounce.value !== 0
                                        onClicked: {
                                            if (checked) {
                                                _percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString
                                            } else {
                                                _percentRemainingAnnounce.value = 0
                                            }
                                        }
                                    }
                                    FactTextField {
                                        fact:                   _percentRemainingAnnounce
                                        Layout.preferredWidth:  _valueFieldWidth
                                        enabled:                announcePercentCheckbox.checked
                                    }
                                }
                            }
320 321 322 323
                        }

                        //-----------------------------------------------------------------
                        //-- Save path
Don Gagne's avatar
Don Gagne committed
324
                        RowLayout {
325 326 327 328 329 330 331 332 333 334 335 336
                            id:                 pathRow
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            anchors.top:        miscColItem.bottom
                            visible:            _savePath.visible && !ScreenTools.isMobile

                            QGCLabel { text: qsTr("Application Load/Save Path") }
                            QGCTextField {
                                Layout.fillWidth:   true
                                readOnly:           true
                                text:               _savePath.rawValue === "" ? qsTr("<not set>") : _savePath.value
337 338
                            }
                            QGCButton {
339
                                text:       qsTr("Browse")
340 341 342 343 344
                                onClicked:  savePathBrowseDialog.openForLoad()

                                QGCFileDialog {
                                    id:             savePathBrowseDialog
                                    qgcView:        _qgcView
345
                                    title:          qsTr("Choose the location to save/load files")
346 347
                                    folder:         _savePath.rawValue
                                    selectExisting: true
348
                                    selectFolder:   true
349 350

                                    onAcceptedForLoad: _savePath.rawValue = file
351
                                }
Don Gagne's avatar
Don Gagne committed
352 353
                            }
                        }
354
                    }
355

356 357 358
                    Item { width: 1; height: _margins }
                    QGCLabel {
                        id:         loggingSectionLabel
359
                        text:       qsTr("Data Persistence")
360 361
                    }
                    Rectangle {
362 363
                        Layout.preferredHeight: dataPersistCol.height + (_margins * 2)
                        Layout.preferredWidth:  dataPersistCol.width + (_margins * 2)
364 365 366
                        color:                  qgcPal.windowShade
                        Layout.fillWidth:       true
                        ColumnLayout {
367
                            id:                         dataPersistCol
368 369 370
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
371
                            spacing:                    _margins * 1.5
372
                            FactCheckBox {
373 374 375 376 377
                                id:         disableDataPersistence
                                text:       qsTr("Disable all data persistence")
                                fact:       _disableDataPersistence
                                visible:    _disableDataPersistence.visible
                                property Fact _disableDataPersistence: QGroundControl.settingsManager.appSettings.disableAllPersistence
378
                            }
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
                            QGCLabel {
                                text:       qsTr("When Data Persistence is disabled, all telemetry logging and map tile caching is disabled and not written to disk.")
                                wrapMode:   Text.WordWrap
                                font.pointSize:       ScreenTools.smallFontPointSize
                                Layout.maximumWidth:  logIfNotArmed.visible ? logIfNotArmed.width : disableDataPersistence.width * 1.5
                            }
                        }
                    }

                    Item { width: 1; height: _margins }
                    QGCLabel {
                        text:       qsTr("Telemetry Logs from Vehicle")
                    }
                    Rectangle {
                        Layout.preferredHeight: loggingCol.height + (_margins * 2)
                        Layout.preferredWidth:  loggingCol.width + (_margins * 2)
                        color:                  qgcPal.windowShade
                        Layout.fillWidth:       true
                        ColumnLayout {
                            id:                         loggingCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
403 404
                            FactCheckBox {
                                id:         promptSaveLog
Gus Grubba's avatar
Gus Grubba committed
405
                                text:       qsTr("Save log after each flight")
406 407
                                fact:       _telemetrySave
                                visible:    _telemetrySave.visible
408
                                enabled:    !disableDataPersistence.checked
409 410 411 412
                                property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
                            }
                            FactCheckBox {
                                id:         logIfNotArmed
Gus Grubba's avatar
Gus Grubba committed
413
                                text:       qsTr("Save logs even if vehicle was not armed")
414 415
                                fact:       _telemetrySaveNotArmed
                                visible:    _telemetrySaveNotArmed.visible
416
                                enabled:    promptSaveLog.checked && !disableDataPersistence.checked
417 418 419 420 421
                                property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
                            }
                        }
                    }

422
                    Item { width: 1; height: _margins }
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
                    QGCLabel {
                        id:         flyViewSectionLabel
                        text:       qsTr("Fly View")
                        visible:    QGroundControl.settingsManager.flyViewSettings.visible
                    }
                    Rectangle {
                        Layout.preferredHeight: flyViewCol.height + (_margins * 2)
                        Layout.preferredWidth:  flyViewCol.width + (_margins * 2)
                        color:                  qgcPal.windowShade
                        visible:                flyViewSectionLabel.visible
                        Layout.fillWidth:       true

                        ColumnLayout {
                            id:                         flyViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins

                            FactCheckBox {
                                text:       qsTr("Use preflight checklist")
                                fact:       _useChecklist
                                visible:    _useChecklist.visible

                                property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
                            }

                            FactCheckBox {
                                text:       qsTr("Virtual Joystick")
                                visible:    _virtualJoystick.visible
                                fact:       _virtualJoystick

                                property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
                            }

458 459 460 461 462 463 464 465 466 467 468
                            FactCheckBox {
                                text:       qsTr("Auto-Center throttle")
                                visible:    _virtualJoystickCentralized.visible && (
                                        QGroundControl.multiVehicleManager.activeVehicle.sub || QGroundControl.multiVehicleManager.activeVehicle.rover
                                    )
                                fact:       _virtualJoystickCentralized
                                Layout.leftMargin: _margins

                                property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized
                            }

469 470 471 472 473 474 475 476 477 478 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 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
                            GridLayout {
                                columns: 2

                                QGCLabel { text: qsTr("Guided Minimum Altitude") }
                                FactTextField {
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude
                                }

                                QGCLabel { text: qsTr("Guided Maximum Altitude") }
                                FactTextField {
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude
                                }
                            }
                        }
                    }

                    Item { width: 1; height: _margins }

                    QGCLabel {
                        id:         planViewSectionLabel
                        text:       qsTr("Plan View")
                        visible:    QGroundControl.settingsManager.planViewSettings.visible
                    }
                    Rectangle {
                        Layout.preferredHeight: planViewCol.height + (_margins * 2)
                        Layout.preferredWidth:  planViewCol.width + (_margins * 2)
                        color:                  qgcPal.windowShade
                        visible:                planViewSectionLabel.visible
                        Layout.fillWidth:       true

                        ColumnLayout {
                            id:                         planViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins

                            RowLayout {
                                spacing:    ScreenTools.defaultFontPixelWidth
                                visible:    QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible

                                QGCLabel { text: qsTr("Default Mission Altitude") }
                                FactTextField {
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
                                }
                            }
                        }
                    }

                    Item { width: 1; height: _margins }

                    QGCLabel {
                        id:         autoConnectSectionLabel
                        text:       qsTr("AutoConnect to the following devices")
                        visible:    QGroundControl.settingsManager.autoConnectSettings.visible
                    }
                    Rectangle {
                        Layout.preferredWidth:  autoConnectCol.width + (_margins * 2)
                        Layout.preferredHeight: autoConnectCol.height + (_margins * 2)
                        color:                  qgcPal.windowShade
                        visible:                autoConnectSectionLabel.visible
                        Layout.fillWidth:       true

                        ColumnLayout {
                            id:                 autoConnectCol
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.top:        parent.top
                            spacing:            _margins

                            RowLayout {
                                spacing: _margins

                                Repeater {
                                    id:     autoConnectRepeater
                                    model:  [ QGroundControl.settingsManager.autoConnectSettings.autoConnectPixhawk,
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectSiKRadio,
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectPX4Flow,
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectLibrePilot,
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectUDP,
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectRTKGPS
                                    ]

                                    property var names: [ qsTr("Pixhawk"), qsTr("SiK Radio"), qsTr("PX4 Flow"), qsTr("LibrePilot"), qsTr("UDP"), qsTr("RTK GPS") ]

                                    FactCheckBox {
                                        text:       autoConnectRepeater.names[index]
                                        fact:       modelData
                                        visible:    modelData.visible
                                    }
                                }
                            }

                            GridLayout {
                                Layout.fillWidth:   false
                                Layout.alignment:   Qt.AlignHCenter
                                columns:            2
                                visible:            !ScreenTools.isMobile
                                                    && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible
                                                    && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible

                                QGCLabel {
                                    text: qsTr("NMEA GPS Device")
                                }
                                QGCComboBox {
                                    id:                     nmeaPortCombo
                                    Layout.preferredWidth:  _comboFieldWidth

                                    model:  ListModel {
                                    }

                                    onActivated: {
                                        if (index != -1) {
                                            QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index);
                                        }
                                    }
                                    Component.onCompleted: {
589 590 591
                                        model.append({text: gpsDisabled})
                                        model.append({text: gpsUdpPort})

592 593 594 595 596
                                        for (var i in QGroundControl.linkManager.serialPorts) {
                                            nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]})
                                        }
                                        var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString);
                                        nmeaPortCombo.currentIndex = index;
597 598 599
                                        if (QGroundControl.linkManager.serialPorts.length === 0) {
                                            nmeaPortCombo.model.append({text: "Serial <none available>"})
                                        }
600 601 602 603
                                    }
                                }

                                QGCLabel {
604
                                    visible:          nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
605 606 607
                                    text:             qsTr("NMEA GPS Baudrate")
                                }
                                QGCComboBox {
608
                                    visible:                nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
609 610 611 612 613 614 615 616 617 618 619 620 621 622
                                    id:                     nmeaBaudCombo
                                    Layout.preferredWidth:  _comboFieldWidth
                                    model:                  [4800, 9600, 19200, 38400, 57600, 115200]

                                    onActivated: {
                                        if (index != -1) {
                                            QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index);
                                        }
                                    }
                                    Component.onCompleted: {
                                        var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
                                        nmeaBaudCombo.currentIndex = index;
                                    }
                                }
623 624 625 626 627 628 629 630 631 632

                                QGCLabel {
                                    text:       qsTr("NMEA stream UDP port")
                                    visible:    nmeaPortCombo.currentText === gpsUdpPort
                                }
                                FactTextField {
                                    visible:                nmeaPortCombo.currentText === gpsUdpPort
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
                                }
633 634 635 636 637 638
                            }
                        }
                    }

                    Item { width: 1; height: _margins }

Don Gagne's avatar
Don Gagne committed
639
                    QGCLabel {
640
                        id:         rtkSectionLabel
641
                        text:       qsTr("RTK GPS")
642
                        visible:    QGroundControl.settingsManager.rtkSettings.visible
Don Gagne's avatar
Don Gagne committed
643
                    }
644 645 646 647 648 649 650 651 652 653 654
                    Rectangle {
                        Layout.preferredHeight: rtkGrid.height + (_margins * 2)
                        Layout.preferredWidth:  rtkGrid.width + (_margins * 2)
                        color:                  qgcPal.windowShade
                        visible:                rtkSectionLabel.visible
                        Layout.fillWidth:       true

                        GridLayout {
                            id:                         rtkGrid
                            anchors.topMargin:          _margins
                            anchors.top:                parent.top
655
                            Layout.fillWidth:           true
656
                            anchors.horizontalCenter:   parent.horizontalCenter
657
                            columns:                    3
658

659 660
                            property var rtkSettings:       QGroundControl.settingsManager.rtkSettings
                            property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue
661
                            property real firstColWidth:    ScreenTools.defaultFontPixelWidth * 3
662

663 664 665 666 667 668 669 670 671 672 673 674 675 676
                            ExclusiveGroup {
                                id: useFixedBasePositionRadioGroup
                            }

                            QGCRadioButton {
                                text:               qsTr("Perform Survey-In")
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
                                checked:            rtkGrid.rtkSettings.useFixedBasePosition.value == false
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = false
                                exclusiveGroup:     useFixedBasePositionRadioGroup
                                Layout.columnSpan:  3
                            }

                            Item { width: rtkGrid.firstColWidth; height: 1 }
677 678 679
                            QGCLabel {
                                text:       rtkGrid.rtkSettings.surveyInAccuracyLimit.shortDescription
                                visible:    rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
680
                                enabled:    !rtkGrid.useFixedPosition
681
                            }
682
                            FactTextField {
683
                                fact:                   rtkGrid.rtkSettings.surveyInAccuracyLimit
684
                                visible:                rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
685
                                enabled:                !rtkGrid.useFixedPosition
686
                                Layout.preferredWidth:  _valueFieldWidth
687
                            }
Don Gagne's avatar
Don Gagne committed
688

689
                            Item { width: rtkGrid.firstColWidth; height: 1 }
690 691 692
                            QGCLabel {
                                text:       rtkGrid.rtkSettings.surveyInMinObservationDuration.shortDescription
                                visible:    rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
693
                                enabled:    !rtkGrid.useFixedPosition
694
                            }
695
                            FactTextField {
696
                                fact:                   rtkGrid.rtkSettings.surveyInMinObservationDuration
697
                                visible:                rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
698
                                enabled:                !rtkGrid.useFixedPosition
699 700 701
                                Layout.preferredWidth:  _valueFieldWidth
                            }

702 703
                            QGCRadioButton {
                                text:               qsTr("Use Specified Base Position")
704
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
705 706 707 708
                                checked:            rtkGrid.rtkSettings.useFixedBasePosition.value == true
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = true
                                exclusiveGroup:     useFixedBasePositionRadioGroup
                                Layout.columnSpan:  3
709 710
                            }

711
                            Item { width: rtkGrid.firstColWidth; height: 1 }
712 713 714 715 716 717 718 719 720 721 722 723
                            QGCLabel {
                                text:       rtkGrid.rtkSettings.fixedBasePositionLatitude.shortDescription
                                visible:    rtkGrid.rtkSettings.fixedBasePositionLatitude.visible
                                enabled:    rtkGrid.useFixedPosition
                            }
                            FactTextField {
                                fact:               rtkGrid.rtkSettings.fixedBasePositionLatitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLatitude.visible
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }

724
                            Item { width: rtkGrid.firstColWidth; height: 1 }
725
                            QGCLabel {
726 727 728
                                text:           rtkGrid.rtkSettings.fixedBasePositionLongitude.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionLongitude.visible
                                enabled:        rtkGrid.useFixedPosition
729 730 731 732 733 734 735 736
                            }
                            FactTextField {
                                fact:               rtkGrid.rtkSettings.fixedBasePositionLongitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLongitude.visible
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }

737
                            Item { width: rtkGrid.firstColWidth; height: 1 }
738
                            QGCLabel {
739 740 741
                                text:           rtkGrid.rtkSettings.fixedBasePositionAltitude.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionAltitude.visible
                                enabled:        rtkGrid.useFixedPosition
742 743 744 745 746 747 748 749
                            }
                            FactTextField {
                                fact:               rtkGrid.rtkSettings.fixedBasePositionAltitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionAltitude.visible
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }

750
                            Item { width: rtkGrid.firstColWidth; height: 1 }
751
                            QGCLabel {
752 753 754
                                text:           rtkGrid.rtkSettings.fixedBasePositionAccuracy.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible
                                enabled:        rtkGrid.useFixedPosition
755 756 757 758 759 760 761 762
                            }
                            FactTextField {
                                fact:               rtkGrid.rtkSettings.fixedBasePositionAccuracy
                                visible:            rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }

763
                            Item { width: rtkGrid.firstColWidth; height: 1 }
764 765
                            QGCButton {
                                text:               qsTr("Save Current Base Position")
766
                                enabled:            QGroundControl.gpsRtk && QGroundControl.gpsRtk.valid.value
767
                                Layout.columnSpan:  2
768 769 770 771 772 773 774

                                onClicked: {
                                    rtkGrid.rtkSettings.fixedBasePositionLatitude.rawValue =    QGroundControl.gpsRtk.currentLatitude.rawValue
                                    rtkGrid.rtkSettings.fixedBasePositionLongitude.rawValue =   QGroundControl.gpsRtk.currentLongitude.rawValue
                                    rtkGrid.rtkSettings.fixedBasePositionAltitude.rawValue =    QGroundControl.gpsRtk.currentAltitude.rawValue
                                    rtkGrid.rtkSettings.fixedBasePositionAccuracy.rawValue =    QGroundControl.gpsRtk.currentAccuracy.rawValue
                                }
775
                            }
776
                        }
777
                    }
778 779 780

                    Item { width: 1; height: _margins }

781
                    QGCLabel {
782 783
                        id:         videoSectionLabel
                        text:       qsTr("Video")
784
                        visible:    QGroundControl.settingsManager.videoSettings.visible && !QGroundControl.videoManager.autoStreamConfigured
785
                    }
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800
                    Rectangle {
                        Layout.preferredWidth:  videoGrid.width + (_margins * 2)
                        Layout.preferredHeight: videoGrid.height + (_margins * 2)
                        Layout.fillWidth:       true
                        color:                  qgcPal.windowShade
                        visible:                videoSectionLabel.visible

                        GridLayout {
                            id:                         videoGrid
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            Layout.fillWidth:           false
                            Layout.fillHeight:          false
                            columns:                    2
801
                            QGCLabel {
802 803
                                text:                   qsTr("Video Source")
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
804
                            }
805
                            FactComboBox {
806 807 808 809 810
                                id:                     videoSource
                                Layout.preferredWidth:  _comboFieldWidth
                                indexModel:             false
                                fact:                   QGroundControl.settingsManager.videoSettings.videoSource
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
811
                            }
812

813
                            QGCLabel {
814
                                text:                   qsTr("UDP Port")
815
                                visible:                (_isUDP || _isMPEGTS)  && QGroundControl.settingsManager.videoSettings.udpPort.visible
816
                            }
817
                            FactTextField {
818 819
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.udpPort
820
                                visible:                (_isUDP || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible
821
                            }
822

823
                            QGCLabel {
824 825
                                text:                   qsTr("RTSP URL")
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
826
                            }
827
                            FactTextField {
828 829
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.rtspUrl
830
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
831
                            }
832

833
                            QGCLabel {
834 835
                                text:                   qsTr("TCP URL")
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
836 837
                            }
                            FactTextField {
838 839
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.tcpUrl
840
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
841
                            }
842
                            QGCLabel {
843
                                text:                   qsTr("Aspect Ratio")
844
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
845 846
                            }
                            FactTextField {
847 848
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.aspectRatio
849
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
850
                            }
851

852
                            QGCLabel {
853 854
                                text:                   qsTr("Disable When Disarmed")
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
855
                            }
856
                            FactCheckBox {
857 858 859
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.disableWhenDisarmed
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
860 861 862
                            }
                        }
                    }
863 864 865

                    Item { width: 1; height: _margins }

866
                    QGCLabel {
867 868
                        id:                             videoRecSectionLabel
                        text:                           qsTr("Video Recording")
869
                        visible:                        (QGroundControl.settingsManager.videoSettings.visible && _isGst) || QGroundControl.videoManager.autoStreamConfigured
870
                    }
871
                    Rectangle {
872
                        Layout.preferredWidth:          videoRecCol.width  + (_margins * 2)
873 874 875 876
                        Layout.preferredHeight:         videoRecCol.height + (_margins * 2)
                        Layout.fillWidth:               true
                        color:                          qgcPal.windowShade
                        visible:                        videoRecSectionLabel.visible
877 878 879 880 881 882 883 884 885

                        GridLayout {
                            id:                         videoRecCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            Layout.fillWidth:           false
                            columns:                    2

886
                            QGCLabel {
887 888
                                text:                   qsTr("Auto-Delete Files")
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
889 890
                            }
                            FactCheckBox {
891 892 893
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.enableStorageLimit
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
894
                            }
895

896
                            QGCLabel {
897 898
                                text:                   qsTr("Max Storage Usage")
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
899 900
                            }
                            FactTextField {
901 902 903
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.maxVideoSize
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
904
                            }
905

906
                            QGCLabel {
907 908
                                text:                   qsTr("Video File Format")
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
909 910
                            }
                            FactComboBox {
911 912 913
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.recordingFormat
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
914 915
                            }
                        }
916
                    }
917 918 919

                    Item { width: 1; height: _margins; visible: videoRecSectionLabel.visible }

920
                    QGCLabel {
921 922 923
                        id:         brandImageSectionLabel
                        text:       qsTr("Brand Image")
                        visible:    QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile
924
                    }
925 926 927 928 929 930 931 932 933 934 935 936 937 938
                    Rectangle {
                        Layout.preferredWidth:  brandImageGrid.width + (_margins * 2)
                        Layout.preferredHeight: brandImageGrid.height + (_margins * 2)
                        Layout.fillWidth:       true
                        color:                  qgcPal.windowShade
                        visible:                brandImageSectionLabel.visible

                        GridLayout {
                            id:                 brandImageGrid
                            anchors.margins:    _margins
                            anchors.top:        parent.top
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            columns:            3
939 940

                            QGCLabel {
941 942
                                text:       qsTr("Indoor Image")
                                visible:    _userBrandImageIndoor.visible
943 944 945
                            }
                            QGCTextField {
                                readOnly:           true
946
                                Layout.fillWidth:   true
947
                                text:               _userBrandImageIndoor.valueString.replace("file:///","")
948 949
                            }
                            QGCButton {
950
                                text:       qsTr("Browse")
951 952 953 954 955
                                onClicked:  userBrandImageIndoorBrowseDialog.openForLoad()

                                QGCFileDialog {
                                    id:             userBrandImageIndoorBrowseDialog
                                    qgcView:        _qgcView
956
                                    title:          qsTr("Choose custom brand image file")
957 958 959 960
                                    folder:         _userBrandImageIndoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false

961
                                    onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file
962 963 964 965
                                }
                            }

                            QGCLabel {
966 967
                                text:       qsTr("Outdoor Image")
                                visible:    _userBrandImageOutdoor.visible
968 969 970
                            }
                            QGCTextField {
                                readOnly:           true
971
                                Layout.fillWidth:   true
972
                                text:               _userBrandImageOutdoor.valueString.replace("file:///","")
973 974
                            }
                            QGCButton {
975
                                text:       qsTr("Browse")
976 977 978 979 980
                                onClicked:  userBrandImageOutdoorBrowseDialog.openForLoad()

                                QGCFileDialog {
                                    id:             userBrandImageOutdoorBrowseDialog
                                    qgcView:        _qgcView
981
                                    title:          qsTr("Choose custom brand image file")
982 983 984 985 986 987 988 989 990
                                    folder:         _userBrandImageOutdoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false

                                    onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file
                                }
                            }

                            QGCButton {
991 992 993 994
                                text:               qsTr("Reset Default Brand Image")
                                Layout.columnSpan:  3
                                Layout.alignment:   Qt.AlignHCenter

995 996 997 998 999 1000 1001 1002
                                onClicked:  {
                                    _userBrandImageIndoor.rawValue = ""
                                    _userBrandImageOutdoor.rawValue = ""
                                }
                            }
                        }
                    }

1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014
                    Item { width: 1; height: _margins }

                    QGCLabel {
                        text:               qsTr("%1 Version").arg(QGroundControl.appName)
                        Layout.alignment:   Qt.AlignHCenter
                    }
                    QGCLabel {
                        text:               QGroundControl.qgcVersion
                        Layout.alignment:   Qt.AlignHCenter
                    }
                } // settingsColumn
            }
1015
        } // QGCFlickable
1016 1017
    } // QGCViewPanel
} // QGCView