Commit 48b6e1ef authored by DonLakeFlyer's avatar DonLakeFlyer

Settings page which works at any size

parent cbe81ce1
......@@ -72,8 +72,8 @@
"type": "double",
"defaultValue": 50.0,
"min": 0.0,
"units": "meters",
"decimalPlaces": 2
"units": "m",
"decimalPlaces": 1
},
{
"name": "PromptFLightDataSave",
......
......@@ -37,11 +37,13 @@ QGCView {
property Fact _userBrandImageIndoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageIndoor
property Fact _userBrandImageOutdoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 20
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30
property real _comboFieldWidth: ScreenTools.defaultFontPixelWidth * 25
property real _valueFieldWidth: ScreenTools.defaultFontPixelWidth * 8
property Fact _mapProvider: QGroundControl.settingsManager.flightMapSettings.mapProvider
property Fact _mapType: QGroundControl.settingsManager.flightMapSettings.mapType
property Fact _followTarget: QGroundControl.settingsManager.appSettings.followTarget
property real _panelWidth: _qgcView.width * _internalWidthRatio
property real _margins: ScreenTools.defaultFontPixelWidth
readonly property real _internalWidthRatio: 0.8
......@@ -52,356 +54,322 @@ QGCView {
QGCViewPanel {
id: panel
anchors.fill: parent
QGCFlickable {
clip: true
anchors.fill: parent
contentHeight: settingsColumn.height
contentWidth: settingsColumn.width
Column {
id: settingsColumn
width: _qgcView.width
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.margins: ScreenTools.defaultFontPixelWidth
//-----------------------------------------------------------------
//-- Units
Item {
width: _panelWidth
height: unitLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.unitsSettings.visible
QGCLabel {
id: unitLabel
text: qsTr("Units (Requires Restart)")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: unitsCol.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.unitsSettings.visible
Column {
id: unitsCol
spacing: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
contentHeight: outerItem.height
contentWidth: outerItem.width
Repeater {
id: unitsRepeater
model: [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ]
Item {
id: outerItem
width: Math.max(panel.width, settingsColumn.width)
height: settingsColumn.height
property var names: [ qsTr("Distance:"), qsTr("Area:"), qsTr("Speed:"), qsTr("Temperature:") ]
ColumnLayout {
id: settingsColumn
anchors.horizontalCenter: parent.horizontalCenter
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: modelData.visible
QGCLabel {
id: unitsSectionLabel
text: qsTr("Units (Requires Restart)")
visible: QGroundControl.settingsManager.unitsSettings.visible
}
Rectangle {
Layout.preferredHeight: unitsGrid.height + (_margins * 2)
Layout.preferredWidth: unitsGrid.width + (_margins * 2)
color: qgcPal.windowShade
visible: miscSectionLabel.visible
Layout.fillWidth: true
GridLayout {
id: unitsGrid
anchors.topMargin: _margins
anchors.top: parent.top
Layout.fillWidth: false
anchors.horizontalCenter: parent.horizontalCenter
flow: GridLayout.TopToBottom
rows: 4
QGCLabel {
width: _labelWidth
anchors.baseline: factCombo.baseline
text: unitsRepeater.names[index]
}
Repeater {
model: [ qsTr("Distance"), qsTr("Area"), qsTr("Speed"), qsTr("Temperature") ]
QGCLabel { text: modelData }
}
Repeater {
model: [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ]
FactComboBox {
id: factCombo
width: _editFieldWidth
fact: modelData
indexModel: false
Layout.preferredWidth: _comboFieldWidth
fact: modelData
indexModel: false
}
}
}
}
}
//-----------------------------------------------------------------
//-- Miscellaneous
Item {
width: _panelWidth
height: miscLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.appSettings.visible
Item { width: 1; height: _margins }
QGCLabel {
id: miscLabel
text: qsTr("Miscellaneous")
font.family: ScreenTools.demiboldFontFamily
id: miscSectionLabel
text: qsTr("Miscellaneous")
visible: QGroundControl.settingsManager.appSettings.visible
}
}
Rectangle {
height: miscCol.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.appSettings.visible
Column {
id: miscCol
spacing: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
//-----------------------------------------------------------------
//-- Base UI Font Point Size
Row {
visible: _appFontPointSize ? _appFontPointSize.visible : false
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
id: baseFontLabel
text: qsTr("Font Size:")
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: {
if (_appFontPointSize.value > _appFontPointSize.min) {
_appFontPointSize.value = _appFontPointSize.value - 1
}
}
Rectangle {
Layout.preferredWidth: Math.max(comboGrid.width, miscCol.width) + (_margins * 2)
Layout.preferredHeight: (pathRow.visible ? pathRow.y + pathRow.height : miscColItem.y + miscColItem.height) + (_margins * 2)
Layout.fillWidth: true
color: qgcPal.windowShade
visible: miscSectionLabel.visible
Item {
id: comboGridItem
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: comboGrid.height
GridLayout {
id: comboGrid
anchors.horizontalCenter: parent.horizontalCenter
columns: 2
QGCLabel {
text: qsTr("Color Scheme")
visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
}
FactTextField {
id: baseFontEdit
width: _editFieldWidth - (decrementButton.width * 2) - (baseFontRow.spacing * 2)
fact: QGroundControl.settingsManager.appSettings.appFontPointSize
FactComboBox {
Layout.preferredWidth: _comboFieldWidth
fact: QGroundControl.settingsManager.appSettings.indoorPalette
indexModel: false
visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
}
QGCButton {
width: height
height: baseFontEdit.height
text: "+"
onClicked: {
if (_appFontPointSize.value < _appFontPointSize.max) {
_appFontPointSize.value = _appFontPointSize.value + 1
QGCLabel {
text: qsTr("Map Provider")
width: _labelWidth
visible: _mapProvider.visible
}
FactComboBox {
Layout.preferredWidth: _comboFieldWidth
fact: _mapProvider
indexModel: false
visible: _mapProvider.visible
}
QGCLabel {
text: qsTr("Map Type")
visible: _mapType.visible
}
FactComboBox {
id: mapTypes
Layout.preferredWidth: _comboFieldWidth
fact: _mapType
indexModel: false
visible: _mapType.visible
Connections {
target: QGroundControl.settingsManager.flightMapSettings
onMapTypeChanged: {
mapTypes.model = _mapType.enumStrings
}
}
}
}
QGCLabel {
anchors.verticalCenter: parent.verticalCenter
text: _requiresRestart
}
}
//-----------------------------------------------------------------
//-- Palette Styles
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible
QGCLabel {
text: qsTr("Color Scheme:")
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
QGCLabel {
text: qsTr("Stream GCS Position")
visible: _followTarget.visible
}
FactComboBox {
Layout.preferredWidth: _comboFieldWidth
fact: _followTarget
indexModel: false
visible: _followTarget.visible
}
}
}
//-----------------------------------------------------------------
//-- Map Type
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _mapType.visible
QGCLabel {
text: qsTr("Map Type:")
width: _labelWidth
anchors.verticalCenter: parent.verticalCenter
}
FactComboBox {
id: mapTypes
width: _editFieldWidth
fact: _mapType
indexModel: false
anchors.verticalCenter: parent.verticalCenter
Connections {
target: QGroundControl.settingsManager.flightMapSettings
onMapTypeChanged: {
mapTypes.model = _mapType.enumStrings
Item {
id: miscColItem
anchors.margins: _margins
anchors.left: parent.left
anchors.right: parent.right
anchors.top: comboGridItem.bottom
height: miscCol.height
ColumnLayout {
id: miscCol
anchors.horizontalCenter: parent.horizontalCenter
spacing: _margins
RowLayout {
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
visible: _appFontPointSize ? _appFontPointSize.visible : false
QGCLabel {
text: qsTr("Font Size:")
}
QGCButton {
Layout.preferredWidth: height
Layout.preferredHeight: baseFontEdit.height
text: "-"
onClicked: {
if (_appFontPointSize.value > _appFontPointSize.min) {
_appFontPointSize.value = _appFontPointSize.value - 1
}
}
}
FactTextField {
id: baseFontEdit
Layout.preferredWidth: _valueFieldWidth
fact: QGroundControl.settingsManager.appSettings.appFontPointSize
}
QGCButton {
Layout.preferredWidth: height
Layout.preferredHeight: baseFontEdit.height
text: "+"
onClicked: {
if (_appFontPointSize.value < _appFontPointSize.max) {
_appFontPointSize.value = _appFontPointSize.value + 1
}
}
}
QGCLabel {
text: _requiresRestart
}
}
}
}
//-----------------------------------------------------------------
//-- 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
}
}
//-----------------------------------------------------------------
//-- Audio preferences
FactCheckBox {
text: qsTr("Mute all audio output")
fact: _audioMuted
visible: _audioMuted.visible
property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
}
//-----------------------------------------------------------------
//-- Save telemetry log
FactCheckBox {
id: promptSaveLog
text: qsTr("Save telemetry log after each flight")
fact: _telemetrySave
visible: _telemetrySave.visible
property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
}
//-----------------------------------------------------------------
//-- Save even if not armed
FactCheckBox {
text: qsTr("Save telemetry log even if vehicle was not armed")
fact: _telemetrySaveNotArmed
visible: _telemetrySaveNotArmed.visible
enabled: promptSaveLog.checked
property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
}
//-----------------------------------------------------------------
//-- 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")
text: qsTr("All saved settings will be reset the next time you start %1. Is this really what you want?").arg(QGroundControl.appName)
onYes: {
QGroundControl.deleteAllSettingsNextBoot()
clearDialog.visible = false
FactCheckBox {
text: qsTr("Mute all audio output")
fact: _audioMuted
visible: _audioMuted.visible
property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
}
onNo: {
clearCheck.checked = false
clearDialog.visible = false
FactCheckBox {
id: promptSaveLog
text: qsTr("Save telemetry log after each flight")
fact: _telemetrySave
visible: _telemetrySave.visible
property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
}
}
}
//-----------------------------------------------------------------
//-- Battery talker
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible
QGCCheckBox {
id: announcePercentCheckbox
text: qsTr("Announce battery lower than:")
checked: _percentRemainingAnnounce.value !== 0
width: (_labelWidth + _editFieldWidth) * 0.65
anchors.verticalCenter: parent.verticalCenter
onClicked: {
if (checked) {
_percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString
} else {
_percentRemainingAnnounce.value = 0
FactCheckBox {
text: qsTr("Save telemetry log even if vehicle was not armed")
fact: _telemetrySaveNotArmed
visible: _telemetrySaveNotArmed.visible
enabled: promptSaveLog.checked
property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
}
FactCheckBox {
text: qsTr("Use preflight checklist")
fact: _useChecklist
visible: _useChecklist.visible
property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
}
FactCheckBox {
text: qsTr("Virtual Joystick")
visible: _virtualJoystick.visible
fact: _virtualJoystick
property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
}
FactCheckBox {
text: qsTr("AutoLoad Missions")
fact: _autoLoad
visible: _autoLoad.visible
property Fact _autoLoad: QGroundControl.settingsManager.appSettings.autoLoadMissions
}
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")
text: qsTr("All saved settings will be reset the next time you start %1. Is this really what you want?").arg(QGroundControl.appName)
onYes: {
QGroundControl.deleteAllSettingsNextBoot()
clearDialog.visible = false
}
onNo: {
clearCheck.checked = false
clearDialog.visible = false
}
}
}
}
FactTextField {
id: announcePercent
fact: _percentRemainingAnnounce
width: (_labelWidth + _editFieldWidth) * 0.35
enabled: announcePercentCheckbox.checked
anchors.verticalCenter: parent.verticalCenter
}
}
//-----------------------------------------------------------------
//-- Virtual joystick settings
FactCheckBox {
text: qsTr("Virtual Joystick")
visible: _virtualJoystick.visible
fact: _virtualJoystick
property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick
}
//-----------------------------------------------------------------
//-- Default mission item altitude
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible
QGCLabel {
anchors.verticalCenter: parent.verticalCenter
width: (_labelWidth + _editFieldWidth) * 0.65
text: qsTr("Default Mission Altitude:")
}
FactTextField {
id: defaultItemAltitudeField
width: (_labelWidth + _editFieldWidth) * 0.35
fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
anchors.verticalCenter: parent.verticalCenter
}
}
RowLayout {
visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible
QGCCheckBox {
id: announcePercentCheckbox
text: qsTr("Announce battery lower than")
checked: _percentRemainingAnnounce.value !== 0
onClicked: {
if (checked) {
_percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString
} else {
_percentRemainingAnnounce.value = 0
}
}
}
FactTextField {
fact: _percentRemainingAnnounce
Layout.preferredWidth: _valueFieldWidth
enabled: announcePercentCheckbox.checked
}
}
//-----------------------------------------------------------------
//-- Mission AutoLoad
FactCheckBox {
text: qsTr("AutoLoad Missions")
fact: _autoLoad
visible: _autoLoad.visible
RowLayout {
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible
property Fact _autoLoad: QGroundControl.settingsManager.appSettings.autoLoadMissions
QGCLabel { text: qsTr("Default Mission Altitude") }
FactTextField {
Layout.preferredWidth: _valueFieldWidth
fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
}
}
}
}
//-----------------------------------------------------------------
//-- Save path
RowLayout {
spacing: ScreenTools.defaultFontPixelWidth
visible: _savePath.visible && !ScreenTools.isMobile
QGCLabel {
Layout.alignment: Qt.AlignVCenter
text: qsTr("File Save Path:")
}
QGCLabel {
Layout.alignment: Qt.AlignVCenter
Layout.maximumWidth: _panelWidth * 0.5
elide: Text.ElideMiddle
text: _savePath.rawValue === "" ? qsTr("<not set>") : _savePath.value
id: pathRow
anchors.margins: _margins
anchors.left: parent.left
anchors.right: parent.right
anchors.top: miscColItem.bottom
visible: _savePath.visible && !ScreenTools.isMobile
QGCLabel { text: qsTr("Application Load/Save Path") }
QGCTextField {
Layout.fillWidth: true
readOnly: true
text: _savePath.rawValue === "" ? qsTr("<not set>") : _savePath.value
}
QGCButton {
id: savePathBrowse
text: "Browse"
text: qsTr("Browse")
onClicked: savePathBrowseDialog.openForLoad()
QGCFileDialog {
id: savePathBrowseDialog
qgcView: _qgcView
title: qsTr("Choose the location to save files:")
title: qsTr("Choose the location to save/load files")
folder: _savePath.rawValue
selectExisting: true
selectFolder: true
......@@ -410,414 +378,323 @@ QGCView {
}
}
}
}
//-----------------------------------------------------------------
//-- Checklist Settings
FactCheckBox {
text: qsTr("Use preflight checklist")
fact: _useChecklist
visible: _useChecklist.visible
Item { width: 1; height: _margins }
property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist
}
}
}
//-----------------------------------------------------------------
//-- RTK GPS
Item {
width: _panelWidth
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
id: rtkSectionLabel
text: qsTr("RTK GPS (Requires Restart)")
visible: QGroundControl.settingsManager.rtkSettings.visible
}
}
Rectangle {
height: rtkGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.rtkSettings.visible
GridLayout {