GeneralSettings.qml 61.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 string _mapProvider:               QGroundControl.settingsManager.flightMapSettings.mapProvider.value
    property string _mapType:                   QGroundControl.settingsManager.flightMapSettings.mapType.value
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
    property bool   _isUDP265:                  _isGst && _videoSource === QGroundControl.settingsManager.videoSettings.udp265VideoSource
51 52
    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 61 62
        QGCFlickable {
            clip:               true
            anchors.fill:       parent
63 64
            contentHeight:      outerItem.height
            contentWidth:       outerItem.width
65

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

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

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

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

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

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

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

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

                                QGCLabel {
                                    text:       qsTr("Map Provider")
                                    width:      _labelWidth
163
                                    //visible:    _mapProvider.visible
164
                                }
165 166 167
                                QGCComboBox {
                                    id:             mapCombo
                                    model:          QGroundControl.mapEngineManager.mapList
168
                                    Layout.preferredWidth:  _comboFieldWidth
169 170 171
                                    onActivated: {
                                    _mapProvider = textAt(index)
                                    QGroundControl.settingsManager.flightMapSettings.mapProvider.value=textAt(index)
172
                                }
173 174 175
                                    Component.onCompleted: {
                                        var index = mapCombo.find(_mapProvider)
                                        mapCombo.currentIndex = index
176
                                    }
177 178
                                }

179 180
                                QGCLabel {
                                    text:       qsTr("Stream GCS Position")
181
                                    visible:    _followTarget.visible
182 183 184 185 186
                                }
                                FactComboBox {
                                    Layout.preferredWidth:  _comboFieldWidth
                                    fact:                   _followTarget
                                    indexModel:             false
187
                                    visible:                _followTarget.visible
188
                                }
189
                            }
Gus Grubba's avatar
Gus Grubba committed
190
                        }
191

192 193 194 195 196 197 198
                        Item {
                            id:                 miscColItem
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            anchors.top:        comboGridItem.bottom
                            height:             miscCol.height
199

200 201 202 203
                            ColumnLayout {
                                id:                         miscCol
                                anchors.horizontalCenter:   parent.horizontalCenter
                                spacing:                    _margins
204

205 206 207
                                RowLayout {
                                    Layout.fillWidth:   false
                                    Layout.alignment:   Qt.AlignHCenter
208
                                    visible:             _appFontPointSize.visible
209 210 211 212 213 214 215 216 217 218 219 220 221

                                    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
                                            }
                                        }
222
                                    }
223 224 225 226 227 228 229 230 231 232 233 234 235 236
                                    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
                                            }
                                        }
237 238 239
                                    }
                                }

Gus Grubba's avatar
Gus Grubba committed
240 241 242
                                FactCheckBox {
                                    text:       qsTr("Use Vehicle Pairing")
                                    fact:       _usePairing
243
                                    visible:    _usePairing.visible && QGroundControl.supportsPairing
Gus Grubba's avatar
Gus Grubba committed
244 245 246
                                    property Fact _usePairing: QGroundControl.settingsManager.appSettings.usePairing
                                }

247 248 249
                                FactCheckBox {
                                    text:       qsTr("Mute all audio output")
                                    fact:       _audioMuted
250
                                    visible:    _audioMuted.visible
251
                                    property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
252
                                }
253

254 255 256
                                FactCheckBox {
                                    text:       qsTr("Check for Internet connection")
                                    fact:       _checkInternet
Gus Grubba's avatar
Gus Grubba committed
257
                                    visible:    _checkInternet && _checkInternet.visible
258 259 260
                                    property Fact _checkInternet: QGroundControl.settingsManager.appSettings.checkInternet
                                }

