GeneralSettings.qml 49.7 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9 10


11 12
import QtQuick                  2.3
import QtQuick.Controls         1.2
13
import QtQuick.Controls.Styles  1.4
14
import QtQuick.Dialogs          1.2
15 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
44
    property Fact _followTarget:                QGroundControl.settingsManager.appSettings.followTarget
Don Gagne's avatar
Don Gagne committed
45 46 47
    property real _panelWidth:                  _qgcView.width * _internalWidthRatio

    readonly property real _internalWidthRatio:          0.8
48 49

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

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

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

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

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

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

                            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
                                }
114 115 116 117
                            }
                        }
                    }
                }
118

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

                            property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
352 353
                        }
                        //-----------------------------------------------------------------
354 355 356
                        //-- Default mission item altitude
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
Donald Gagne's avatar
Donald Gagne committed
357
                            visible:    QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible
358
                            QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
359 360
                                anchors.verticalCenter: parent.verticalCenter
                                width:  (_labelWidth + _editFieldWidth) * 0.65
361
                                text:   qsTr("Default Mission Altitude:")
362 363 364
                            }
                            FactTextField {
                                id:     defaultItemAltitudeField
Gus Grubba's avatar
Gus Grubba committed
365
                                width:  (_labelWidth + _editFieldWidth) * 0.35
366
                                fact:   QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
Gus Grubba's avatar
Gus Grubba committed
367
                                anchors.verticalCenter: parent.verticalCenter
368 369
                            }
                        }
370

371
                        //-----------------------------------------------------------------
372
                        //-- Mission AutoLoad
373
                        FactCheckBox {
374
                            text:       qsTr("AutoLoad Missions")
375 376 377 378 379 380 381 382
                            fact:       _autoLoad
                            visible:    _autoLoad.visible

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

                        //-----------------------------------------------------------------
                        //-- Save path
Don Gagne's avatar
Don Gagne committed
383
                        RowLayout {
DonLakeFlyer's avatar
DonLakeFlyer committed
384
                            spacing:    ScreenTools.defaultFontPixelWidth
385
                            visible:    _savePath.visible && !ScreenTools.isMobile
DonLakeFlyer's avatar
DonLakeFlyer committed
386

387
                            QGCLabel {
388 389
                                Layout.alignment:       Qt.AlignVCenter
                                text:                   qsTr("File Save Path:")
Don Gagne's avatar
Don Gagne committed
390
                            }
391
                            QGCLabel {
392
                                Layout.alignment:       Qt.AlignVCenter
Don Gagne's avatar
Don Gagne committed
393 394 395
                                Layout.maximumWidth:    _panelWidth * 0.5
                                elide:                  Text.ElideMiddle
                                text:                   _savePath.rawValue === "" ? qsTr("<not set>") : _savePath.value
396 397
                            }
                            QGCButton {
398 399 400 401 402 403 404 405 406 407
                                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
408
                                    selectFolder:   true
409 410

                                    onAcceptedForLoad: _savePath.rawValue = file
411
                                }
Don Gagne's avatar
Don Gagne committed
412 413
                            }
                        }
414 415 416 417 418 419 420 421 422 423

                        //-----------------------------------------------------------------
                        //-- Checklist Settings
                        FactCheckBox {
                            text:       qsTr("Use preflight checklist")
                            fact:       _useChecklist
                            visible:    _useChecklist.visible

                            property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
                        }
dogmaphobic's avatar
dogmaphobic committed
424 425
                    }
                }
426

Don Gagne's avatar
Don Gagne committed
427 428 429
                //-----------------------------------------------------------------
                //-- RTK GPS
                Item {
Don Gagne's avatar
Don Gagne committed
430
                    width:                      _panelWidth
Don Gagne's avatar
Don Gagne committed
431 432 433 434 435 436 437 438 439 440 441 442
                    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
443
                    width:                      _panelWidth
Don Gagne's avatar
Don Gagne committed
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
                    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
463
                            text:               qsTr("Minimum observation duration:")
Don Gagne's avatar
Don Gagne committed
464 465 466 467 468 469 470
                        }
                        FactTextField {
                            fact:               QGroundControl.settingsManager.rtkSettings.surveyInMinObservationDuration
                        }
                    }
                }

