Commit f4b62d90 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #3906 from DonLakeFlyer/JoystickConfig

Joystick config: Fix scrolling
parents 3f63baf5 fcf77a69
......@@ -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
}
}
......
......@@ -21,23 +21,30 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
/// Joystick Config
QGCView {
id: rootQGCView
viewPanel: panel
SetupPage {
id: joystickPage
pageComponent: pageComponent
pageName: qsTr("Joystick")
pageDescription: qsTr("Joystick Setup is used to configure a calibrate joysticks.")
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
Component {
id: pageComponent
Item {
width: availableWidth
height: Math.max(leftColumn.height, rightColumn.height)
readonly property string dialogTitle: qsTr("Joystick Config")
readonly property real labelToMonitorMargin: defaultTextWidth * 3
property bool controllerCompleted: false
property bool controllerAndViewReady: false
readonly property real labelToMonitorMargin: defaultTextWidth * 3
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _activeJoystick: joystickManager.activeJoystick
JoystickConfigController {
id: controller
factPanel: panel
factPanel: joystickPage.viewPanel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
......@@ -45,24 +52,20 @@ QGCView {
Component.onCompleted: {
controllerCompleted = true
if (rootQGCView.completedSignalled) {
if (joystickPage.completedSignalled) {
controllerAndViewReady = true
controller.start()
}
}
}
onCompleted: {
Component.onCompleted: {
if (controllerCompleted) {
controllerAndViewReady = true
controller.start()
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
// Live axis monitor control component
Component {
id: axisMonitorDisplayComponent
......@@ -123,36 +126,22 @@ QGCView {
duration: 1500
}
/*
/*
// Axis value debugger
QGCLabel {
anchors.fill: parent
text: axisValue
}
*/
*/
}
} // Component - axisMonitorDisplayComponent
// Main view Qml starts here
QGCLabel {
id: header
font.pointSize: ScreenTools.mediumFontPointSize
text: qsTr("JOYSTICK")
}
Item {
id: spacer
anchors.top: header.bottom
width: parent.width
height: 10
}
// Left side column
Column {
id: leftColumn
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.top: spacer.bottom
anchors.left: parent.left
anchors.right: rightColumn.left
spacing: 10
......@@ -178,11 +167,11 @@ QGCView {
id: rollLoader
anchors.left: rollLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
height: ScreenTools.defaultFontPixelHeight
width: 100
sourceComponent: axisMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property bool mapped: controller.rollAxisMapped
property bool reversed: controller.rollAxisReversed
}
......@@ -208,11 +197,11 @@ QGCView {
id: pitchLoader
anchors.left: pitchLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
height: ScreenTools.defaultFontPixelHeight
width: 100
sourceComponent: axisMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property bool mapped: controller.pitchAxisMapped
property bool reversed: controller.pitchAxisReversed
}
......@@ -238,11 +227,11 @@ QGCView {
id: yawLoader
anchors.left: yawLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
height: ScreenTools.defaultFontPixelHeight
width: 100
sourceComponent: axisMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property bool mapped: controller.yawAxisMapped
property bool reversed: controller.yawAxisReversed
}
......@@ -268,11 +257,11 @@ QGCView {
id: throttleLoader
anchors.left: throttleLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
height: ScreenTools.defaultFontPixelHeight
width: 100
sourceComponent: axisMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property bool mapped: controller.throttleAxisMapped
property bool reversed: controller.throttleAxisReversed
}
......@@ -647,11 +636,11 @@ QGCView {
Loader {
id: theLoader
anchors.verticalCenter: axisLabel.verticalCenter
height: rootQGCView.defaultTextHeight
height: ScreenTools.defaultFontPixelHeight
width: 200
sourceComponent: axisMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property bool mapped: true
readonly property bool reversed: false
}
......@@ -676,7 +665,8 @@ QGCView {
}
}
Row {
Flow {
width: parent.width
spacing: -1
Repeater {
......@@ -704,5 +694,6 @@ QGCView {
} // Row
} // Column - Axis Monitor
} // Column - Right Column
} // QGCViewPanel
}
} // Item
} // Component - pageComponent
} // SetupPage
......@@ -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