GeneralSettings.qml 57.4 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
Rectangle {
28
    id:                 _root
29
    color:              qgcPal.window
30 31
    anchors.fill:       parent
    anchors.margins:    ScreenTools.defaultFontPixelWidth
dogmaphobic's avatar
dogmaphobic committed
32

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

47 48
    property string _videoSource:               QGroundControl.settingsManager.videoSettings.videoSource.value
    property bool   _isGst:                     QGroundControl.videoManager.isGStreamer
Gus Grubba's avatar
Gus Grubba committed
49
    property bool   _isUDP264:                  _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.udp264VideoSource
50 51
    property bool   _isRTSP:                    _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.rtspVideoSource
    property bool   _isTCP:                     _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.tcpVideoSource
52
    property bool   _isMPEGTS:                  _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.mpegtsVideoSource
53

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

57
    readonly property real _internalWidthRatio: 0.8
58

59 60 61
        QGCFlickable {
            clip:               true
            anchors.fill:       parent
62 63
            contentHeight:      outerItem.height
            contentWidth:       outerItem.width
64

65 66
            Item {
                id:     outerItem
67
            width:  Math.max(_root.width, settingsColumn.width)
68
                height: settingsColumn.height
69

70 71 72
                ColumnLayout {
                    id:                         settingsColumn
                    anchors.horizontalCenter:   parent.horizontalCenter
73

74 75
                    QGCLabel {
                        id:         unitsSectionLabel
76
                        text:       qsTr("Units")
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
                        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
94

95 96 97
                            Repeater {
                                model: [ qsTr("Distance"), qsTr("Area"), qsTr("Speed"), qsTr("Temperature") ]
                                QGCLabel { text: modelData }
98
                            }
99 100
                            Repeater {
                                model:  [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ]
101
                                FactComboBox {
102 103 104
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   modelData
                                    indexModel:             false
105
                                }
106 107 108 109
                            }
                        }
                    }

110
                    Item { width: 1; height: _margins }
111

112
                    QGCLabel {
113 114 115
                        id:         miscSectionLabel
                        text:       qsTr("Miscellaneous")
                        visible:    QGroundControl.settingsManager.appSettings.visible
116
                    }
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
                    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
136

137
                                QGCLabel {
138 139 140 141 142 143 144 145 146
                                    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
                                }
147

148
                                QGCLabel {
149 150
                                    text:           qsTr("Color Scheme")
                                    visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
151
                                }
152 153 154 155 156
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   QGroundControl.settingsManager.appSettings.indoorPalette
                                    indexModel:             false
                                    visible:                QGroundControl.settingsManager.appSettings.indoorPalette.visible
157
                                }
158 159 160 161 162

                                QGCLabel {
                                    text:       qsTr("Map Provider")
                                    width:      _labelWidth
                                    visible:    _mapProvider.visible
163
                                }
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
                                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
185 186
                                        }
                                    }
187 188
                                }

189 190 191 192 193 194 195 196 197 198
                                QGCLabel {
                                    text:       qsTr("Stream GCS Position")
                                    visible:    _followTarget.visible
                                }
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   _followTarget
                                    indexModel:             false
                                    visible:                _followTarget.visible
                                }
199
                            }
Gus Grubba's avatar
Gus Grubba committed
200
                        }
201

202 203 204 205 206 207 208
                        Item {
                            id:                 miscColItem
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            anchors.top:        comboGridItem.bottom
                            height:             miscCol.height
209

210 211 212 213
                            ColumnLayout {
                                id:                         miscCol
                                anchors.horizontalCenter:   parent.horizontalCenter
                                spacing:                    _margins
214

215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
                                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
                                            }
                                        }
232
                                    }
233 234 235 236 237 238 239 240 241 242 243 244 245 246
                                    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
                                            }
                                        }
247 248 249
                                    }
                                }

