GeneralSettings.qml 48.2 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 16
import QtMultimedia             5.5
import QtQuick.Layouts          1.2
dogmaphobic's avatar
dogmaphobic committed
17 18 19

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

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

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

    readonly property real _internalWidthRatio:          0.8
47 48

    readonly property string _requiresRestart:  qsTr("(Requires Restart)")
49

50
    QGCPalette { id: qgcPal }
dogmaphobic's avatar
dogmaphobic committed
51

52 53 54 55 56 57 58 59 60 61
    QGCViewPanel {
        id:             panel
        anchors.fill:   parent
        QGCFlickable {
            clip:               true
            anchors.fill:       parent
            contentHeight:      settingsColumn.height
            contentWidth:       settingsColumn.width
            Column {
                id:                 settingsColumn
62
                width:              _qgcView.width
63
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
64
                anchors.margins:    ScreenTools.defaultFontPixelWidth
65

66
                //-----------------------------------------------------------------
67 68
                //-- Units
                Item {
Don Gagne's avatar
Don Gagne committed
69
                    width:                      _panelWidth
70 71 72 73
                    height:                     unitLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.unitsSettings.visible
74
                    QGCLabel {
75 76 77
                        id:             unitLabel
                        text:           qsTr("Units (Requires Restart)")
                        font.family:    ScreenTools.demiboldFontFamily
78
                    }
79 80
                }
                Rectangle {
81
                    height:                     unitsCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
82
                    width:                      _panelWidth
83 84 85 86
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.unitsSettings.visible
87 88 89 90
                    Column {
                        id:         unitsCol
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
91 92 93

                        Repeater {
                            id:     unitsRepeater
94
                            model:  [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ]
95

96
                            property var names: [ qsTr("Distance:"), qsTr("Area:"), qsTr("Speed:"), qsTr("Temperature:") ]
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

                            Row {
                                spacing:    ScreenTools.defaultFontPixelWidth
                                visible:    modelData.visible

                                QGCLabel {
                                    width:              _labelWidth
                                    anchors.baseline:   factCombo.baseline
                                    text:               unitsRepeater.names[index]
                                }
                                FactComboBox {
                                    id:                 factCombo
                                    width:              _editFieldWidth
                                    fact:               modelData
                                    indexModel:         false
                                }
113 114 115 116
                            }
                        }
                    }
                }
117

118
                //-----------------------------------------------------------------
Patrick José Pereira's avatar
Patrick José Pereira committed
119
                //-- Miscellaneous
120
                Item {
Don Gagne's avatar
Don Gagne committed
121
                    width:                      _panelWidth
122 123 124 125
                    height:                     miscLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.appSettings.visible
126
                    QGCLabel {
127
                        id:             miscLabel
128
                        text:           qsTr("Miscellaneous")
129
                        font.family:    ScreenTools.demiboldFontFamily
130
                    }
131 132
                }
                Rectangle {
133
                    height:                     miscCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
134
                    width:                      _panelWidth
135 136 137 138
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.appSettings.visible
139 140 141 142 143 144 145
                    Column {
                        id:         miscCol
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
                        //-----------------------------------------------------------------
                        //-- Base UI Font Point Size
                        Row {
Gus Grubba's avatar
Gus Grubba committed
146
                            visible: _appFontPointSize ? _appFontPointSize.visible : false
147 148 149
                            spacing: ScreenTools.defaultFontPixelWidth
                            QGCLabel {
                                id:     baseFontLabel
150
                                text:   qsTr("Font Size:")
151 152 153 154 155 156 157 158 159 160 161 162
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            Row {
                                id:         baseFontRow
                                spacing:    ScreenTools.defaultFontPixelWidth / 2
                                anchors.verticalCenter: parent.verticalCenter
                                QGCButton {
                                    id:     decrementButton
                                    width:  height
                                    height: baseFontEdit.height
                                    text:   "-"
                                    onClicked: {
163 164
                                        if (_appFontPointSize.value > _appFontPointSize.min) {
                                            _appFontPointSize.value = _appFontPointSize.value - 1
165 166 167
                                        }
                                    }
                                }
168 169 170 171
                                FactTextField {
                                    id:     baseFontEdit
                                    width:  _editFieldWidth - (decrementButton.width * 2) - (baseFontRow.spacing * 2)
                                    fact:   QGroundControl.settingsManager.appSettings.appFontPointSize
172 173 174 175 176 177
                                }
                                QGCButton {
                                    width:  height
                                    height: baseFontEdit.height
                                    text:   "+"
                                    onClicked: {
178 179
                                        if (_appFontPointSize.value < _appFontPointSize.max) {
                                            _appFontPointSize.value = _appFontPointSize.value + 1
180 181 182 183 184 185
                                        }
                                    }
                                }
                            }
                            QGCLabel {
                                anchors.verticalCenter: parent.verticalCenter
186
                                text:                   _requiresRestart
187 188 189
                            }
                        }
                        //-----------------------------------------------------------------
190 191 192
                        //-- Palette Styles
                        Row {
                            spacing: ScreenTools.defaultFontPixelWidth
193
                            visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
194
                            QGCLabel {
195
                                text:           qsTr("Color Scheme:")
Gus Grubba's avatar
Gus Grubba committed
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
                                width:          _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactComboBox {
                                width:          _editFieldWidth
                                fact:           QGroundControl.settingsManager.appSettings.indoorPalette
                                indexModel:     false
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                        //-----------------------------------------------------------------
                        //-- Map Provider
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    _mapProvider.visible
                            QGCLabel {
                                text:       qsTr("Map Provider:")
                                width:      _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactComboBox {
                                width:      _editFieldWidth
                                fact:       _mapProvider
                                indexModel: false
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                        //-----------------------------------------------------------------
                        //-- Map Type
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    _mapType.visible
                            QGCLabel {
                                text:               qsTr("Map Type:")
230
                                width:              _labelWidth
Gus Grubba's avatar
Gus Grubba committed
231
                                anchors.verticalCenter: parent.verticalCenter
232
                            }
233
                            FactComboBox {
Gus Grubba's avatar
Gus Grubba committed
234
                                id:         mapTypes
235
                                width:      _editFieldWidth
Gus Grubba's avatar
Gus Grubba committed
236
                                fact:       _mapType
237
                                indexModel: false
Gus Grubba's avatar
Gus Grubba committed
238 239 240 241 242 243 244
                                anchors.verticalCenter: parent.verticalCenter
                                Connections {
                                    target: QGroundControl.settingsManager.flightMapSettings
                                    onMapTypeChanged: {
                                        mapTypes.model = _mapType.enumStrings
                                    }
                                }
245 246 247
                            }
                        }
                        //-----------------------------------------------------------------
248
                        //-- Audio preferences
249
                        FactCheckBox {
250 251 252 253
                            text:       qsTr("Mute all audio output")
                            fact:       _audioMuted
                            visible:    _audioMuted.visible
                            property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
254 255
                        }
                        //-----------------------------------------------------------------
256
                        //-- Save telemetry log
257
                        FactCheckBox {
258
                            id:         promptSaveLog
259 260
                            text:       qsTr("Save telemetry log after each flight")
                            fact:       _telemetrySave
261
                            visible:    _telemetrySave.visible
262
                            property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
263 264
                        }
                        //-----------------------------------------------------------------
265
                        //-- Save even if not armed
266
                        FactCheckBox {
267 268
                            text:       qsTr("Save telemetry log even if vehicle was not armed")
                            fact:       _telemetrySaveNotArmed
269
                            visible:    _telemetrySaveNotArmed.visible
270
                            enabled:    promptSaveLog.checked
271
                            property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
                        }
                        //-----------------------------------------------------------------
                        //-- Clear settings
                        QGCCheckBox {
                            id:         clearCheck
                            text:       qsTr("Clear all settings on next start")
                            checked:    false
                            onClicked: {
                                checked ? clearDialog.visible = true : QGroundControl.clearDeleteAllSettingsNextBoot()
                            }
                            MessageDialog {
                                id:         clearDialog
                                visible:    false
                                icon:       StandardIcon.Warning
                                standardButtons: StandardButton.Yes | StandardButton.No
                                title:      qsTr("Clear Settings")
288
                                text:       qsTr("All saved settings will be reset the next time you start %1. Is this really what you want?").arg(QGroundControl.appName)
289 290 291 292 293 294 295 296 297 298 299 300 301
                                onYes: {
                                    QGroundControl.deleteAllSettingsNextBoot()
                                    clearDialog.visible = false
                                }
                                onNo: {
                                    clearCheck.checked  = false
                                    clearDialog.visible = false
                                }
                            }
                        }
                        //-----------------------------------------------------------------
                        //-- Battery talker
                        Row {
302 303
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible
304 305 306
                            QGCCheckBox {
                                id:                 announcePercentCheckbox
                                text:               qsTr("Announce battery lower than:")
Gus Grubba's avatar
Gus Grubba committed
307 308 309
                                checked:            _percentRemainingAnnounce.value !== 0
                                width:              (_labelWidth + _editFieldWidth) * 0.65
                                anchors.verticalCenter: parent.verticalCenter
310 311 312 313 314 315 316 317 318 319 320
                                onClicked: {
                                    if (checked) {
                                        _percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString
                                    } else {
                                        _percentRemainingAnnounce.value = 0
                                    }
                                }
                            }
                            FactTextField {
                                id:                 announcePercent
                                fact:               _percentRemainingAnnounce
Gus Grubba's avatar
Gus Grubba committed
321
                                width:              (_labelWidth + _editFieldWidth) * 0.35
322 323 324 325 326 327
                                enabled:            announcePercentCheckbox.checked
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                        //-----------------------------------------------------------------
                        //-- Virtual joystick settings
328
                        FactCheckBox {
329
                            text:       qsTr("Virtual Joystick")
330 331 332 333
                            visible:    _virtualJoystick.visible
                            fact:       _virtualJoystick

                            property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
334 335
                        }
                        //-----------------------------------------------------------------
336 337 338
                        //-- Default mission item altitude
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
Donald Gagne's avatar
Donald Gagne committed
339
                            visible:    QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible
340
                            QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
341 342
                                anchors.verticalCenter: parent.verticalCenter
                                width:  (_labelWidth + _editFieldWidth) * 0.65
343
                                text:   qsTr("Default Mission Altitude:")
344 345 346
                            }
                            FactTextField {
                                id:     defaultItemAltitudeField
Gus Grubba's avatar
Gus Grubba committed
347
                                width:  (_labelWidth + _editFieldWidth) * 0.35
348
                                fact:   QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
Gus Grubba's avatar
Gus Grubba committed
349
                                anchors.verticalCenter: parent.verticalCenter
350 351
                            }
                        }
352

353
                        //-----------------------------------------------------------------
354
                        //-- Mission AutoLoad
355
                        FactCheckBox {
356
                            text:       qsTr("AutoLoad Missions")
357 358 359 360 361 362 363 364
                            fact:       _autoLoad
                            visible:    _autoLoad.visible

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

                        //-----------------------------------------------------------------
                        //-- Save path
Don Gagne's avatar
Don Gagne committed
365
                        RowLayout {
DonLakeFlyer's avatar
DonLakeFlyer committed
366
                            spacing:    ScreenTools.defaultFontPixelWidth
367
                            visible:    _savePath.visible && !ScreenTools.isMobile
DonLakeFlyer's avatar
DonLakeFlyer committed
368

369 370
                            QGCLabel {
                                anchors.baseline:   savePathBrowse.baseline
371
                                text:               qsTr("File Save Path:")
Don Gagne's avatar
Don Gagne committed
372
                            }
373
                            QGCLabel {
Don Gagne's avatar
Don Gagne committed
374 375 376 377
                                anchors.baseline:       savePathBrowse.baseline
                                Layout.maximumWidth:    _panelWidth * 0.5
                                elide:                  Text.ElideMiddle
                                text:                   _savePath.rawValue === "" ? qsTr("<not set>") : _savePath.value
378 379
                            }
                            QGCButton {
380 381 382 383 384 385 386 387 388 389
                                id:         savePathBrowse
                                text:       "Browse"
                                onClicked:  savePathBrowseDialog.openForLoad()

                                QGCFileDialog {
                                    id:             savePathBrowseDialog
                                    qgcView:        _qgcView
                                    title:          qsTr("Choose the location to save files:")
                                    folder:         _savePath.rawValue
                                    selectExisting: true
390
                                    selectFolder:   true
391 392

                                    onAcceptedForLoad: _savePath.rawValue = file
393
                                }
Don Gagne's avatar
Don Gagne committed
394 395
                            }
                        }
dogmaphobic's avatar
dogmaphobic committed
396 397
                    }
                }
398

Don Gagne's avatar
Don Gagne committed
399 400 401
                //-----------------------------------------------------------------
                //-- RTK GPS
                Item {
Don Gagne's avatar
Don Gagne committed
402
                    width:                      _panelWidth
Don Gagne's avatar
Don Gagne committed
403 404 405 406 407 408 409 410 411 412 413 414
                    height:                     unitLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.rtkSettings.visible
                    QGCLabel {
                        id:             rtkLabel
                        text:           qsTr("RTK GPS (Requires Restart)")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     rtkGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
415
                    width:                      _panelWidth
Don Gagne's avatar
Don Gagne committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.rtkSettings.visible
                    GridLayout {
                        id:                 rtkGrid
                        anchors.centerIn:   parent
                        columns:            2
                        rowSpacing:         ScreenTools.defaultFontPixelWidth
                        columnSpacing:      ScreenTools.defaultFontPixelWidth

                        QGCLabel {
                            text:               qsTr("Survey in accuracy:")
                        }
                        FactTextField {
                            fact:               QGroundControl.settingsManager.rtkSettings.surveyInAccuracyLimit
                        }

                        QGCLabel {
Patrick José Pereira's avatar
Patrick José Pereira committed
435
                            text:               qsTr("Minimum observation duration:")
Don Gagne's avatar
Don Gagne committed
436 437 438 439 440 441 442
                        }
                        FactTextField {
                            fact:               QGroundControl.settingsManager.rtkSettings.surveyInMinObservationDuration
                        }
                    }
                }

443 444 445
                //-----------------------------------------------------------------
                //-- Autoconnect settings
                Item {
Don Gagne's avatar
Don Gagne committed
446
                    width:                      _panelWidth
447 448 449 450
                    height:                     autoConnectLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.autoConnectSettings.visible
451
                    QGCLabel {
452
                        id:             autoConnectLabel
Don Gagne's avatar
Don Gagne committed
453
                        text:           qsTr("AutoConnect to the following devices:")
454
                        font.family:    ScreenTools.demiboldFontFamily
455 456
                    }
                }
457
                Rectangle {
458
                    height:                     autoConnectCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
459
                    width:                      _panelWidth
460 461 462 463
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.autoConnectSettings.visible
464

465 466
                    Column {
                        id:         autoConnectCol
467
                        spacing:    ScreenTools.defaultFontPixelWidth * 2
468
                        anchors.centerIn: parent
469

470 471
                        Row {
                            spacing: ScreenTools.defaultFontPixelWidth * 2
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487

                            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
488
                                    visible:    modelData.visible
489
                                }
490 491
                            }
                        }
492 493

                        Row {
Jacob Walser's avatar
Jacob Walser committed
494 495 496 497 498
                            anchors.horizontalCenter: parent.horizontalCenter
                            spacing:                  ScreenTools.defaultFontPixelWidth
                            visible:                  !ScreenTools.isMobile
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible
499 500 501

                            QGCLabel {
                                anchors.baseline: nmeaPortCombo.baseline
Jacob Walser's avatar
Jacob Walser committed
502 503
                                text:             qsTr("NMEA GPS Device:")
                                width:            _labelWidth
504 505 506 507
                            }

                            QGCComboBox {
                                id:     nmeaPortCombo
Jacob Walser's avatar
Jacob Walser committed
508
                                width:  _editFieldWidth
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
                                model:  ListModel {
                                            ListElement { text: "disabled" }
                                        }

                                onActivated: {
                                    if (index != -1) {
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index);
                                    }
                                }
                                Component.onCompleted: {
                                    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;
                                }
                            }
Jacob Walser's avatar
Jacob Walser committed
526 527 528 529 530 531 532
                        }
                        Row {
                            anchors.horizontalCenter: parent.horizontalCenter
                            spacing:                  ScreenTools.defaultFontPixelWidth
                            visible:                  !ScreenTools.isMobile
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible
533 534
                            QGCLabel {
                                anchors.baseline: nmeaBaudCombo.baseline
Jacob Walser's avatar
Jacob Walser committed
535 536
                                text:             qsTr("NMEA GPS Baudrate:")
                                width:            _labelWidth
537 538 539 540
                            }

                            QGCComboBox {
                                id:     nmeaBaudCombo
Jacob Walser's avatar
Jacob Walser committed
541
                                width:  _editFieldWidth
542 543 544 545 546 547 548 549 550 551 552 553 554
                                model:  [4800, 9600, 19200, 38400, 57600, 115200]

                                onActivated: {
                                    if (index != -1) {
                                        QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index);
                                    }
                                }
                                Component.onCompleted: {
                                    var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
                                    nmeaBaudCombo.currentIndex = index;
                                }
                            }
                        }
555 556
                    }
                }
557

558 559 560
                //-----------------------------------------------------------------
                //-- Video Source
                Item {
Don Gagne's avatar
Don Gagne committed
561
                    width:                      _panelWidth
562 563 564 565
                    height:                     videoLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.videoSettings.visible
566 567
                    QGCLabel {
                        id:             videoLabel
568
                        text:           qsTr("Video")
569 570 571 572
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
573
                    height:                     videoCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
574
                    width:                      _panelWidth
575 576 577 578
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.videoSettings.visible
579

580 581 582 583
                    Column {
                        id:         videoCol
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
584

585 586
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
587
                            visible:    QGroundControl.settingsManager.videoSettings.videoSource.visible
588 589 590
                            QGCLabel {
                                text:               qsTr("Video Source:")
                                width:              _labelWidth
591
                                anchors.verticalCenter: parent.verticalCenter
592
                            }
593 594 595 596 597
                            FactComboBox {
                                id:         videoSource
                                width:      _editFieldWidth
                                indexModel: false
                                fact:       QGroundControl.settingsManager.videoSettings.videoSource
598
                                anchors.verticalCenter: parent.verticalCenter
599 600 601 602
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
603
                            visible:    QGroundControl.settingsManager.videoSettings.udpPort.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1
604 605 606
                            QGCLabel {
                                text:               qsTr("UDP Port:")
                                width:              _labelWidth
607
                                anchors.verticalCenter: parent.verticalCenter
608
                            }
609
                            FactTextField {
610
                                width:              _editFieldWidth
611
                                fact:               QGroundControl.settingsManager.videoSettings.udpPort
612
                                anchors.verticalCenter: parent.verticalCenter
613 614 615 616
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
617
                            visible:    QGroundControl.settingsManager.videoSettings.rtspUrl.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 2
618
                            QGCLabel {
619
                                anchors.verticalCenter: parent.verticalCenter
620 621 622
                                text:               qsTr("RTSP URL:")
                                width:              _labelWidth
                            }
623
                            FactTextField {
624
                                width:              _editFieldWidth
625
                                fact:               QGroundControl.settingsManager.videoSettings.rtspUrl
626
                                anchors.verticalCenter: parent.verticalCenter
627 628
                            }
                        }
629 630 631 632 633 634 635 636 637 638 639 640 641 642
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    QGroundControl.settingsManager.videoSettings.tcpUrl.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 3
                            QGCLabel {
                                text:               qsTr("TCP URL:")
                                width:              _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactTextField {
                                width:              _editFieldWidth
                                fact:               QGroundControl.settingsManager.videoSettings.tcpUrl
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
643
                        Row {
644
                            spacing:    ScreenTools.defaultFontPixelWidth
645
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
646 647 648
                            QGCLabel {
                                text:               qsTr("Aspect Ratio:")
                                width:              _labelWidth
649
                                anchors.verticalCenter: parent.verticalCenter
650 651 652 653
                            }
                            FactTextField {
                                width:              _editFieldWidth
                                fact:               QGroundControl.settingsManager.videoSettings.aspectRatio
654
                                anchors.verticalCenter: parent.verticalCenter
655 656 657
                            }
                        }
                        Row {
658
                            spacing:    ScreenTools.defaultFontPixelWidth
659
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.gridLines.visible
660
                            QGCLabel {
661
                                text:               qsTr("Disable When Disarmed:")
662
                                width:              _labelWidth
663
                                anchors.verticalCenter: parent.verticalCenter
664
                            }
665 666 667
                            FactCheckBox {
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.disableWhenDisarmed
668 669 670 671 672 673 674 675
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                    }
                } // Video Source - Rectangle
                //-----------------------------------------------------------------
                //-- Video Source
                Item {
Don Gagne's avatar
Don Gagne committed
676
                    width:                      _panelWidth
677 678 679 680 681 682 683 684 685 686 687 688
                    height:                     videoRecLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.videoSettings.visible
                    QGCLabel {
                        id:             videoRecLabel
                        text:           qsTr("Video Recording")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     videoRecCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
689
                    width:                      _panelWidth
690 691 692 693 694 695 696 697 698 699 700
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.videoSettings.visible

                    Column {
                        id:         videoRecCol
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 4 && QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible
                            QGCLabel {
                                text:               qsTr("Auto-Delete Files:")
                                width:              _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactCheckBox {
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.enableStorageLimit
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 4 && QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value
716 717 718 719 720 721 722 723 724 725 726 727 728
                            QGCLabel {
                                text:               qsTr("Max Storage Usage:")
                                width:              _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactTextField {
                                width:              _editFieldWidth
                                fact:               QGroundControl.settingsManager.videoSettings.maxVideoSize
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
729
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 4 && QGroundControl.settingsManager.videoSettings.recordingFormat.visible
730 731 732 733 734 735 736 737 738
                            QGCLabel {
                                text:               qsTr("Video File Format:")
                                width:              _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactComboBox {
                                width:              _editFieldWidth
                                fact:               QGroundControl.settingsManager.videoSettings.recordingFormat
                                anchors.verticalCenter: parent.verticalCenter
739 740
                            }
                        }
741
                    }
742
                }
743

744 745 746
                //-----------------------------------------------------------------
                //-- Custom Brand Image
                Item {
Don Gagne's avatar
Don Gagne committed
747
                    width:                      _panelWidth
748 749 750
                    height:                     userBrandImageLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
751
                    visible:                    QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile
752 753 754 755 756 757 758 759
                    QGCLabel {
                        id:             userBrandImageLabel
                        text:           qsTr("Brand Image")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     userBrandImageCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
760
                    width:                      _panelWidth
761 762 763
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
764
                    visible:                    QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782

                    Column {
                        id:         userBrandImageCol
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    _userBrandImageIndoor.visible

                            QGCLabel {
                                anchors.baseline:   userBrandImageIndoorBrowse.baseline
                                width:              _labelWidth*1.5
                                text:               qsTr("Indoor Brand Image Path:")
                            }
                            QGCTextField {
                                anchors.baseline:   userBrandImageIndoorBrowse.baseline
                                readOnly:           true
                                width:              _editFieldWidth
783
                                text:               _userBrandImageIndoor.valueString.replace("file:///","")
784 785 786 787 788 789 790 791 792 793 794 795 796 797
                            }
                            QGCButton {
                                id:         userBrandImageIndoorBrowse
                                text:       "Browse"
                                onClicked:  userBrandImageIndoorBrowseDialog.openForLoad()

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

798
                                    onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814
                                }
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    _userBrandImageOutdoor.visible

                            QGCLabel {
                                anchors.baseline:   userBrandImageOutdoorBrowse.baseline
                                width:              _labelWidth*1.5
                                text:               qsTr("Outdoor Brand Image Path:")
                            }
                            QGCTextField {
                                anchors.baseline:   userBrandImageOutdoorBrowse.baseline
                                readOnly:           true
                                width:              _editFieldWidth
815
                                text:               _userBrandImageOutdoor.valueString.replace("file:///","")
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849
                            }
                            QGCButton {
                                id:         userBrandImageOutdoorBrowse
                                text:       "Browse"
                                onClicked:  userBrandImageOutdoorBrowseDialog.openForLoad()

                                QGCFileDialog {
                                    id:             userBrandImageOutdoorBrowseDialog
                                    qgcView:        _qgcView
                                    title:          qsTr("Choose custom brand image file:")
                                    folder:         _userBrandImageOutdoor.rawValue.replace("file:///","")
                                    selectExisting: true
                                    selectFolder:   false

                                    onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file
                                }
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
                            visible:    _userBrandImageIndoor.visible

                            QGCButton {
                                id:         userBrandImageReset
                                text:       "Reset Default Brand Image"
                                onClicked:  {
                                    _userBrandImageIndoor.rawValue = ""
                                    _userBrandImageOutdoor.rawValue = ""
                                }
                            }
                        }
                    }
                }

850 851
                QGCLabel {
                    anchors.horizontalCenter:   parent.horizontalCenter
852
                    text:                       qsTr("%1 Version: %2").arg(QGroundControl.appName).arg(QGroundControl.qgcVersion)
853
                }
854 855
            } // settingsColumn
        } // QGCFlickable
856 857
    } // QGCViewPanel
} // QGCView