GeneralSettings.qml 60.1 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
    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 163

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

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

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

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

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

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

258 259 260 261 262 263 264
                                FactCheckBox {
                                    text:       qsTr("Check for Internet connection")
                                    fact:       _checkInternet
                                    visible:    _checkInternet.visible
                                    property Fact _checkInternet: QGroundControl.settingsManager.appSettings.checkInternet
                                }

265 266 267 268 269 270 271
                                FactCheckBox {
                                    text:       qsTr("AutoLoad Missions")
                                    fact:       _autoLoad
                                    visible:    _autoLoad.visible

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

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

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
                                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
                                    }
318
                                }
319 320 321
                            }
                        }

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

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

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

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

                    Item { width: 1; height: _margins }
420 421 422 423 424 425 426 427 428 429 430
                    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
431

432 433 434 435 436 437
                        ColumnLayout {
                            id:                         flyViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
438

439
                            FactCheckBox {
440
                                text:       qsTr("Use Preflight Checklist")
441
                                fact:       _useChecklist
442
                                visible:    _useChecklist.visible && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
443

444
                                property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
445
                            }
Don Gagne's avatar
Don Gagne committed
446

447 448 449 450 451 452 453 454
                            FactCheckBox {
                                text:       qsTr("Show Telemetry Log Replay Status Bar")
                                fact:       _showLogReplayStatusBar
                                visible:    _showLogReplayStatusBar.visible

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

455 456 457 458 459 460
                            FactCheckBox {
                                text:       qsTr("Virtual Joystick")
                                visible:    _virtualJoystick.visible
                                fact:       _virtualJoystick

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

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

469 470
                                property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized
                            }
471
                            FactCheckBox {
472
                                text:       qsTr("Use Vertical Instrument Panel")
473 474 475 476 477
                                visible:    _alternateInstrumentPanel.visible
                                fact:       _alternateInstrumentPanel

                                property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel
                            }
478
                            FactCheckBox {
479
                                text:       qsTr("Show/Hide Home heading on Compass")
480 481 482 483 484 485
                                visible:    _showHomeHeadingCompass.visible
                                fact:       _showHomeHeadingCompass

                                property Fact _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass
                            }
                            FactCheckBox {
486
                                text:       qsTr("Show/Hide Course Over Ground angle on Compass")
487 488 489 490 491
                                visible:    _showCOGAngleCompass.visible
                                fact:       _showCOGAngleCompass

                                property Fact _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass
                            }
492 493 494 495 496 497 498 499 500 501 502 503 504 505
                            FactCheckBox {
                                text:       qsTr("Show/Hide Heading to Next Waypoint on Compass")
                                visible:    _showHeadingToNextWP.visible
                                fact:       _showHeadingToNextWP

                                property Fact _showHeadingToNextWP: QGroundControl.settingsManager.flyViewSettings.showHeadingToNextWP
                            }
                            FactCheckBox {
                                text:       qsTr("Lock North up on Compass")
                                visible:    _lockNorthUpCompass.visible
                                fact:       _lockNorthUpCompass

                                property Fact _lockNorthUpCompass: QGroundControl.settingsManager.flyViewSettings.lockNorthUpCompass
                            }
506

507

508 509 510 511 512 513 514 515 516 517 518 519 520 521
                            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
                                }
522
                            }
523 524
                        }
                    }
525

526
                    Item { width: 1; height: _margins }
527

528 529 530 531 532 533 534 535 536 537 538
                    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
539

540 541 542 543 544 545
                        ColumnLayout {
                            id:                         planViewCol
                            anchors.margins:            _margins
                            anchors.top:                parent.top
                            anchors.horizontalCenter:   parent.horizontalCenter
                            spacing:                    _margins
546

547 548 549 550 551 552 553 554
                            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
555
                                }
556
                            }
557
                        }
558
                    }
559

560
                    Item { width: 1; height: _margins }
561

562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
                    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
                                    }
                                }
602
                            }
603

604 605 606 607 608 609 610 611 612 613
                            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")
614
                                }
615 616 617
                                QGCComboBox {
                                    id:                     nmeaPortCombo
                                    Layout.preferredWidth:  _comboFieldWidth
618

619 620 621 622 623 624 625 626 627
                                    model:  ListModel {
                                    }

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

631 632 633 634 635
                                        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;
636 637 638
                                        if (QGroundControl.linkManager.serialPorts.length === 0) {
                                            nmeaPortCombo.model.append({text: "Serial <none available>"})
                                        }
639 640 641
                                    }
                                }

642
                                QGCLabel {
643
                                    visible:          nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
644 645 646
                                    text:             qsTr("NMEA GPS Baudrate")
                                }
                                QGCComboBox {
647
                                    visible:                nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
648 649 650 651 652 653 654 655
                                    id:                     nmeaBaudCombo
                                    Layout.preferredWidth:  _comboFieldWidth
                                    model:                  [4800, 9600, 19200, 38400, 57600, 115200]

                                    onActivated: {
                                        if (index != -1) {
                                            QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index);
                                        }
656
                                    }
657 658 659
                                    Component.onCompleted: {
                                        var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
                                        nmeaBaudCombo.currentIndex = index;
660 661
                                    }
                                }
662 663 664 665 666 667 668 669 670 671

                                QGCLabel {
                                    text:       qsTr("NMEA stream UDP port")
                                    visible:    nmeaPortCombo.currentText === gpsUdpPort
                                }
                                FactTextField {
                                    visible:                nmeaPortCombo.currentText === gpsUdpPort
                                    Layout.preferredWidth:  _valueFieldWidth
                                    fact:                   QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
                                }
672
                            }
673 674
                        }
                    }
675

676 677
                    Item { width: 1; height: _margins }

Don Gagne's avatar
Don Gagne committed
678
                    QGCLabel {
679
                        id:         rtkSectionLabel
680
                        text:       qsTr("RTK GPS")
681
                        visible:    QGroundControl.settingsManager.rtkSettings.visible
Don Gagne's avatar
Don Gagne committed
682
                    }
683 684 685 686 687 688 689 690 691 692 693
                    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
694
                            Layout.fillWidth:           true
695
                            anchors.horizontalCenter:   parent.horizontalCenter
696
                            columns:                    3
697

698 699
                            property var rtkSettings:       QGroundControl.settingsManager.rtkSettings
                            property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue
700
                            property real firstColWidth:    ScreenTools.defaultFontPixelWidth * 3
701

702 703 704
                            QGCRadioButton {
                                text:               qsTr("Perform Survey-In")
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
705
                            checked:            rtkGrid.rtkSettings.useFixedBasePosition.value === false
706 707
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = false
                                Layout.columnSpan:  3
708
                            }
709

710
                            Item { width: rtkGrid.firstColWidth; height: 1 }
711 712 713
                            QGCLabel {
                                text:       rtkGrid.rtkSettings.surveyInAccuracyLimit.shortDescription
                                visible:    rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
714
                                enabled:    !rtkGrid.useFixedPosition
715
                            }
716
                            FactTextField {
717
                                fact:                   rtkGrid.rtkSettings.surveyInAccuracyLimit
718
                                visible:                rtkGrid.rtkSettings.surveyInAccuracyLimit.visible
719
                                enabled:                !rtkGrid.useFixedPosition
720
                                Layout.preferredWidth:  _valueFieldWidth
721
                            }
722

723
                            Item { width: rtkGrid.firstColWidth; height: 1 }
724
                            QGCLabel {
725 726
                                text:       rtkGrid.rtkSettings.surveyInMinObservationDuration.shortDescription
                                visible:    rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
727
                                enabled:    !rtkGrid.useFixedPosition
728
                            }
729
                            FactTextField {
730
                                fact:                   rtkGrid.rtkSettings.surveyInMinObservationDuration
731
                                visible:                rtkGrid.rtkSettings.surveyInMinObservationDuration.visible
732
                                enabled:                !rtkGrid.useFixedPosition
733
                                Layout.preferredWidth:  _valueFieldWidth
734
                            }
735