250 251 252 253 254
                                FactCheckBox {
                                    text:       qsTr("Mute all audio output")
                                    fact:       _audioMuted
                                    visible:    _audioMuted.visible
                                    property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
255
                                }
256 257 258 259 260 261 262 263

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

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

                                QGCCheckBox {
266 267 268
                                    id:         clearCheck
                                    text:       qsTr("Clear all settings on next start")
                                    checked:    false
269
                                    onClicked: {
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
                                        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
286 287
                                        }
                                    }
288
                                }
289

290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
                                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
                                    }
310
                                }
311 312 313
                            }
                        }

314 315
                        //-----------------------------------------------------------------
                        //-- Save path
Don Gagne's avatar
Don Gagne committed
316
                        RowLayout {
317 318 319 320 321 322 323 324 325 326 327 328
                            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
329 330
                            }
                            QGCButton {
331
                                text:       qsTr("Browse")
332 333 334
                                onClicked:  savePathBrowseDialog.openForLoad()
                                QGCFileDialog {
                                    id:             savePathBrowseDialog
335
                                    title:          qsTr("Choose the location to save/load files")
336 337
                                    folder:         _savePath.rawValue
                                    selectExisting: true
338
                                    selectFolder:   true
339
                                    onAcceptedForLoad: _savePath.rawValue = file
340
                                }
341 342
                            }
                        }
Don Gagne's avatar
Don Gagne committed
343
                    }
344

345 346 347
                    Item { width: 1; height: _margins }
                    QGCLabel {
                        id:         loggingSectionLabel
348
                        text:       qsTr("Data Persistence")
349
                    }
350
                    Rectangle {
351 352
                        Layout.preferredHeight: dataPersistCol.height + (_margins * 2)
                        Layout.preferredWidth:  dataPersistCol.width + (_margins * 2)
353 354 355
                        color:                  qgcPal.windowShade
                        Layout.fillWidth:       true
                        ColumnLayout {
356
                            id:                         dataPersistCol
357 358 359
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
360
                            spacing:                    _margins * 1.5
361
                            FactCheckBox {
362 363 364 365 366
                                id:         disableDataPersistence
                                text:       qsTr("Disable all data persistence")
                                fact:       _disableDataPersistence
                                visible:    _disableDataPersistence.visible
                                property Fact _disableDataPersistence: QGroundControl.settingsManager.appSettings.disableAllPersistence
367
                            }
368 369 370 371 372 373
                            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
                            }
374 375
                        }
                    }
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391

                    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
392 393
                            FactCheckBox {
                                id:         promptSaveLog
Gus Grubba's avatar
Gus Grubba committed
394
                                text:       qsTr("Save log after each flight")
395 396
                                fact:       _telemetrySave
                                visible:    _telemetrySave.visible
397
                                enabled:    !disableDataPersistence.checked
398 399 400 401
                                property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
                            }
                            FactCheckBox {
                                id:         logIfNotArmed
Gus Grubba's avatar
Gus Grubba committed
402
                                text:       qsTr("Save logs even if vehicle was not armed")
403 404
                                fact:       _telemetrySaveNotArmed
                                visible:    _telemetrySaveNotArmed.visible
405
                                enabled:    promptSaveLog.checked && !disableDataPersistence.checked
406 407
                                property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
                            }
408
                        }
409
                    }
410 411

                    Item { width: 1; height: _margins }
412 413 414 415 416 417 418 419 420 421 422
                    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
423