261 262 263
                                FactCheckBox {
                                    text:       qsTr("AutoLoad Missions")
                                    fact:       _autoLoad
Gus Grubba's avatar
Gus Grubba committed
264
                                    visible:    _autoLoad && _autoLoad.visible
265 266 267

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

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

294 295 296 297 298 299
                                RowLayout {
                                    visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible

                                    QGCCheckBox {
                                        id:         announcePercentCheckbox
                                        text:       qsTr("Announce battery lower than")
300
                                        checked:    _percentRemainingAnnounce.value !== 0
301 302 303 304 305 306 307 308 309 310 311 312 313
                                        onClicked: {
                                            if (checked) {
                                                _percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString
                                            } else {
                                                _percentRemainingAnnounce.value = 0
                                            }
                                        }
                                    }
                                    FactTextField {
                                        fact:                   _percentRemainingAnnounce
                                        Layout.preferredWidth:  _valueFieldWidth
                                        enabled:                announcePercentCheckbox.checked
                                    }
314
                                }
315 316 317
                            }
                        }

318 319
                        //-----------------------------------------------------------------
                        //-- Save path
Don Gagne's avatar
Don Gagne committed
320
                        RowLayout {
321 322 323 324 325
                            id:                 pathRow
                            anchors.margins:    _margins
                            anchors.left:       parent.left
                            anchors.right:      parent.right
                            anchors.top:        miscColItem.bottom
326
                            visible:            _savePath.visible && !ScreenTools.isMobile
327 328 329 330 331

                            QGCLabel { text: qsTr("Application Load/Save Path") }
                            QGCTextField {
                                Layout.fillWidth:   true
                                readOnly:           true
332
                                text:               _savePath.rawValue === "" ? qsTr("<not set>") : _savePath.value
333 334
                            }
                            QGCButton {
335
                                text:       qsTr("Browse")
336 337 338
                                onClicked:  savePathBrowseDialog.openForLoad()
                                QGCFileDialog {
                                    id:             savePathBrowseDialog
339
                                    title:          qsTr("Choose the location to save/load files")
340
                                    folder:         _savePath.rawValue
341
                                    selectExisting: true
342
                                    selectFolder:   true
343
                                    onAcceptedForLoad: _savePath.rawValue = file
344
                                }
345 346
                            }
                        }
Don Gagne's avatar
Don Gagne committed
347
                    }
348

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

                    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
396 397
                            FactCheckBox {
                                id:         promptSaveLog
Gus Grubba's avatar
Gus Grubba committed
398
                                text:       qsTr("Save log after each flight")
399
                                fact:       _telemetrySave
400
                                visible:    _telemetrySave.visible
401
                                enabled:    !disableDataPersistence.checked
402 403 404 405
                                property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
                            }
                            FactCheckBox {
                                id:         logIfNotArmed
Gus Grubba's avatar
Gus Grubba committed
406
                                text:       qsTr("Save logs even if vehicle was not armed")
407
                                fact:       _telemetrySaveNotArmed
408
                                visible:    _telemetrySaveNotArmed.visible
409
                                enabled:    promptSaveLog.checked && !disableDataPersistence.checked
410 411
                                property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
                            }
412 413 414 415 416 417 418 419
                            FactCheckBox {
                                id:         promptSaveCsv
                                text:       qsTr("Save CSV log of telemetry data")
                                fact:       _saveCsvTelemetry
                                visible:    _saveCsvTelemetry.visible
                                enabled:    !disableDataPersistence.checked
                                property Fact _saveCsvTelemetry: QGroundControl.settingsManager.appSettings.saveCsvTelemetry
                            }
420
                        }
421
                    }
422 423

                    Item { width: 1; height: _margins }
424 425 426 427 428 429 430 431 432 433 434
                    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
435

