Skip to content

Commit

Permalink
Added horizontal value slider support
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Jan 3, 2025
1 parent 7bf3d0b commit 5976d7c
Show file tree
Hide file tree
Showing 21 changed files with 448 additions and 324 deletions.
1 change: 0 additions & 1 deletion custom-example/qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@
<file alias="QGroundControl/FactControls/FactValueSlider.qml">../src/FactSystem/FactControls/FactValueSlider.qml</file>
<file alias="QGroundControl/FactControls/LabelledFactComboBox.qml">../src/FactSystem/FactControls/LabelledFactComboBox.qml</file>
<file alias="QGroundControl/FactControls/LabelledFactTextField.qml">../src/FactSystem/FactControls/LabelledFactTextField.qml</file>
<file alias="QGroundControl/FactControls/LabelledFactSlider.qml">../src/FactSystem/FactControls/LabelledFactSlider.qml</file>
<file alias="QGroundControl/FactControls/qmldir">../src/QmlControls/QGroundControl/FactControls/qmldir</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewVideo.qml">../src/FlightDisplay/FlightDisplayViewVideo.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyView.qml">../src/FlightDisplay/FlyView.qml</file>
Expand Down
2 changes: 1 addition & 1 deletion qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<file alias="QGroundControl/Controls/TransectStyleComplexItemStats.qml">src/PlanView/TransectStyleComplexItemStats.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemTabBar.qml">src/PlanView/TransectStyleComplexItemTabBar.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemTerrainFollow.qml">src/PlanView/TransectStyleComplexItemTerrainFollow.qml</file>
<file alias="QGroundControl/Controls/ValueSlider.qml">src/QmlControls/ValueSlider.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/VTOLLandingPatternMapVisual.qml">src/PlanView/VTOLLandingPatternMapVisual.qml</file>
Expand All @@ -220,7 +221,6 @@
<file alias="QGroundControl/FactControls/FactValueSlider.qml">src/FactSystem/FactControls/FactValueSlider.qml</file>
<file alias="QGroundControl/FactControls/LabelledFactComboBox.qml">src/FactSystem/FactControls/LabelledFactComboBox.qml</file>
<file alias="QGroundControl/FactControls/LabelledFactTextField.qml">src/FactSystem/FactControls/LabelledFactTextField.qml</file>
<file alias="QGroundControl/FactControls/LabelledFactSlider.qml">src/FactSystem/FactControls/LabelledFactSlider.qml</file>
<file alias="QGroundControl/FactControls/qmldir">src/QmlControls/QGroundControl/FactControls/qmldir</file>
<file alias="QGroundControl/FlightDisplay/CustomGuidedActionsController.qml">src/FlightDisplay/CustomGuidedActionsController.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewVideo.qml">src/FlightDisplay/FlightDisplayViewVideo.qml</file>
Expand Down
6 changes: 3 additions & 3 deletions src/Comms/MockLink/PX4MockLink.params
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
1 1 BAT1_CAPACITY -1.000000000000000000 9
1 1 BAT1_CNT_V_CURR 0.000805664050858468 9
1 1 BAT1_CNT_V_VOLT 0.000805664050858468 9
1 1 BAT1_CRIT_THR 0.070000000298023224 9
1 1 BAT1_EMERGEN_THR 0.050000000745058060 9
1 1 BAT1_LOW_THR 0.150000005960464478 9
1 1 BAT_CRIT_THR 0.070000000298023224 9
1 1 BAT_EMERGEN_THR 0.050000000745058060 9
1 1 BAT_LOW_THR 0.150000005960464478 9
1 1 BAT1_N_CELLS 3 6
1 1 BAT1_R_INTERNAL -1.000000000000000000 9
1 1 BAT1_SOURCE 0 6
Expand Down
34 changes: 0 additions & 34 deletions src/FactSystem/FactControls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,3 @@ target_link_libraries(FactControls
)

