From 3d6b20d870bcb0a0ed318fa966fa02be22bb4b7b Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 4 Apr 2016 11:42:21 -0700 Subject: [PATCH] RadioCal scrolling --- .../Common/RadioComponent.qml | 513 +++++++++--------- 1 file changed, 259 insertions(+), 254 deletions(-) diff --git a/src/AutoPilotPlugins/Common/RadioComponent.qml b/src/AutoPilotPlugins/Common/RadioComponent.qml index 402f41a01..8bac4be6c 100644 --- a/src/AutoPilotPlugins/Common/RadioComponent.qml +++ b/src/AutoPilotPlugins/Common/RadioComponent.qml @@ -254,331 +254,336 @@ QGCView { // Main view Qml starts here - // Left side column - Column { - id: leftColumn - anchors.top: parent.top - anchors.left: parent.left - anchors.right: columnSpacer.left - spacing: 10 - - // Attitude Controls + QGCFlickable { + anchors.fill: parent + contentHeight: Math.max(leftColumn.height, rightColumn.height) + clip: true + + // Left side column Column { - width: parent.width - spacing: 5 + id: leftColumn + anchors.left: parent.left + anchors.right: columnSpacer.left + spacing: 10 - QGCLabel { text: "Attitude Controls" } + // Attitude Controls + Column { + width: parent.width + spacing: 5 - Item { - width: parent.width - height: defaultTextHeight * 2 + QGCLabel { text: "Attitude Controls" } - QGCLabel { - id: rollLabel - width: defaultTextWidth * 10 - text: "Roll" - } + Item { + width: parent.width + height: defaultTextHeight * 2 - Loader { - id: rollLoader - anchors.left: rollLabel.right - anchors.right: parent.right - height: qgcView.defaultTextHeight - width: 100 - sourceComponent: channelMonitorDisplayComponent - - property real defaultTextWidth: qgcView.defaultTextWidth - property bool mapped: controller.rollChannelMapped - property bool reversed: controller.rollChannelReversed - } + QGCLabel { + id: rollLabel + width: defaultTextWidth * 10 + text: "Roll" + } - Connections { - target: controller + Loader { + id: rollLoader + anchors.left: rollLabel.right + anchors.right: parent.right + height: qgcView.defaultTextHeight + width: 100 + sourceComponent: channelMonitorDisplayComponent + + property real defaultTextWidth: qgcView.defaultTextWidth + property bool mapped: controller.rollChannelMapped + property bool reversed: controller.rollChannelReversed + } + + Connections { + target: controller - onRollChannelRCValueChanged: rollLoader.item.rcValue = rcValue + onRollChannelRCValueChanged: rollLoader.item.rcValue = rcValue + } } - } - Item { - width: parent.width - height: defaultTextHeight * 2 + Item { + width: parent.width + height: defaultTextHeight * 2 - QGCLabel { - id: pitchLabel - width: defaultTextWidth * 10 - text: "Pitch" - } + QGCLabel { + id: pitchLabel + width: defaultTextWidth * 10 + text: "Pitch" + } - Loader { - id: pitchLoader - anchors.left: pitchLabel.right - anchors.right: parent.right - height: qgcView.defaultTextHeight - width: 100 - sourceComponent: channelMonitorDisplayComponent - - property real defaultTextWidth: qgcView.defaultTextWidth - property bool mapped: controller.pitchChannelMapped - property bool reversed: controller.pitchChannelReversed - } + Loader { + id: pitchLoader + anchors.left: pitchLabel.right + anchors.right: parent.right + height: qgcView.defaultTextHeight + width: 100 + sourceComponent: channelMonitorDisplayComponent + + property real defaultTextWidth: qgcView.defaultTextWidth + property bool mapped: controller.pitchChannelMapped + property bool reversed: controller.pitchChannelReversed + } - Connections { - target: controller + Connections { + target: controller - onPitchChannelRCValueChanged: pitchLoader.item.rcValue = rcValue + onPitchChannelRCValueChanged: pitchLoader.item.rcValue = rcValue + } } - } - Item { - width: parent.width - height: defaultTextHeight * 2 + Item { + width: parent.width + height: defaultTextHeight * 2 - QGCLabel { - id: yawLabel - width: defaultTextWidth * 10 - text: "Yaw" - } + QGCLabel { + id: yawLabel + width: defaultTextWidth * 10 + text: "Yaw" + } - Loader { - id: yawLoader - anchors.left: yawLabel.right - anchors.right: parent.right - height: qgcView.defaultTextHeight - width: 100 - sourceComponent: channelMonitorDisplayComponent - - property real defaultTextWidth: qgcView.defaultTextWidth - property bool mapped: controller.yawChannelMapped - property bool reversed: controller.yawChannelReversed - } + Loader { + id: yawLoader + anchors.left: yawLabel.right + anchors.right: parent.right + height: qgcView.defaultTextHeight + width: 100 + sourceComponent: channelMonitorDisplayComponent + + property real defaultTextWidth: qgcView.defaultTextWidth + property bool mapped: controller.yawChannelMapped + property bool reversed: controller.yawChannelReversed + } - Connections { - target: controller + Connections { + target: controller - onYawChannelRCValueChanged: yawLoader.item.rcValue = rcValue + onYawChannelRCValueChanged: yawLoader.item.rcValue = rcValue + } } - } - Item { - width: parent.width - height: defaultTextHeight * 2 + Item { + width: parent.width + height: defaultTextHeight * 2 - QGCLabel { - id: throttleLabel - width: defaultTextWidth * 10 - text: "Throttle" - } + QGCLabel { + id: throttleLabel + width: defaultTextWidth * 10 + text: "Throttle" + } - Loader { - id: throttleLoader - anchors.left: throttleLabel.right - anchors.right: parent.right - height: qgcView.defaultTextHeight - width: 100 - sourceComponent: channelMonitorDisplayComponent - - property real defaultTextWidth: qgcView.defaultTextWidth - property bool mapped: controller.throttleChannelMapped - property bool reversed: controller.throttleChannelReversed - } + Loader { + id: throttleLoader + anchors.left: throttleLabel.right + anchors.right: parent.right + height: qgcView.defaultTextHeight + width: 100 + sourceComponent: channelMonitorDisplayComponent + + property real defaultTextWidth: qgcView.defaultTextWidth + property bool mapped: controller.throttleChannelMapped + property bool reversed: controller.throttleChannelReversed + } - Connections { - target: controller + Connections { + target: controller - onThrottleChannelRCValueChanged: throttleLoader.item.rcValue = rcValue + onThrottleChannelRCValueChanged: throttleLoader.item.rcValue = rcValue + } } - } - } // Column - Attitude Control labels + } // Column - Attitude Control labels - // Command Buttons - Row { - spacing: 10 + // Command Buttons + Row { + spacing: 10 - QGCButton { - id: skipButton - text: "Skip" + QGCButton { + id: skipButton + text: "Skip" - onClicked: controller.skipButtonClicked() - } + onClicked: controller.skipButtonClicked() + } - QGCButton { - id: cancelButton - text: "Cancel" + QGCButton { + id: cancelButton + text: "Cancel" - onClicked: controller.cancelButtonClicked() - } + onClicked: controller.cancelButtonClicked() + } - QGCButton { - id: nextButton - primary: true - text: "Calibrate" - - onClicked: { - if (text == "Calibrate") { - showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) - } else { - controller.nextButtonClicked() + QGCButton { + id: nextButton + primary: true + text: "Calibrate" + + onClicked: { + if (text == "Calibrate") { + showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) + } else { + controller.nextButtonClicked() + } } } - } - } // Row - Buttons - - // Status Text - QGCLabel { - id: statusText - width: parent.width - wrapMode: Text.WordWrap - } - - Item { - width: 10 - height: defaultTextHeight * 4 - } - - Rectangle { - width: parent.width - height: 1 - border.color: qgcPal.text - border.width: 1 - } - - QGCLabel { text: "Additional Radio setup:" } - - Row { - spacing: 10 + } // Row - Buttons + // Status Text QGCLabel { - anchors.baseline: bindButton.baseline - text: "Place Spektrum satellite receiver in bind mode:" + id: statusText + width: parent.width + wrapMode: Text.WordWrap } - QGCButton { - id: bindButton - text: "Spektrum Bind" - - onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) + Item { + width: 10 + height: defaultTextHeight * 4 } - } - QGCButton { - text: "Copy Trims" - visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware - onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) - } + Rectangle { + width: parent.width + height: 1 + border.color: qgcPal.text + border.width: 1 + } - Repeater { - model: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? [ "RC_MAP_FLAPS", "RC_MAP_AUX1", "RC_MAP_AUX2", "RC_MAP_AUX3" ] : 0 + QGCLabel { text: "Additional Radio setup:" } Row { - spacing: ScreenTools.defaultFontPixelWidth - - property Fact fact: controller.getParameterFact(-1, modelData) + spacing: 10 QGCLabel { - anchors.baseline: optCombo.baseline - text: fact.shortDescription + ":" + anchors.baseline: bindButton.baseline + text: "Place Spektrum satellite receiver in bind mode:" } - FactComboBox { - id: optCombo - width: ScreenTools.defaultFontPixelWidth * 15 - fact: parent.fact - indexModel: false + QGCButton { + id: bindButton + text: "Spektrum Bind" + + onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } } - } // Repeater - } // Column - Left Column - - Item { - id: columnSpacer - anchors.right: rightColumn.left - width: 20 - } - // Right side column - Column { - id: rightColumn - anchors.top: parent.top - anchors.right: parent.right - width: defaultTextWidth * 35 - spacing: 10 + QGCButton { + text: "Copy Trims" + visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware + onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) + } - Row { - spacing: 10 - ExclusiveGroup { id: modeGroup } + Repeater { + model: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? [ "RC_MAP_FLAPS", "RC_MAP_AUX1", "RC_MAP_AUX2", "RC_MAP_AUX3" ] : 0 - QGCRadioButton { - exclusiveGroup: modeGroup - text: "Mode 1" - checked: controller.transmitterMode == 1 + Row { + spacing: ScreenTools.defaultFontPixelWidth - onClicked: controller.transmitterMode = 1 - } + property Fact fact: controller.getParameterFact(-1, modelData) - QGCRadioButton { - exclusiveGroup: modeGroup - text: "Mode 2" - checked: controller.transmitterMode == 2 + QGCLabel { + anchors.baseline: optCombo.baseline + text: fact.shortDescription + ":" + } - onClicked: controller.transmitterMode = 2 - } - } + FactComboBox { + id: optCombo + width: ScreenTools.defaultFontPixelWidth * 15 + fact: parent.fact + indexModel: false + } + } + } // Repeater + } // Column - Left Column - Image { - width: parent.width - height: defaultTextHeight * 15 - fillMode: Image.PreserveAspectFit - smooth: true - source: controller.imageHelp + Item { + id: columnSpacer + anchors.right: rightColumn.left + width: 20 } - // Channel monitor + // Right side column Column { - width: parent.width - spacing: 5 + id: rightColumn + anchors.top: parent.top + anchors.right: parent.right + width: defaultTextWidth * 35 + spacing: 10 - QGCLabel { text: "Channel Monitor" } + Row { + spacing: 10 + ExclusiveGroup { id: modeGroup } - Connections { - target: controller + QGCRadioButton { + exclusiveGroup: modeGroup + text: "Mode 1" + checked: controller.transmitterMode == 1 - onChannelRCValueChanged: { - if (channelMonitorRepeater.itemAt(channel)) { - channelMonitorRepeater.itemAt(channel).loader.item.rcValue = rcValue - } + onClicked: controller.transmitterMode = 1 + } + + QGCRadioButton { + exclusiveGroup: modeGroup + text: "Mode 2" + checked: controller.transmitterMode == 2 + + onClicked: controller.transmitterMode = 2 } } - Repeater { - id: channelMonitorRepeater - model: controller.channelCount - width: parent.width + Image { + width: parent.width + height: defaultTextHeight * 15 + fillMode: Image.PreserveAspectFit + smooth: true + source: controller.imageHelp + } - Row { - spacing: 5 + // Channel monitor + Column { + width: parent.width + spacing: 5 - // Need this to get to loader from Connections above - property Item loader: theLoader + QGCLabel { text: "Channel Monitor" } - QGCLabel { - id: channelLabel - text: modelData + 1 + Connections { + target: controller + + onChannelRCValueChanged: { + if (channelMonitorRepeater.itemAt(channel)) { + channelMonitorRepeater.itemAt(channel).loader.item.rcValue = rcValue + } } + } - Loader { - id: theLoader - anchors.verticalCenter: channelLabel.verticalCenter - height: qgcView.defaultTextHeight - width: 200 - sourceComponent: channelMonitorDisplayComponent - - property real defaultTextWidth: qgcView.defaultTextWidth - property bool mapped: true - readonly property bool reversed: false + Repeater { + id: channelMonitorRepeater + model: controller.channelCount + width: parent.width + + Row { + spacing: 5 + + // Need this to get to loader from Connections above + property Item loader: theLoader + + QGCLabel { + id: channelLabel + text: modelData + 1 + } + + Loader { + id: theLoader + anchors.verticalCenter: channelLabel.verticalCenter + height: qgcView.defaultTextHeight + width: 200 + sourceComponent: channelMonitorDisplayComponent + + property real defaultTextWidth: qgcView.defaultTextWidth + property bool mapped: true + readonly property bool reversed: false + } } } - } - } // Column - Channel Monitor - } // Column - Right Column + } // Column - Channel Monitor + } // Column - Right Column + } // QGCFlickable } // QGCViewPanel } -- 2.22.0