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
22 labelText: qsTr("Status")
24 if (!_activeJoystick) return qsTr("No joystick detected")
25 if (_activeJoystick.axisCount === 0) return qsTr("Buttons only")
26 if (!_activeJoystick.requiresCalibration) return qsTr("Ready")
27 return _activeJoystick.settings.calibrated.rawValue ? qsTr("Calibrated") : qsTr("Needs calibration")
32 visible: _activeJoystick
33 labelText: qsTr("Type")
35 if (!_activeJoystick) return ""
36 if (_activeJoystick.isGamepad) {
37 return _activeJoystick.gamepadType || qsTr("Gamepad")
39 return qsTr("Joystick")
44 visible: _activeJoystick && _activeJoystick.connectionType
45 labelText: qsTr("Connection")
46 valueText: _activeJoystick ? _activeJoystick.connectionType : ""
50 visible: _activeJoystick
51 labelText: qsTr("Inputs")
53 if (!_activeJoystick) return ""
55 if (_activeJoystick.axisCount > 0) parts.push(qsTr("%1 axes").arg(_activeJoystick.axisCount))
56 if (_activeJoystick.buttonCount > 0) parts.push(qsTr("%1 buttons").arg(_activeJoystick.buttonCount))
57 if (_activeJoystick.ballCount > 0) parts.push(qsTr("%1 balls").arg(_activeJoystick.ballCount))
58 if (_activeJoystick.touchpadCount() > 0) parts.push(qsTr("%1 touchpads").arg(_activeJoystick.touchpadCount()))
59 return parts.join(", ")
64 visible: _activeJoystick && _activeJoystick.batteryPercent >= 0
65 labelText: qsTr("Battery")
67 if (!_activeJoystick || _activeJoystick.batteryPercent < 0) return ""
68 var text = qsTr("%1%").arg(_activeJoystick.batteryPercent)
69 if (_activeJoystick.powerState) text += " (" + _activeJoystick.powerState + ")"
72 valueColor: _activeJoystick && _activeJoystick.batteryPercent < 20 ? "red" : ""
76 visible: _activeJoystick && (_activeJoystick.hasRumble || _activeJoystick.hasLED || _activeJoystick.hasGyroscope() || _activeJoystick.hasAccelerometer())
77 labelText: qsTr("Features")
79 if (!_activeJoystick) return ""
81 if (_activeJoystick.hasRumble) features.push(qsTr("Rumble"))
82 if (_activeJoystick.hasRumbleTriggers) features.push(qsTr("Triggers"))
83 if (_activeJoystick.hasLED) features.push(qsTr("LED"))
84 if (_activeJoystick.hasGyroscope()) features.push(qsTr("Gyro"))
85 if (_activeJoystick.hasAccelerometer()) features.push(qsTr("Accel"))
86 return features.join(", ")
91 visible: _activeJoystick && _activeJoystick.vendorId > 0
92 labelText: qsTr("Device ID")
93 valueText: _activeJoystick ? "0x%1:0x%2".arg(_activeJoystick.vendorId.toString(16).toUpperCase().padStart(4, '0')).arg(_activeJoystick.productId.toString(16).toUpperCase().padStart(4, '0')) : ""
97 visible: _activeJoystick && _activeJoystick.playerIndex >= 0
98 labelText: qsTr("Player")
99 valueText: _activeJoystick ? (_activeJoystick.playerIndex + 1).toString() : ""
103 visible: _activeJoystick && _activeJoystick.isVirtual
104 labelText: qsTr("Virtual")
105 valueText: qsTr("Yes")