424 425 426 427 428 429
                        ColumnLayout {
                            id:                         flyViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
430

431
                            FactCheckBox {
432
                                text:       qsTr("Use Preflight Checklist")
433
                                fact:       _useChecklist
434
                                visible:    _useChecklist.visible && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
435

436
                                property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
437
                            }
Don Gagne's avatar
Don Gagne committed
438

439 440 441 442 443 444 445 446
                            FactCheckBox {
                                text:       qsTr("Show Telemetry Log Replay Status Bar")
                                fact:       _showLogReplayStatusBar
                                visible:    _showLogReplayStatusBar.visible

                                property Fact _showLogReplayStatusBar: QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar
                            }

447 448 449 450 451 452
                            FactCheckBox {
                                text:       qsTr("Virtual Joystick")
                                visible:    _virtualJoystick.visible
                                fact:       _virtualJoystick

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

455 456
                            FactCheckBox {
                                text:       qsTr("Auto-Center throttle")
457
                                visible:    _virtualJoystickCentralized.visible && activeVehicle && (activeVehicle.sub || activeVehicle.rover)
458 459
                                fact:       _virtualJoystickCentralized
                                Layout.leftMargin: _margins
460

461 462 463
                                property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized
                            }

464 465 466 467 468 469 470 471 472 473 474 475 476 477
                            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
                                }
478
                            }
479 480
                        }
                    }
481

482
                    Item { width: 1; height: _margins }
483

484 485 486 487 488 489 490 491 492 493 494
                    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
495

496 497 498 499 500 501
                        ColumnLayout {
                            id:                         planViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
502

503 504 505 506 507 508 509 510
                            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
511
                                }
512
                            }
513
                        }
514
                    }
515

516
                    Item { width: 1; height: _margins }
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
                    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
                                    }
                                }
558
                            }
559

560 561 562 563 564 565 566 567 568 569
                            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")
570
                                }
571 572 573
                                QGCComboBox {
                                    id:                     nmeaPortCombo
                                    Layout.preferredWidth:  _comboFieldWidth
574

575 576 577 578 579 580 581 582 583
                                    model:  ListModel {
                                    }

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

587 588 589 590 591
                                        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;
592 593 594
                                        if (QGroundControl.linkManager.serialPorts.length === 0) {
                                            nmeaPortCombo.model.append({text: "Serial <none available>"})
                                        }
595 596 597
                                    }
                                }

598
                                QGCLabel {
599
                                    visible:          nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
600 601 602
                                    text:             qsTr("NMEA GPS Baudrate")
                                }
                                QGCComboBox {
603
                                    visible:                nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
604 605 606 607 608 609 610 611
                                    id:                     nmeaBaudCombo
                                    Layout.preferredWidth:  _comboFieldWidth
                                    model:                  [4800, 9600, 19200, 38400, 57600, 115200]

                                    onActivated: {
                                        if (index != -1) {
                                            QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index);
                                        }
612
                                    }
613 614 615
                                    Component.onCompleted: {
                                        var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
                                        nmeaBaudCombo.currentIndex = index;
616 617
                                    }
                                }
618 619 620 621 622 623 624 625 626 627

                                QGCLabel {
                                    text:       qsTr("NMEA stream UDP port")
                                    visible:    nmeaPortCombo.currentText === gpsUdpPort
                                }
                                FactTextField {
                                    visible:                nmeaPortCombo.currentText === gpsUdpPort
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
                                }
628
                            }
629 630
                        }
                    }
631

632 633
                    Item { width: 1; height: _margins }

Don Gagne's avatar
Don Gagne committed
634
                    QGCLabel {
635
                        id:         rtkSectionLabel
636
                        text:       qsTr("RTK GPS")
637
                        visible:    QGroundControl.settingsManager.rtkSettings.visible
Don Gagne's avatar
Don Gagne committed
638
                    }
639 640 641 642 643 644 645 646 647 648 649
                    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
650
                            Layout.fillWidth:           true
651
                            anchors.horizontalCenter:   parent.horizontalCenter
652
                            columns:                    3
653

654 655
                            property var rtkSettings:       QGroundControl.settingsManager.rtkSettings
                            property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue
656
                            property real firstColWidth:    ScreenTools.defaultFontPixelWidth * 3
657

658 659 660
                            QGCRadioButton {
                                text:               qsTr("Perform Survey-In")
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
661
                            checked:            rtkGrid.rtkSettings.useFixedBasePosition.value === false
662 663
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = false
                                Layout.columnSpan:  3
664
                            }