736 737
                            QGCRadioButton {
                                text:               qsTr("Use Specified Base Position")
738
                                visible:            rtkGrid.rtkSettings.useFixedBasePosition.visible
739
                            checked:            rtkGrid.rtkSettings.useFixedBasePosition.value === true
740 741
                                onClicked:          rtkGrid.rtkSettings.useFixedBasePosition.value = true
                                Layout.columnSpan:  3
742
                            }
743

744
                            Item { width: rtkGrid.firstColWidth; height: 1 }
745 746 747 748 749 750 751 752 753 754 755
                            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
                            }
756

757
                            Item { width: rtkGrid.firstColWidth; height: 1 }
758
                            QGCLabel {
759 760 761
                                text:           rtkGrid.rtkSettings.fixedBasePositionLongitude.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionLongitude.visible
                                enabled:        rtkGrid.useFixedPosition
762 763 764 765 766 767 768
                            }
                            FactTextField {
                                fact:               rtkGrid.rtkSettings.fixedBasePositionLongitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionLongitude.visible
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }
769

770
                            Item { width: rtkGrid.firstColWidth; height: 1 }
771
                            QGCLabel {
772 773 774
                                text:           rtkGrid.rtkSettings.fixedBasePositionAltitude.shortDescription
                                visible:        rtkGrid.rtkSettings.fixedBasePositionAltitude.visible
                                enabled:        rtkGrid.useFixedPosition
775 776 777 778 779 780 781
                            }
                            FactTextField {
                                fact:               rtkGrid.rtkSettings.fixedBasePositionAltitude
                                visible:            rtkGrid.rtkSettings.fixedBasePositionAltitude.visible
                                enabled:            rtkGrid.useFixedPosition
                                Layout.fillWidth:   true
                            }
782

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

796
                            Item { width: rtkGrid.firstColWidth; height: 1 }
797 798
                            QGCButton {
                                text:               qsTr("Save Current Base Position")
799
                                enabled:            QGroundControl.gpsRtk && QGroundControl.gpsRtk.valid.value
800
                                Layout.columnSpan:  2
801

802 803 804 805 806 807
                                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
                                }
808
                            }
809
                        }
810
                    }
811 812

                    Item { width: 1; height: _margins }
813

814
                    QGCLabel {
815 816
                        id:         videoSectionLabel
                        text:       qsTr("Video")
817
                        visible:    QGroundControl.settingsManager.videoSettings.visible && !QGroundControl.videoManager.autoStreamConfigured
818
                    }
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
                    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
834
                            QGCLabel {
835 836
                                text:                   qsTr("Video Source")
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
837
                            }
838
                            FactComboBox {
839 840 841 842 843
                                id:                     videoSource
                                Layout.preferredWidth:  _comboFieldWidth
                                indexModel:             false
                                fact:                   QGroundControl.settingsManager.videoSettings.videoSource
                                visible:                QGroundControl.settingsManager.videoSettings.videoSource.visible
844
                            }
845

846
                            QGCLabel {
847
                                text:                   qsTr("UDP Port")
848
                                visible:                (_isUDP264 || _isUDP265 || _isMPEGTS)  && QGroundControl.settingsManager.videoSettings.udpPort.visible
849
                            }
850
                            FactTextField {
851 852
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.udpPort
853
                                visible:                (_isUDP264 || _isUDP265 || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible
854
                            }
855

856
                            QGCLabel {
857 858
                                text:                   qsTr("RTSP URL")
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
859
                            }
860
                            FactTextField {
861 862
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.rtspUrl
863
                                visible:                _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible
864
                            }
865

866
                            QGCLabel {
867 868
                                text:                   qsTr("TCP URL")
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
869 870
                            }
                            FactTextField {
871 872
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.tcpUrl
873
                                visible:                _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible
874
                            }
875
                            QGCLabel {
876
                                text:                   qsTr("Aspect Ratio")
877
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
878 879
                            }
                            FactTextField {
880 881
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.aspectRatio
882
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
883
                            }
884

885
                            QGCLabel {
886 887
                                text:                   qsTr("Disable When Disarmed")
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
888
                            }
889
                            FactCheckBox {
890 891 892
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.disableWhenDisarmed
                                visible:                _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible
893
                            }
894 895
                        }
                    }