436 437 438 439 440 441
                        ColumnLayout {
                            id:                         flyViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
442

443
                            FactCheckBox {
444
                                text:       qsTr("Use Preflight Checklist")
445
                                fact:       _useChecklist
446
                                visible:    _useChecklist.visible && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
447

448
                                property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
449
                            }
Don Gagne's avatar
Don Gagne committed
450

451 452 453
                            FactCheckBox {
                                text:       qsTr("Show Telemetry Log Replay Status Bar")
                                fact:       _showLogReplayStatusBar
454
                                visible:    _showLogReplayStatusBar.visible
455 456 457 458

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

459 460
                            FactCheckBox {
                                text:       qsTr("Virtual Joystick")
461
                                visible:    _virtualJoystick.visible
462 463 464
                                fact:       _virtualJoystick

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

467 468
                            FactCheckBox {
                                text:       qsTr("Auto-Center throttle")
469
                                visible:    _virtualJoystickCentralized.visible && activeVehicle && (activeVehicle.sub || activeVehicle.rover)
470 471
                                fact:       _virtualJoystickCentralized
                                Layout.leftMargin: _margins
472

473 474
                                property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized
                            }
475
                            FactCheckBox {
476
                                text:       qsTr("Use Vertical Instrument Panel")
477
                                visible:    _alternateInstrumentPanel.visible
478 479 480 481
                                fact:       _alternateInstrumentPanel

                                property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel
                            }
482
                            FactCheckBox {
483
                                text:       qsTr("Show additional heading indicators on Compass")
484
                                visible:    _showAdditionalIndicatorsCompass.visible
485
                                fact:       _showAdditionalIndicatorsCompass
486

487
                                property Fact _showAdditionalIndicatorsCompass: QGroundControl.settingsManager.flyViewSettings.showAdditionalIndicatorsCompass
488 489
                            }
                            FactCheckBox {
490
                                text:       qsTr("Lock Compass Nose-Up")
491
                                visible:    _lockNoseUpCompass.visible
492
                                fact:       _lockNoseUpCompass
493

494
                                property Fact _lockNoseUpCompass: QGroundControl.settingsManager.flyViewSettings.lockNoseUpCompass
495
                            }
496

497

498 499 500
                            GridLayout {
                                columns: 2

501 502 503 504 505
                                property Fact _guidedMinimumAltitude:   QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude
                                property Fact _guidedMaximumAltitude:   QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude
                                property Fact _maxGoToLocationDistance: QGroundControl.settingsManager.flyViewSettings.maxGoToLocationDistance

                                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
506
                                    text:                   qsTr("Guided Minimum Altitude")
507
                                    visible:                parent._guidedMinimumAltitude.visible
508
                                }
509 510
                                FactTextField {
                                    Layout.preferredWidth:  _valueFieldWidth
511
                                    visible:                parent._guidedMinimumAltitude.visible
512
                                    fact:                   parent._guidedMinimumAltitude
513 514
                                }

515
                                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
516
                                    text:                   qsTr("Guided Maximum Altitude")
517
                                    visible:                parent._guidedMaximumAltitude.visible
518
                                }
519 520
                                FactTextField {
                                    Layout.preferredWidth:  _valueFieldWidth
521
                                    visible:                parent._guidedMaximumAltitude.visible
522 523 524 525
                                    fact:                   parent._guidedMaximumAltitude
                                }

                                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
526
                                    text:                   qsTr("Go To Location Max Distance")
527
                                    visible:                parent._maxGoToLocationDistance.visible
528
                                }
529 530
                                FactTextField {
                                    Layout.preferredWidth:  _valueFieldWidth
531
                                    visible:                parent._maxGoToLocationDistance.visible
532
                                    fact:                   parent._maxGoToLocationDistance
533
                                }
534
                            }
535 536
                        }
                    }
537

538
                    Item { width: 1; height: _margins }
539

540 541 542 543 544 545 546 547 548 549 550
                    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
551

552 553 554 555 556 557
                        ColumnLayout {
                            id:                         planViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
558

559 560 561 562 563 564 565 566
                            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
567
                                }
568
                            }
569
                        }
570
                    }
571

572
                    Item { width: 1; height: _margins }
573

574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613
                    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
                                    }
                                }
614
                            }
615

616 617 618 619 620 621 622 623 624 625
                            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")
626
                                }
627 628 629
                                QGCComboBox {
                                    id:                     nmeaPortCombo
                                    Layout.preferredWidth:  _comboFieldWidth
630

631 632 633 634 635 636 637 638 639
                                    model:  ListModel {
                                    }

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

643 644 645 646 647
                                        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;
648 649 650
                                        if (QGroundControl.linkManager.serialPorts.length === 0) {
                                            nmeaPortCombo.model.append({text: "Serial <none available>"})
                                        }
651 652 653
                                    }
                                }