665

666
                            Item { width: rtkGrid.firstColWidth; height: 1 }
667 668 669
                            QGCLabel {
                                text:       rtkGrid.rtkSettings.surveyInAccuracyLimit.shortDescription
                                visible:    rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
670
                                enabled:    !rtkGrid.useFixedPosition
671
                            }
672
                            FactTextField {
673
                                fact:                   rtkGrid.rtkSettings.surveyInAccuracyLimit
674
                                visible:                rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
675
                                enabled:                !rtkGrid.useFixedPosition
676
                                Layout.preferredWidth:  _valueFieldWidth
677
                            }
678

679
                            Item { width: rtkGrid.firstColWidth; height: 1 }
680
                            QGCLabel {
681 682
                                text:       rtkGrid.rtkSettings.surveyInMinObservationDuration.shortDescription
                                visible:    rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
683
                                enabled:    !rtkGrid.useFixedPosition
684
                            }
685
                            FactTextField {
686
                                fact:                   rtkGrid.rtkSettings.surveyInMinObservationDuration
687
                                visible:                rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
688
                                enabled:                !rtkGrid.useFixedPosition
689
                                Layout.preferredWidth:  _valueFieldWidth
690
                            }
691

692 693
                            QGCRadioButton {
                                text:               qsTr("Use Specified Base Position")
694
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
695
                            checked:            rtkGrid.rtkSettings.useFixedBasePosition.value === true
696 697
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = true
                                Layout.columnSpan:  3
698
                            }
699

700
                            Item { width: rtkGrid.firstColWidth; height: 1 }
701 702 703 704 705 706 707 708 709 710 711
                            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
                            }
712

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

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

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

752
                            Item { width: rtkGrid.firstColWidth; height: 1 }
753 754
                            QGCButton {
                                text:               qsTr("Save Current Base Position")
755
                                enabled:            QGroundControl.gpsRtk && QGroundControl.gpsRtk.valid.value
756
                                Layout.columnSpan:  2
757

758 759 760 761 762 763
                                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
                                }
764
                            }
765
                        }
766
                    }
767 768

                    Item { width: 1; height: _margins }
769

770
                    QGCLabel {
771 772
                        id:         videoSectionLabel
                        text:       qsTr("Video")
773
                        visible:    QGroundControl.settingsManager.videoSettings.visible && !QGroundControl.videoManager.autoStreamConfigured
774
                    }
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
                    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
790
                            QGCLabel {
791 792
                                text:                   qsTr("Video Source")
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
793
                            }
794
                            FactComboBox {
795 796 797 798 799
                                id:                     videoSource
                                Layout.preferredWidth:  _comboFieldWidth
                                indexModel:             false
                                fact:                   QGroundControl.settingsManager.videoSettings.videoSource
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
800
                            }
801

802
                            QGCLabel {
803
                                text:                   qsTr("UDP Port")
Gus Grubba's avatar
Gus Grubba committed
804
                                visible:                (_isUDP264 || _isMPEGTS)  && QGroundControl.settingsManager.videoSettings.udpPort.visible
805
                            }
806
                            FactTextField {
807 808
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.udpPort
Gus Grubba's avatar
Gus Grubba committed
809
                                visible:                (_isUDP264 || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible
810
                            }
811

812
                            QGCLabel {
813 814
                                text:                   qsTr("RTSP URL")
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
815
                            }
816
                            FactTextField {
817 818
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.rtspUrl
819
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
820
                            }
821

822
                            QGCLabel {
823 824
                                text:                   qsTr("TCP URL")
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
825 826
                            }
                            FactTextField {
827 828
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.tcpUrl
829
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
830
                            }
831
                            QGCLabel {
832
                                text:                   qsTr("Aspect Ratio")
833
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
834 835
                            }
                            FactTextField {
836 837
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.aspectRatio
838
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
839
                            }
840

841
                            QGCLabel {
842 843
                                text:                   qsTr("Disable When Disarmed")
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
844
                            }
845
                            FactCheckBox {
846 847 848
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.disableWhenDisarmed
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
849
                            }
850 851
                        }
                    }
852

853
                    Item { width: 1; height: _margins }
854

855
                    QGCLabel {
856 857
                        id:                             videoRecSectionLabel
                        text:                           qsTr("Video Recording")
858
                        visible:                        (QGroundControl.settingsManager.videoSettings.visible && _isGst) || QGroundControl.videoManager.autoStreamConfigured
859
                    }
860
                    Rectangle {
861
                        Layout.preferredWidth:          videoRecCol.width  + (_margins * 2)
862 863 864 865
                        Layout.preferredHeight:         videoRecCol.height + (_margins * 2)
                        Layout.fillWidth:               true
                        color:                          qgcPal.windowShade
                        visible:                        videoRecSectionLabel.visible
866 867 868 869 870 871 872 873

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

875
                            QGCLabel {
876 877
                                text:                   qsTr("Auto-Delete Files")
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
878 879
                            }
                            FactCheckBox {
880 881 882
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.enableStorageLimit
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
883
                            }
884

885
                            QGCLabel {
886 887
                                text:                   qsTr("Max Storage Usage")
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
888 889
                            }
                            FactTextField {
890 891 892
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.maxVideoSize
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
893
                            }
894

895
                            QGCLabel {
896 897
                                text:                   qsTr("Video File Format")
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
898 899
                            }
                            FactComboBox {
900 901 902
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.recordingFormat
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
903
                            }
904 905 906
                        }
                    }

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

909
                    QGCLabel {
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927
                        id:         brandImageSectionLabel
                        text:       qsTr("Brand Image")
                        visible:    QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile
                    }
                    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
928 929

                            QGCLabel {
930 931
                                text:       qsTr("Indoor Image")
                                visible:    _userBrandImageIndoor.visible
932 933 934
                            }
                            QGCTextField {
                                readOnly:           true
935
                                Layout.fillWidth:   true
936
                                text:               _userBrandImageIndoor.valueString.replace("file:///","")
937 938
                            }
                            QGCButton {
939
                                text:       qsTr("Browse")
940 941 942
                                onClicked:  userBrandImageIndoorBrowseDialog.openForLoad()
                                QGCFileDialog {
                                    id:             userBrandImageIndoorBrowseDialog
943
                                    title:          qsTr("Choose custom brand image file")
944 945 946
                                    folder:         _userBrandImageIndoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false
947
                                    onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file
948
                                }
949 950
                            }

951
                            QGCLabel {
952 953
                                text:       qsTr("Outdoor Image")
                                visible:    _userBrandImageOutdoor.visible
954
                            }
955 956
                            QGCTextField {
                                readOnly:           true
957
                                Layout.fillWidth:   true
958
                                text:               _userBrandImageOutdoor.valueString.replace("file:///","")
959 960
                            }
                            QGCButton {
961
                                text:       qsTr("Browse")
962 963 964
                                onClicked:  userBrandImageOutdoorBrowseDialog.openForLoad()
                                QGCFileDialog {
                                    id:             userBrandImageOutdoorBrowseDialog
965
                                    title:          qsTr("Choose custom brand image file")
966 967 968 969 970 971 972
                                    folder:         _userBrandImageOutdoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false
                                    onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file
                                }
                            }
                            QGCButton {
973 974 975
                                text:               qsTr("Reset Default Brand Image")
                                Layout.columnSpan:  3
                                Layout.alignment:   Qt.AlignHCenter
976 977 978 979
                                onClicked:  {
                                    _userBrandImageIndoor.rawValue = ""
                                    _userBrandImageOutdoor.rawValue = ""
                                }
980 981
                            }
                        }
982
                    }
983

984 985 986 987 988 989 990 991 992 993 994 995
                    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
            }
996 997
    }
}