471 472 473
                //-----------------------------------------------------------------
                //-- Autoconnect settings
                Item {
Don Gagne's avatar
Don Gagne committed
474
                    width:                      _panelWidth
475 476 477 478
                    height:                     autoConnectLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.autoConnectSettings.visible
479
                    QGCLabel {
480
                        id:             autoConnectLabel
Don Gagne's avatar
Don Gagne committed
481
                        text:           qsTr("AutoConnect to the following devices:")
482
                        font.family:    ScreenTools.demiboldFontFamily
483 484
                    }
                }
485
                Rectangle {
486
                    height:                     autoConnectCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
487
                    width:                      _panelWidth
488 489 490 491
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.autoConnectSettings.visible
492

493 494
                    Column {
                        id:         autoConnectCol
495
                        spacing:    ScreenTools.defaultFontPixelWidth * 2
496
                        anchors.centerIn: parent
497

498 499
                        Row {
                            spacing: ScreenTools.defaultFontPixelWidth * 2
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515

                            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
516
                                    visible:    modelData.visible
517
                                }
518 519
                            }
                        }
520 521

                        Row {
Jacob Walser's avatar
Jacob Walser committed
522 523 524 525 526
                            anchors.horizontalCenter: parent.horizontalCenter
                            spacing:                  ScreenTools.defaultFontPixelWidth
                            visible:                  !ScreenTools.isMobile
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible
527 528 529

                            QGCLabel {
                                anchors.baseline: nmeaPortCombo.baseline
Jacob Walser's avatar
Jacob Walser committed
530 531
                                text:             qsTr("NMEA GPS Device:")
                                width:            _labelWidth
532 533 534 535
                            }

                            QGCComboBox {
                                id:     nmeaPortCombo
Jacob Walser's avatar
Jacob Walser committed
536
                                width:  _editFieldWidth
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
                                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
554 555 556 557 558 559 560
                        }
                        Row {
                            anchors.horizontalCenter: parent.horizontalCenter
                            spacing:                  ScreenTools.defaultFontPixelWidth
                            visible:                  !ScreenTools.isMobile
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible
                                                      && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible
561 562
                            QGCLabel {
                                anchors.baseline: nmeaBaudCombo.baseline
Jacob Walser's avatar
Jacob Walser committed
563 564
                                text:             qsTr("NMEA GPS Baudrate:")
                                width:            _labelWidth
565 566 567 568
                            }

                            QGCComboBox {
                                id:     nmeaBaudCombo
Jacob Walser's avatar
Jacob Walser committed
569
                                width:  _editFieldWidth
570 571 572 573 574 575 576 577 578 579 580 581 582
                                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;
                                }
                            }
                        }
583 584
                    }
                }
585