654
                                QGCLabel {
655
                                    visible:          nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
656 657 658
                                    text:             qsTr("NMEA GPS Baudrate")
                                }
                                QGCComboBox {
659
                                    visible:                nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
660 661 662 663 664 665 666 667
                                    id:                     nmeaBaudCombo
                                    Layout.preferredWidth:  _comboFieldWidth
                                    model:                  [4800, 9600, 19200, 38400, 57600, 115200]

                                    onActivated: {
                                        if (index != -1) {
                                            QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index);
                                        }
668
                                    }
669 670 671
                                    Component.onCompleted: {
                                        var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
                                        nmeaBaudCombo.currentIndex = index;
672 673
                                    }
                                }
674 675 676 677 678 679 680 681 682 683

                                QGCLabel {
                                    text:       qsTr("NMEA stream UDP port")
                                    visible:    nmeaPortCombo.currentText === gpsUdpPort
                                }
                                FactTextField {
                                    visible:                nmeaPortCombo.currentText === gpsUdpPort
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
                                }
684
                            }
685 686
                        }
                    }
687

688 689
                    Item { width: 1; height: _margins }

Don Gagne's avatar
Don Gagne committed
690
                    QGCLabel {
691
                        id:         rtkSectionLabel
692
                        text:       qsTr("RTK GPS")
693
                        visible:    QGroundControl.settingsManager.rtkSettings.visible
Don Gagne's avatar
Don Gagne committed
694
                    }
695 696 697 698 699 700 701 702 703 704 705
                    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
706
                            Layout.fillWidth:           true
707
                            anchors.horizontalCenter:   parent.horizontalCenter
708
                            columns:                    3
709

Gus Grubba's avatar
Gus Grubba committed
710
                            property var  rtkSettings:      QGroundControl.settingsManager.rtkSettings
711
                            property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue
712
                            property real firstColWidth:    ScreenTools.defaultFontPixelWidth * 3
713

714 715
                            QGCRadioButton {
                                text:               qsTr("Perform Survey-In")
716 717
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
                                checked:            rtkGrid.rtkSettings.useFixedBasePosition.value === false
718
                                Layout.columnSpan:  3
719
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = false
720
                            }
721

722
                            Item { width: rtkGrid.firstColWidth; height: 1 }
723
                            QGCLabel {
724 725
                                text:               rtkGrid.rtkSettings.surveyInAccuracyLimit.shortDescription
                                visible:            rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
Gus Grubba's avatar
Gus Grubba committed
726
                                enabled:            !rtkGrid.useFixedPosition
727
                            }
728
                            FactTextField {
729 730
                                fact:               rtkGrid.rtkSettings.surveyInAccuracyLimit
                                visible:            rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
Gus Grubba's avatar
Gus Grubba committed
731
                                enabled:            !rtkGrid.useFixedPosition
732
                                Layout.preferredWidth:  _valueFieldWidth
733
                            }
734

735
                            Item { width: rtkGrid.firstColWidth; height: 1 }
736
                            QGCLabel {
737 738
                                text:               rtkGrid.rtkSettings.surveyInMinObservationDuration.shortDescription
                                visible:            rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
Gus Grubba's avatar
Gus Grubba committed
739
                                enabled:            !rtkGrid.useFixedPosition
740
                            }
741
                            FactTextField {
742 743
                                fact:               rtkGrid.rtkSettings.surveyInMinObservationDuration
                                visible:            rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
Gus Grubba's avatar
Gus Grubba committed
744
                                enabled:            !rtkGrid.useFixedPosition
745
                                Layout.preferredWidth:  _valueFieldWidth
746
                            }
747

748 749
                            QGCRadioButton {
                                text:               qsTr("Use Specified Base Position")
750 751 752
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
                                checked:            rtkGrid.rtkSettings.useFixedBasePosition.value === true
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = true
753
                                Layout.columnSpan:  3
754
                            }
755

756
                            Item { width: rtkGrid.firstColWidth; height: 1 }
