diff --git a/src/FactSystem/FactControls/AltitudeFactTextField.qml b/src/FactSystem/FactControls/AltitudeFactTextField.qml index 11d287a8e41b6c48e1997dff0790d8f025db7781..1a3d5f360e9b807fc96eed11758f8df3ed4847cb 100644 --- a/src/FactSystem/FactControls/AltitudeFactTextField.qml +++ b/src/FactSystem/FactControls/AltitudeFactTextField.qml @@ -1,20 +1,24 @@ +import QtQuick 2.3 import QGroundControl 1.0 import QGroundControl.FactSystem 1.0 FactTextField { - unitsLabel: fact ? fact.units + _altitudeModeExtraUnits : "" - showUnits: true - showHelp: true + unitsLabel: fact ? fact.units : "" + extraUnitsLabel: fact ? _altitudeModeExtraUnits : "" + showUnits: true + showHelp: true property int altitudeMode: QGroundControl.AltitudeModeNone readonly property string _altModeNoneExtraUnits: "" - readonly property string _altModeRelativeExtraUnits: qsTr(" (Rel)") - readonly property string _altModeAbsoluteExtraUnits: qsTr(" (AMSL)") - readonly property string _altModeAboveTerrainExtraUnits: qsTr(" (Abv Terr)") - readonly property string _altModeTerrainFrameExtraUnits: qsTr(" (TerrF)") + readonly property string _altModeRelativeExtraUnits: qsTr("(Rel)") + readonly property string _altModeAbsoluteExtraUnits: qsTr("(AMSL)") + readonly property string _altModeAboveTerrainExtraUnits: qsTr("(Abv Terr)") + readonly property string _altModeTerrainFrameExtraUnits: qsTr("(TerrF)") - property string _altitudeModeExtraUnits: _altModeRelativeExtraUnits + property string _altitudeModeExtraUnits: _altModeNoneExtraUnits + + onAltitudeModeChanged: updateAltitudeModeExtraUnits() function updateAltitudeModeExtraUnits() { if (altitudeMode === QGroundControl.AltitudeModeNone) { @@ -32,6 +36,4 @@ FactTextField { _altitudeModeExtraUnits = "" } } - - onAltitudeModeChanged: updateAltitudeModeExtraUnits() } diff --git a/src/PlanView/CameraCalc.qml b/src/PlanView/CameraCalc.qml index 95c531f016ebed6cca2051bb760e98e370fbc714..14b626e138b0ff5d289716ad0836e667736af3b2 100644 --- a/src/PlanView/CameraCalc.qml +++ b/src/PlanView/CameraCalc.qml @@ -15,8 +15,9 @@ Column { spacing: _margin property var cameraCalc - property bool vehicleFlightIsFrontal: true + property bool vehicleFlightIsFrontal: true property string distanceToSurfaceLabel + property int distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone property string frontalDistanceLabel property string sideDistanceLabel @@ -226,8 +227,9 @@ Column { onClicked: cameraCalc.valueSetIsDistance.value = 1 } - FactTextField { + AltitudeFactTextField { fact: cameraCalc.distanceToSurface + altitudeMode: distanceToSurfaceAltitudeMode enabled: fixedDistanceRadio.checked Layout.fillWidth: true } @@ -285,8 +287,9 @@ Column { visible: cameraCalc.isManualCamera QGCLabel { text: distanceToSurfaceLabel } - FactTextField { + AltitudeFactTextField { fact: cameraCalc.distanceToSurface + altitudeMode: distanceToSurfaceAltitudeMode Layout.fillWidth: true } diff --git a/src/PlanView/CorridorScanEditor.qml b/src/PlanView/CorridorScanEditor.qml index ab42e20eaae9b73e3f4d1d846b2234954878194c..6c833a2d56f73e1512cc3bbe19ec14bac86c30d3 100644 --- a/src/PlanView/CorridorScanEditor.qml +++ b/src/PlanView/CorridorScanEditor.qml @@ -67,11 +67,12 @@ Rectangle { CameraCalc { - cameraCalc: missionItem.cameraCalc - vehicleFlightIsFrontal: true - distanceToSurfaceLabel: qsTr("Altitude") - frontalDistanceLabel: qsTr("Trigger Distance") - sideDistanceLabel: qsTr("Spacing") + cameraCalc: missionItem.cameraCalc + vehicleFlightIsFrontal: true + distanceToSurfaceLabel: qsTr("Altitude") + distanceToSurfaceAltitudeMode: missionItem.followTerrain ? QGroundControl.AltitudeModeAboveTerrain : QGroundControl.AltitudeModeRelative + frontalDistanceLabel: qsTr("Trigger Dist") + sideDistanceLabel: qsTr("Spacing") } SectionHeader { diff --git a/src/PlanView/StructureScanEditor.qml b/src/PlanView/StructureScanEditor.qml index 380ef8f0ee7b8bcb619f245a20d19b945088669e..ea8d4542d5b820da7c7a590323d36ec3ce0fb320 100644 --- a/src/PlanView/StructureScanEditor.qml +++ b/src/PlanView/StructureScanEditor.qml @@ -75,11 +75,12 @@ Rectangle { } CameraCalc { - cameraCalc: missionItem.cameraCalc - vehicleFlightIsFrontal: false - distanceToSurfaceLabel: qsTr("Scan Distance") - frontalDistanceLabel: qsTr("Layer Height") - sideDistanceLabel: qsTr("Trigger Distance") + cameraCalc: missionItem.cameraCalc + vehicleFlightIsFrontal: false + distanceToSurfaceLabel: qsTr("Scan Distance") + distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone + frontalDistanceLabel: qsTr("Layer Height") + sideDistanceLabel: qsTr("Trigger Distance") } SectionHeader { @@ -117,14 +118,16 @@ Rectangle { } QGCLabel { text: qsTr("Scan Bottom Alt") } - FactTextField { + AltitudeFactTextField { fact: missionItem.scanBottomAlt + altitudeMode: QGroundControl.AltitudeModeRelative Layout.fillWidth: true } QGCLabel { text: qsTr("Entrance/Exit Alt") } - FactTextField { + AltitudeFactTextField { fact: missionItem.entranceAlt + altitudeMode: QGroundControl.AltitudeModeRelative Layout.fillWidth: true } diff --git a/src/PlanView/SurveyItemEditor.qml b/src/PlanView/SurveyItemEditor.qml index 183dc259e000d7d0699846b569c4771942e56abf..2b183a7080c9501e564a1d0aa9a9a41c7b78b498 100644 --- a/src/PlanView/SurveyItemEditor.qml +++ b/src/PlanView/SurveyItemEditor.qml @@ -67,11 +67,12 @@ Rectangle { } CameraCalc { - cameraCalc: missionItem.cameraCalc - vehicleFlightIsFrontal: true - distanceToSurfaceLabel: qsTr("Altitude") - frontalDistanceLabel: qsTr("Trigger Distance") - sideDistanceLabel: qsTr("Spacing") + cameraCalc: missionItem.cameraCalc + vehicleFlightIsFrontal: true + distanceToSurfaceLabel: qsTr("Altitude") + distanceToSurfaceAltitudeMode: missionItem.followTerrain ? QGroundControl.AltitudeModeAboveTerrain : QGroundControl.AltitudeModeRelative + frontalDistanceLabel: qsTr("Trigger Dist") + sideDistanceLabel: qsTr("Spacing") } SectionHeader { diff --git a/src/QmlControls/QGCCheckBox.qml b/src/QmlControls/QGCCheckBox.qml index 5e334c6beed4d21b5dc3f96b90ac82ff8b9b7411..af2dfa9ec9490b8c7d30739ea7ca5854d8d9b6e9 100644 --- a/src/QmlControls/QGCCheckBox.qml +++ b/src/QmlControls/QGCCheckBox.qml @@ -16,6 +16,8 @@ CheckBox { activeFocusOnPress: true style: CheckBoxStyle { + spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25 + label: Item { implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.checkBoxIndicatorSize) diff --git a/src/QmlControls/QGCRadioButton.qml b/src/QmlControls/QGCRadioButton.qml index 79792d386e99e27002a31f4806ddc9b391d36b3f..6f28fde99aae647127cfa69ffac46d1a5d5987b4 100644 --- a/src/QmlControls/QGCRadioButton.qml +++ b/src/QmlControls/QGCRadioButton.qml @@ -17,7 +17,7 @@ RadioButton { activeFocusOnPress: true style: RadioButtonStyle { - spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth / 2 + spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25 label: Item { implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 diff --git a/src/QmlControls/QGCTextField.qml b/src/QmlControls/QGCTextField.qml index 4e132f5e7c43fc8dc122bca1ec377a0be5e4d43c..317ffd8ffa2b63b091053dc25f361b140965c42a 100644 --- a/src/QmlControls/QGCTextField.qml +++ b/src/QmlControls/QGCTextField.qml @@ -13,9 +13,10 @@ TextField { activeFocusOnPress: true antialiasing: true - property bool showUnits: false - property bool showHelp: false - property string unitsLabel: "" + property bool showUnits: false + property bool showHelp: false + property string unitsLabel: "" + property string extraUnitsLabel: "" signal helpClicked @@ -89,7 +90,17 @@ TextField { font.family: ScreenTools.normalFontFamily antialiasing: true color: control.textColor - visible: control.showUnits + visible: control.showUnits && text !== "" + } + + Text { + Layout.alignment: Qt.AlignVCenter + text: control.extraUnitsLabel + font.pointSize: ScreenTools.smallFontPointSize + font.family: ScreenTools.normalFontFamily + antialiasing: true + color: control.textColor + visible: control.showUnits && text !== "" } Rectangle {