586 587 588
                //-----------------------------------------------------------------
                //-- Video Source
                Item {
Don Gagne's avatar
Don Gagne committed
589
                    width:                      _panelWidth
590 591 592 593
                    height:                     videoLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.videoSettings.visible
594 595
                    QGCLabel {
                        id:             videoLabel
596
                        text:           qsTr("Video")
597 598 599 600
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
601
                    height:                     videoCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Don Gagne's avatar
Don Gagne committed
602
                    width:                      _panelWidth
603 604 605 606
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.videoSettings.visible
607

608 609 610 611
                    Column {
                        id:         videoCol
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
612

613 614
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
615
                            visible:    QGroundControl.settingsManager.videoSettings.videoSource.visible
616 617 618
                            QGCLabel {
                                text:               qsTr("Video Source:")
                                width:              _labelWidth
619
                                anchors.verticalCenter: parent.verticalCenter
620
                            }
621 622 623 624 625
                            FactComboBox {
                                id:         videoSource
                                width:      _editFieldWidth
                                indexModel: false
                                fact:       QGroundControl.settingsManager.videoSettings.videoSource
626
                                anchors.verticalCenter: parent.verticalCenter
627 628 629 630
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
631
                            visible:    QGroundControl.settingsManager.videoSettings.udpPort.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1
632 633 634
                            QGCLabel {
                                text:               qsTr("UDP Port:")
                                width:              _labelWidth
635
                                anchors.verticalCenter: parent.verticalCenter
636
                            }
637
                            FactTextField {
638
                                width:              _editFieldWidth
639
                                fact:               QGroundControl.settingsManager.videoSettings.udpPort
640
                                anchors.verticalCenter: parent.verticalCenter
641 642 643 644
                            }
                        }
                        Row {
                            spacing:    ScreenTools.defaultFontPixelWidth
645
                            visible:    QGroundControl.settingsManager.videoSettings.rtspUrl.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 2
646
                            QGCLabel {
647
                                anchors.verticalCenter: parent.verticalCenter
648 649 650
                                text:               qsTr("RTSP URL:")
                                width:              _labelWidth
                            }
651
                            FactTextField {
652
                                width:              _editFieldWidth
653
                                fact:               QGroundControl.settingsManager.videoSettings.rtspUrl
654
                                anchors.verticalCenter: parent.verticalCenter
655 656
                            }
                        }
657 658 659 660 661 662 663 664 665 666 667 668 669 670
                        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
                            }
                        }
671
                        Row {
672
                            spacing:    ScreenTools.defaultFontPixelWidth
673
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
674 675 676
                            QGCLabel {
                                text:               qsTr("Aspect Ratio:")
                                width:              _labelWidth
677
                                anchors.verticalCenter: parent.verticalCenter
678 679 680 681
                            }
                            FactTextField {
                                width:              _editFieldWidth
                                fact:               QGroundControl.settingsManager.videoSettings.aspectRatio
682
                                anchors.verticalCenter: parent.verticalCenter
683 684 685
                            }
                        }
                        Row {
686
                            spacing:    ScreenTools.defaultFontPixelWidth
687
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.gridLines.visible
688
                            QGCLabel {
689
                                text:               qsTr("Disable When Disarmed:")
690
                                width:              _labelWidth
691
                                anchors.verticalCenter: parent.verticalCenter
692
                            }
693 694 695
                            FactCheckBox {
                                text:                   ""
                                fact:                   QGroundControl.settingsManager.videoSettings.disableWhenDisarmed
696 697 698 699 700 701 702 703
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                    }
                } // Video Source - Rectangle
                //-----------------------------------------------------------------
                //-- Video Source
                Item {
Don Gagne's avatar
Don Gagne committed
704
                    width:                      _panelWidth
705 706 707 708 709 710 711 712 713 714 715 716
                    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
717
                    width:                      _panelWidth
718 719 720 721 722 723 724 725 726 727 728
                    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
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743
                            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
744 745 746 747 748 749 750 751 752 753 754 755 756
                            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
757
                            visible:    QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 4 && QGroundControl.settingsManager.videoSettings.recordingFormat.visible
758 759 760 761 762 763 764 765 766
                            QGCLabel {
                                text:               qsTr("Video File Format:")
                                width:              _labelWidth
                                anchors.verticalCenter: parent.verticalCenter
                            }
                            FactComboBox {
                                width:              _editFieldWidth
                                fact:               QGroundControl.settingsManager.videoSettings.recordingFormat
                                anchors.verticalCenter: parent.verticalCenter
767 768
                            }
                        }
769
                    }
770
                }
771

772 773 774
                //-----------------------------------------------------------------
                //-- Custom Brand Image
                Item {
Don Gagne's avatar
Don Gagne committed
775
                    width:                      _panelWidth
776 777 778
                    height:                     userBrandImageLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
779
                    visible:                    QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile
780 781 782 783 784 785 786 787
                    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
788
                    width:                      _panelWidth
789 790 791
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
792
                    visible:                    QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810

                    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
811
                                text:               _userBrandImageIndoor.valueString.replace("file:///","")
812 813 814 815 816 817 818 819 820 821 822 823 824 825
                            }
                            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

826
                                    onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842
                                }
                            }
                        }
                        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
843
                                text:               _userBrandImageOutdoor.valueString.replace("file:///","")
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877
                            }
                            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 = ""
                                }
                            }
                        }
                    }
                }

878 879
                QGCLabel {
                    anchors.horizontalCenter:   parent.horizontalCenter
880
                    text:                       qsTr("%1 Version: %2").arg(QGroundControl.appName).arg(QGroundControl.qgcVersion)
881
                }
882 883
            } // settingsColumn
        } // QGCFlickable
884 885
    } // QGCViewPanel
} // QGCView