757
                            QGCLabel {
758 759
                                text:               rtkGrid.rtkSettings.fixedBasePositionLatitude.shortDescription
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLatitude.visible
Gus Grubba's avatar
Gus Grubba committed
760
                                enabled:            rtkGrid.useFixedPosition
761 762
                            }
                            FactTextField {
763 764
                                fact:               rtkGrid.rtkSettings.fixedBasePositionLatitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLatitude.visible
765 766 767
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }
768

769
                            Item { width: rtkGrid.firstColWidth; height: 1 }
770
                            QGCLabel {
771 772
                                text:               rtkGrid.rtkSettings.fixedBasePositionLongitude.shortDescription
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLongitude.visible
Gus Grubba's avatar
Gus Grubba committed
773
                                enabled:            rtkGrid.useFixedPosition
774 775
                            }
                            FactTextField {
776 777
                                fact:               rtkGrid.rtkSettings.fixedBasePositionLongitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLongitude.visible
778 779 780
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }
781

782
                            Item { width: rtkGrid.firstColWidth; height: 1 }
783
                            QGCLabel {
784 785
                                text:           rtkGrid.rtkSettings.fixedBasePositionAltitude.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionAltitude.visible
786
                                enabled:        rtkGrid.useFixedPosition
787 788
                            }
                            FactTextField {
789 790
                                fact:               rtkGrid.rtkSettings.fixedBasePositionAltitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionAltitude.visible
791 792 793
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }
794

795
                            Item { width: rtkGrid.firstColWidth; height: 1 }
796
                            QGCLabel {
797 798
                                text:           rtkGrid.rtkSettings.fixedBasePositionAccuracy.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible
799
                                enabled:        rtkGrid.useFixedPosition
800 801
                            }
                            FactTextField {
802 803
                                fact:               rtkGrid.rtkSettings.fixedBasePositionAccuracy
                                visible:            rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible
804 805 806
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }
807

808
                            Item { width: rtkGrid.firstColWidth; height: 1 }
809 810
                            QGCButton {
                                text:               qsTr("Save Current Base Position")
811
                                enabled:            QGroundControl.gpsRtk && QGroundControl.gpsRtk.valid.value
812
                                Layout.columnSpan:  2
813 814 815 816 817 818
                                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
                                }
819
                            }
820
                        }
821
                    }
822 823

                    Item { width: 1; height: _margins }
824

825
                    QGCLabel {
826 827
                        id:         videoSectionLabel
                        text:       qsTr("Video")
828
                        visible:    QGroundControl.settingsManager.videoSettings.visible && !QGroundControl.videoManager.autoStreamConfigured
829
                    }
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844
                    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
845
                            QGCLabel {
846 847
                                text:                   qsTr("Video Source")
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
848
                            }
849
                            FactComboBox {
850 851 852 853 854
                                id:                     videoSource
                                Layout.preferredWidth:  _comboFieldWidth
                                indexModel:             false
                                fact:                   QGroundControl.settingsManager.videoSettings.videoSource
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
855
                            }
856

857
                            QGCLabel {
858
                                text:                   qsTr("UDP Port")
859
                                visible:                (_isUDP264 || _isUDP265 || _isMPEGTS)  && QGroundControl.settingsManager.videoSettings.udpPort.visible
860
                            }
861
                            FactTextField {
862 863
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.udpPort
864
                                visible:                (_isUDP264 || _isUDP265 || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible
865
                            }
866

867
                            QGCLabel {
868 869
                                text:                   qsTr("RTSP URL")
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
870
                            }
871
                            FactTextField {
872 873
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.rtspUrl
874
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
875
                            }
876

877
                            QGCLabel {
878 879
                                text:                   qsTr("TCP URL")
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
880 881
                            }
                            FactTextField {
882 883
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.tcpUrl
884
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
885
                            }
886
                            QGCLabel {
887
                                text:                   qsTr("Aspect Ratio")
888
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
889 890
                            }
                            FactTextField {
891 892
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.aspectRatio
893
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
894
                            }
895

896
                            QGCLabel {
897 898
                                text:                   qsTr("Disable When Disarmed")
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
899
                            }
900
                            FactCheckBox {
901 902 903
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.disableWhenDisarmed
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
904
                            }
905 906
                        }
                    }