896

897
                    Item { width: 1; height: _margins }
898

899
                    QGCLabel {
900 901
                        id:                             videoRecSectionLabel
                        text:                           qsTr("Video Recording")
902
                        visible:                        (QGroundControl.settingsManager.videoSettings.visible && _isGst) || QGroundControl.videoManager.autoStreamConfigured
903
                    }
904
                    Rectangle {
905
                        Layout.preferredWidth:          videoRecCol.width  + (_margins * 2)
906 907 908 909
                        Layout.preferredHeight:         videoRecCol.height + (_margins * 2)
                        Layout.fillWidth:               true
                        color:                          qgcPal.windowShade
                        visible:                        videoRecSectionLabel.visible
910 911 912 913 914 915 916 917

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

919
                            QGCLabel {
920 921
                                text:                   qsTr("Auto-Delete Files")
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
922 923
                            }
                            FactCheckBox {
924 925 926
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.enableStorageLimit
                                visible:                QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
927
                            }
928

929
                            QGCLabel {
930 931
                                text:                   qsTr("Max Storage Usage")
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
932 933
                            }
                            FactTextField {
934 935 936
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.maxVideoSize
                                visible:                QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
937
                            }
938

939
                            QGCLabel {
940 941
                                text:                   qsTr("Video File Format")
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
942 943
                            }
                            FactComboBox {
944 945 946
                                Layout.preferredWidth:  _comboFieldWidth
                                fact:                   QGroundControl.settingsManager.videoSettings.recordingFormat
                                visible:                QGroundControl.settingsManager.videoSettings.recordingFormat.visible
947
                            }
948 949 950
                        }
                    }

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

953
                    QGCLabel {
954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
                        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
972 973

                            QGCLabel {
974 975
                                text:       qsTr("Indoor Image")
                                visible:    _userBrandImageIndoor.visible
976 977 978
                            }
                            QGCTextField {
                                readOnly:           true
979
                                Layout.fillWidth:   true
980
                                text:               _userBrandImageIndoor.valueString.replace("file:///","")
981 982
                            }
                            QGCButton {
983
                                text:       qsTr("Browse")
984 985 986
                                onClicked:  userBrandImageIndoorBrowseDialog.openForLoad()
                                QGCFileDialog {
                                    id:             userBrandImageIndoorBrowseDialog
987
                                    title:          qsTr("Choose custom brand image file")
988 989 990
                                    folder:         _userBrandImageIndoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false
991
                                    onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file
992
                                }
993 994
                            }

995
                            QGCLabel {
996 997
                                text:       qsTr("Outdoor Image")
                                visible:    _userBrandImageOutdoor.visible
998
                            }
999 1000
                            QGCTextField {
                                readOnly:           true
1001
                                Layout.fillWidth:   true
1002
                                text:               _userBrandImageOutdoor.valueString.replace("file:///","")
1003 1004
                            }
                            QGCButton {
1005
                                text:       qsTr("Browse")
1006 1007 1008
                                onClicked:  userBrandImageOutdoorBrowseDialog.openForLoad()
                                QGCFileDialog {
                                    id:             userBrandImageOutdoorBrowseDialog
1009
                                    title:          qsTr("Choose custom brand image file")
1010 1011 1012 1013 1014 1015 1016
                                    folder:         _userBrandImageOutdoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false
                                    onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file
                                }
                            }
                            QGCButton {
1017 1018 1019
                                text:               qsTr("Reset Default Brand Image")
                                Layout.columnSpan:  3
                                Layout.alignment:   Qt.AlignHCenter
1020 1021 1022 1023
                                onClicked:  {
                                    _userBrandImageIndoor.rawValue = ""
                                    _userBrandImageOutdoor.rawValue = ""
                                }
1024 1025
                            }
                        }
1026
                    }
1027

1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039
                    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
            }
1040 1041
    }
}