Commit c7f840ac authored by DonLakeFlyer's avatar DonLakeFlyer

parent 48fa322b
......@@ -6,6 +6,9 @@ import QtGraphicalEffects 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
// Important Note: SubMenuButtons must manage their checked state manually in order to support
// view switch prevention. This means they can't be checkable or autoExclusive.
Button {
id: _rootButton
property bool setupComplete: true ///< true: setup complete indicator shows as completed
......@@ -14,11 +17,13 @@ Button {
property size sourceSize: Qt.size(ScreenTools.defaultFontPixelHeight * 2, ScreenTools.defaultFontPixelHeight * 2)
text: "Button" ///< Pass in your own button text
activeFocusOnPress: true
checkable: true
implicitHeight: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3.5 : ScreenTools.defaultFontPixelHeight * 2.5
implicitWidth: __panel.implicitWidth
onCheckedChanged: checkable = false
style: ButtonStyle {
id: buttonStyle
......
......@@ -41,6 +41,9 @@ Rectangle {
function showSummaryPanel()
{
if (mainWindow.preventViewSwitch) {
return
}
if (_fullParameterVehicleAvailable) {
if (QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents.length === 0) {
panelLoader.setSourceComponent(noComponentsVehicleSummaryComponent)
......@@ -54,30 +57,19 @@ Rectangle {
}
}
function showFirmwarePanel()
{
if (!ScreenTools.isMobile) {
panelLoader.setSource("FirmwareUpgrade.qml")
}
}
function showJoystickPanel()
{
panelLoader.setSource("JoystickConfig.qml")
}
function showParametersPanel()
{
panelLoader.setSource("SetupParameterEditor.qml")
function showPanel(button, qmlSource) {
if (mainWindow.preventViewSwitch) {
return
}
function showPX4FlowPanel()
{
panelLoader.setSource("PX4FlowSensor.qml")
button.checked = true
panelLoader.setSource(qmlSource)
}
function showVehicleComponentPanel(vehicleComponent)
{
if (mainWindow.preventViewSwitch) {
return
}
var autopilotPlugin = QGroundControl.multiVehicleManager.activeVehicle.autopilot
var prereq = autopilotPlugin.prerequisiteSetup(vehicleComponent)
if (prereq !== "") {
......@@ -229,7 +221,7 @@ Rectangle {
exclusiveGroup: setupButtonGroup
text: modelData.title
visible: _corePlugin && _corePlugin.options.combineSettingsAndSetup
onClicked: panelLoader.setSource(modelData.url)
onClicked: showPanel(this, modelData.url)
Layout.fillWidth: true
}
}
......@@ -255,7 +247,7 @@ Rectangle {
text: qsTr("Firmware")
Layout.fillWidth: true
onClicked: showFirmwarePanel()
onClicked: showPanel(this, "FirmwareUpgrade.qml")
}
SubMenuButton {
......@@ -265,8 +257,7 @@ Rectangle {
setupIndicator: false
text: qsTr("PX4Flow")
Layout.fillWidth: true
onClicked: showPX4FlowPanel()
onClicked: showPX4FlowPanel(this, "PX4FlowSensor.qml")
}
SubMenuButton {
......@@ -277,8 +268,7 @@ Rectangle {
visible: _fullParameterVehicleAvailable && joystickManager.joysticks.length !== 0
text: qsTr("Joystick")
Layout.fillWidth: true
onClicked: showJoystickPanel()
onClicked: showJoystickPanel(this, "JoystickConfig.qml")
}
Repeater {
......@@ -293,7 +283,6 @@ Rectangle {
text: modelData.name
visible: modelData.setupSource.toString() !== ""
Layout.fillWidth: true
onClicked: showVehicleComponentPanel(modelData)
}
}
......@@ -306,8 +295,7 @@ Rectangle {
_corePlugin.showAdvancedUI
text: qsTr("Parameters")
Layout.fillWidth: true
onClicked: showParametersPanel()
onClicked: showPanel(this, "SetupParameterEditor.qml")
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment