Commit 86e636ab authored by Don Gagne's avatar Don Gagne

SetupPage is usable without VehicleComponent

parent 589046c1
......@@ -25,6 +25,8 @@ QGCView {
viewPanel: setupPanel
property alias pageComponent: pageLoader.sourceComponent
property string pageName: vehicleComponent ? vehicleComponent.name : ""
property string pageDescription: vehicleComponent ? vehicleComponent.description : ""
property real availableWidth: width - pageLoader.x
property real availableHeight: height - pageLoader.y
......@@ -49,7 +51,7 @@ QGCView {
QGCLabel {
font.pointSize: ScreenTools.largeFontPointSize
text: vehicleComponent.name + " " + qsTr("Setup")
text: pageName + " " + qsTr("Setup")
visible: !ScreenTools.isShortScreen
}
......@@ -57,7 +59,7 @@ QGCView {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: vehicleComponent.description
text: pageDescription
visible: !ScreenTools.isShortScreen
}
}
......
......@@ -45,14 +45,14 @@ Rectangle {
{
if (_fullParameterVehicleAvailable) {
if (QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents.length == 0) {
panelLoader.sourceComponent = noComponentsVehicleSummaryComponent
panelLoader.setSourceComponent(noComponentsVehicleSummaryComponent)
} else {
panelLoader.source = "VehicleSummary.qml";
panelLoader.setSource("VehicleSummary.qml")
}
} else if (QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable) {
panelLoader.sourceComponent = missingParametersVehicleSummaryComponent
panelLoader.setSourceComponent(missingParametersVehicleSummaryComponent)
} else {
panelLoader.sourceComponent = disconnectedVehicleSummaryComponent
panelLoader.setSourceComponent(disconnectedVehicleSummaryComponent)
}
}
......@@ -61,9 +61,9 @@ Rectangle {
if (!ScreenTools.isMobile) {
if (QGroundControl.multiVehicleManager.activeVehicleAvailable && QGroundControl.multiVehicleManager.activeVehicle.armed) {
_messagePanelText = _armedVehicleText
panelLoader.sourceComponent = messagePanelComponent
panelLoader.setSourceComponent(messagePanelComponent)
} else {
panelLoader.source = "FirmwareUpgrade.qml";
panelLoader.setSource("FirmwareUpgrade.qml")
}
}
}
......@@ -72,34 +72,33 @@ Rectangle {
{
if (QGroundControl.multiVehicleManager.activeVehicleAvailable && QGroundControl.multiVehicleManager.activeVehicle.armed) {
_messagePanelText = _armedVehicleText
panelLoader.sourceComponent = messagePanelComponent
panelLoader.setSourceComponent(messagePanelComponent)
} else {
panelLoader.source = "JoystickConfig.qml";
panelLoader.setSource("JoystickConfig.qml")
}
}
function showParametersPanel()
{
panelLoader.source = "SetupParameterEditor.qml";
panelLoader.setSource("SetupParameterEditor.qml")
}
function showPX4FlowPanel()
{
panelLoader.source = "PX4FlowSensor.qml";
panelLoader.setSource("PX4FlowSensor.qml")
}
function showVehicleComponentPanel(vehicleComponent)
{
if (QGroundControl.multiVehicleManager.activeVehicle.armed && !vehicleComponent.allowSetupWhileArmed) {
_messagePanelText = _armedVehicleText
panelLoader.sourceComponent = messagePanelComponent
panelLoader.setSourceComponent(messagePanelComponent)
} else {
if (vehicleComponent.prerequisiteSetup != "") {
_messagePanelText = vehicleComponent.prerequisiteSetup + " setup must be completed prior to " + vehicleComponent.name + " setup."
panelLoader.sourceComponent = messagePanelComponent
panelLoader.setSourceComponent(messagePanelComponent)
} else {
panelLoader.vehicleComponent = vehicleComponent
panelLoader.source = vehicleComponent.setupSource
panelLoader.setSource(vehicleComponent.setupSource, vehicleComponent)
for(var i = 0; i < componentRepeater.count; i++) {
var obj = componentRepeater.itemAt(i);
if (obj.text === vehicleComponent.name) {
......@@ -350,6 +349,16 @@ Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
function setSource(source, vehicleComponent) {
panelLoader.vehicleComponent = vehicleComponent
panelLoader.source = source
}
function setSourceComponent(sourceComponent, vehicleComponent) {
panelLoader.vehicleComponent = vehicleComponent
panelLoader.sourceComponent = sourceComponent
}
property var vehicleComponent
}
}
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