907

908
                    Item { width: 1; height: _margins }
909

910
                    QGCLabel {
911 912
                        id:                             videoRecSectionLabel
                        text:                           qsTr("Video Recording")
913
                        visible:                        (QGroundControl.settingsManager.videoSettings.visible && _isGst) || QGroundControl.videoManager.autoStreamConfigured
914
                    }
915
                    Rectangle {
916
                        Layout.preferredWidth:          videoRecCol.width  + (_margins * 2)
917 918 919 920
                        Layout.preferredHeight:         videoRecCol.height + (_margins * 2)
                        Layout.fillWidth:               true
                        color:                          qgcPal.windowShade
                        visible:                        videoRecSectionLabel.visible
921 922 923 924 925 926 927 928

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

930
                            QGCLabel {
931 932
                                text:                   qsTr("Auto-Delete Files")
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
933 934
                            }
                            FactCheckBox {
935 936 937
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.enableStorageLimit
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
938
                            }
939

940
                            QGCLabel {
941 942
                                text:                   qsTr("Max Storage Usage")
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
943 944
                            }
                            FactTextField {
945 946 947
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.maxVideoSize
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
948
                            }
949

950
                            QGCLabel {
951 952
                                text:                   qsTr("Video File Format")
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
953 954
                            }
                            FactComboBox {
955 956 957
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.recordingFormat
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
958
                            }
959 960 961
                        }
                    }

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

964
                    QGCLabel {
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982
                        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
983 984

                            QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
985
                                text:           qsTr("Indoor Image")
986
                                visible:        _userBrandImageIndoor.visible
987 988 989
                            }
                            QGCTextField {
                                readOnly:           true
990
                                Layout.fillWidth:   true
991
                                text:               _userBrandImageIndoor.valueString.replace("file:///","")
992 993
                            }
                            QGCButton {
994
                                text:       qsTr("Browse")
995 996
                                onClicked:  userBrandImageIndoorBrowseDialog.openForLoad()
                                QGCFileDialog {
997 998 999 1000 1001 1002
                                    id:                 userBrandImageIndoorBrowseDialog
                                    title:              qsTr("Choose custom brand image file")
                                    folder:             _userBrandImageIndoor.rawValue.replace("file:///","")
                                    selectExisting:     true
                                    selectFolder:       false
                                    onAcceptedForLoad:  _userBrandImageIndoor.rawValue = "file:///" + file
1003
                                }
1004 1005
                            }

1006
                            QGCLabel {
1007
                                text:       qsTr("Outdoor Image")
1008
                                visible:    _userBrandImageOutdoor.visible
1009
                            }
1010 1011
                            QGCTextField {
                                readOnly:           true
1012
                                Layout.fillWidth:   true
1013
                                text:                _userBrandImageOutdoor.valueString.replace("file:///","")
1014 1015
                            }
                            QGCButton {
1016
                                text:       qsTr("Browse")
1017 1018
                                onClicked:  userBrandImageOutdoorBrowseDialog.openForLoad()
                                QGCFileDialog {
1019 1020 1021 1022 1023 1024
                                    id:                 userBrandImageOutdoorBrowseDialog
                                    title:              qsTr("Choose custom brand image file")
                                    folder:             _userBrandImageOutdoor.rawValue.replace("file:///","")
                                    selectExisting:     true
                                    selectFolder:       false
                                    onAcceptedForLoad:  _userBrandImageOutdoor.rawValue = "file:///" + file
1025 1026 1027
                                }
                            }
                            QGCButton {
1028 1029 1030
                                text:               qsTr("Reset Default Brand Image")
                                Layout.columnSpan:  3
                                Layout.alignment:   Qt.AlignHCenter
1031 1032 1033 1034
                                onClicked:  {
                                    _userBrandImageIndoor.rawValue = ""
                                    _userBrandImageOutdoor.rawValue = ""
                                }
1035 1036
                            }
                        }
1037
                    }
1038

1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
                    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
            }
1051 1052
    }
}