6import QGroundControl.Controls
9 implicitWidth: mainLayout.implicitWidth
10 implicitHeight: mainLayout.implicitHeight
11 width: parent.width // grows when Loader is wider than implicitWidth
13 readonly property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
14 readonly property var _activeJoystick: joystickManager.activeJoystick
21 labelText: qsTr("Status")
23 if (!_activeJoystick) return qsTr("No joystick detected")
24 if (_activeJoystick.axisCount === 0) return qsTr("Buttons only")
25 if (!_activeJoystick.requiresCalibration) return qsTr("Ready")
26 return _activeJoystick.settings.calibrated.rawValue ? qsTr("Calibrated") : qsTr("Needs calibration")
31 visible: _activeJoystick
32 labelText: qsTr("Type")
34 if (!_activeJoystick) return ""
35 if (_activeJoystick.isGamepad) {
36 return _activeJoystick.gamepadType || qsTr("Gamepad")
38 return qsTr("Joystick")
43 visible: _activeJoystick && _activeJoystick.connectionType
44 labelText: qsTr("Connection")
45 valueText: _activeJoystick ? _activeJoystick.connectionType : ""
49 visible: _activeJoystick
50 labelText: qsTr("Inputs")
52 if (!_activeJoystick) return ""
54 if (_activeJoystick.axisCount > 0) parts.push(qsTr("%1 axes").arg(_activeJoystick.axisCount))
55 if (_activeJoystick.buttonCount > 0) parts.push(qsTr("%1 buttons").arg(_activeJoystick.buttonCount))
56 if (_activeJoystick.ballCount > 0) parts.push(qsTr("%1 balls").arg(_activeJoystick.ballCount))
57 if (_activeJoystick.touchpadCount() > 0) parts.push(qsTr("%1 touchpads").arg(_activeJoystick.touchpadCount()))
58 return parts.join(", ")
63 visible: _activeJoystick && _activeJoystick.batteryPercent >= 0
64 labelText: qsTr("Battery")
66 if (!_activeJoystick || _activeJoystick.batteryPercent < 0) return ""
67 var text = qsTr("%1%").arg(_activeJoystick.batteryPercent)
68 if (_activeJoystick.powerState) text += " (" + _activeJoystick.powerState + ")"
71 valueColor: _activeJoystick && _activeJoystick.batteryPercent < 20 ? "red" : ""
75 visible: _activeJoystick && (_activeJoystick.hasRumble || _activeJoystick.hasLED || _activeJoystick.hasGyroscope() || _activeJoystick.hasAccelerometer())
76 labelText: qsTr("Features")
78 if (!_activeJoystick) return ""
80 if (_activeJoystick.hasRumble) features.push(qsTr("Rumble"))
81 if (_activeJoystick.hasRumbleTriggers) features.push(qsTr("Triggers"))
82 if (_activeJoystick.hasLED) features.push(qsTr("LED"))
83 if (_activeJoystick.hasGyroscope()) features.push(qsTr("Gyro"))
84 if (_activeJoystick.hasAccelerometer()) features.push(qsTr("Accel"))
85 return features.join(", ")
90 visible: _activeJoystick && _activeJoystick.vendorId > 0
91 labelText: qsTr("Device ID")
92 valueText: _activeJoystick ? "0x%1:0x%2".arg(_activeJoystick.vendorId.toString(16).toUpperCase().padStart(4, '0')).arg(_activeJoystick.productId.toString(16).toUpperCase().padStart(4, '0')) : ""
96 visible: _activeJoystick && _activeJoystick.playerIndex >= 0
97 labelText: qsTr("Player")
98 valueText: _activeJoystick ? (_activeJoystick.playerIndex + 1).toString() : ""
102 visible: _activeJoystick && _activeJoystick.isVirtual
103 labelText: qsTr("Virtual")
104 valueText: qsTr("Yes")