target_include_directories(FactControls INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

# qt_add_qml_module(FactControls
# URI QGroundControl.FactControls
# VERSION 1.0
# QML_FILES
# AltitudeFactTextField.qml
# FactBitmask.qml
# FactCheckBox.qml
# FactCheckBoxSlider.qml
# FactComboBox.qml
# FactLabel.qml
# FactTextField.qml
# FactTextFieldGrid.qml
# FactTextFieldRow.qml
# FactTextFieldSlider.qml
# FactValueSlider.qml
# LabelledFactComboBox.qml
# LabelledFactSlider.qml
# LabelledFactTextField.qml
# OUTPUT_TARGETS FactControls_targets
# IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
# IMPORTS
# QtQuick
# QtQuick.Controls
# QtQuick.Dialogs
# QtQuick.Layouts
# QGroundControl
# QGroundControl.Palette
# QGroundControl.Controls
# QGroundControl.FactSystem
# QGroundControl.ScreenTools
# DEPENDENCIES
# QtCore
# )
38 changes: 0 additions & 38 deletions src/FactSystem/FactControls/LabelledFactSlider.qml

This file was deleted.

29 changes: 21 additions & 8 deletions src/FirmwarePlugin/APM/APMBatteryIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ BatteryIndicator {
FactPanelController { id: controller }

property Fact batt1Monitor: controller.getParameterFact(-1, "BATT_MONITOR")
property string disabledString: qsTr("- disabled")

SettingsGroupLayout {
Layout.fillWidth: true
Expand All @@ -39,16 +40,22 @@ BatteryIndicator {
indexModel: false
}

LabelledFactTextField {
FactSlider {
Layout.fillWidth: true
label: qsTr("Voltage Trigger")
label: qsTr("Voltage Trigger") + (value == 0 ? disabledString : "")
fact: controller.getParameterFact(-1, "BATT_LOW_VOLT")
from: 0
to: 100
majorTickStepSize: 5
}

LabelledFactTextField {
FactSlider {
Layout.fillWidth: true
label: qsTr("mAh Trigger")
label: qsTr("mAh Trigger") + (value == 0 ? disabledString : "")
fact: controller.getParameterFact(-1, "BATT_LOW_MAH")
from: 0
to: 30000
majorTickStepSize: 1000
}
}

Expand All @@ -63,16 +70,22 @@ BatteryIndicator {
indexModel: false
}

LabelledFactTextField {
FactSlider {
Layout.fillWidth: true
label: qsTr("Voltage Trigger")
label: qsTr("Voltage Trigger") + (value == 0 ? disabledString : "")
fact: controller.getParameterFact(-1, "BATT_CRT_VOLT")
from: 0
to: 100
majorTickStepSize: 5
}

LabelledFactTextField {
FactSlider {
Layout.fillWidth: true
label: qsTr("mAh Trigger")
label: qsTr("mAh Trigger") + (value == 0 ? disabledString : "")
fact: controller.getParameterFact(-1, "BATT_CRT_MAH")
from: 0
to: 30000
majorTickStepSize: 1000
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/FirmwarePlugin/APM/APMMainStatusIndicatorContentItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ColumnLayout {
FactPanelController { id: controller }

SettingsGroupLayout {
heading: qsTr("GCS Failsafe")
heading: qsTr("Ground Control Data Link Failsafe")
Layout.fillWidth: true

LabelledFactComboBox {
Expand All @@ -34,11 +34,12 @@ ColumnLayout {
indexModel: false
}

LabelledFactSlider {
FactSlider {
Layout.fillWidth: true
label: qsTr("Timeout")
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 20
label: qsTr("Loss Timeout")
fact: controller.getParameterFact(-1, "FS_GCS_TIMEOUT")
sliderPreferredWidth: ScreenTools.defaultFontPixelWidth * 20
majorTickStepSize: 5
}
}

Expand Down
26 changes: 14 additions & 12 deletions src/FirmwarePlugin/PX4/PX4BatteryIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,35 @@ BatteryIndicator {
expandedPageComponent: Component {
SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Low Battery")
heading: qsTr("Low Battery Failsafe")

FactPanelController { id: controller }

LabelledFactSlider {
LabelledFactComboBox {
label: qsTr("Action")
fact: controller.getParameterFact(-1, "COM_LOW_BAT_ACT")
indexModel: false
}

FactSlider {
Layout.fillWidth: true
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 20
label: qsTr("Warning Level")
fact: controller.getParameterFact(-1, "BAT_LOW_THR")
majorTickStepSize: 5
}

LabelledFactSlider {
FactSlider {
Layout.fillWidth: true
label: qsTr("Failsafe Level")
label: qsTr("Critical Level")
fact: controller.getParameterFact(-1, "BAT_CRIT_THR")
majorTickStepSize: 5
}

LabelledFactSlider {
FactSlider {
Layout.fillWidth: true
label: qsTr("Emergency Level")
fact: controller.getParameterFact(-1, "BAT_EMERGEN_THR")
}

LabelledFactComboBox {
label: qsTr("Failsafe Action")
fact: controller.getParameterFact(-1, "COM_LOW_BAT_ACT")
indexModel: false
majorTickStepSize: 5
}
}
}
Expand Down
Loading

0 comments on commit 5976d7c

Please sign in to comment.