11 , _name(tr(
"Joystick"))
13 qCDebug(JoystickComponentLog) <<
this;
23 qCDebug(JoystickComponentLog) <<
this;
28 return tr(
"Configure axis calibration, button assignments, and input settings.");
38 return QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/VehicleSetup/JoystickComponent.qml"));
43 return QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AutoPilotPlugins/Common/JoystickComponentSummary.qml"));
48 if (!_activeJoystick) {
49 return tr(
"No joystick detected");
52 if (_activeJoystick->axisCount() == 0) {
53 return tr(
"Buttons only");
56 if (!_activeJoystick->requiresCalibration()) {
60 return _activeJoystick->settings()->calibrated()->rawValue().toBool() ? tr(
"Calibrated") : tr(
"Needs calibration");
65 if (!_activeJoystick) {
71 if (_activeJoystick->hasRumble()) {
72 features.append(tr(
"Rumble"));
74 if (_activeJoystick->hasRumbleTriggers()) {
75 features.append(tr(
"Trigger Rumble"));
77 if (_activeJoystick->hasLED()) {
78 features.append(tr(
"LED"));
80 if (_activeJoystick->hasGyroscope()) {
81 features.append(tr(
"Gyro"));
83 if (_activeJoystick->hasAccelerometer()) {
84 features.append(tr(
"Accel"));
86 if (_activeJoystick->touchpadCount() > 0) {
87 features.append(tr(
"Touchpad"));
90 return features.join(QStringLiteral(
", "));
93void JoystickComponent::_activeJoystickChanged(
Joystick *joystick)
95 if (_activeJoystick) {
99 _activeJoystick =
nullptr;
103 _activeJoystick = joystick;
105 (void) connect(_activeJoystick->settings()->calibrated(), &
Fact::rawValueChanged,
this, &JoystickComponent::_joystickCalibrationChanged);
113void JoystickComponent::_joystickCalibrationChanged()
118void JoystickComponent::_joystickBatteryChanged()
#define QGC_LOGGING_CATEGORY(name, categoryStr)
The AutoPilotPlugin class is an abstract base class which represents the methods and objects which ar...
void rawValueChanged(const QVariant &value)
void joystickStatusChanged()
Joystick * activeJoystick() const
~JoystickComponent() override
QString joystickFeaturesText() const
QString description() const final
JoystickComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent=nullptr)
QUrl summaryQmlSource() const final
bool setupComplete() const final
QString joystickStatusText() const
QUrl setupSource() const final
void activeJoystickChanged()
static JoystickManager * instance()
Joystick * activeJoystick()
void activeJoystickChanged(Joystick *joystick)
void batteryStateChanged()
JoystickSettings * settings()
VehicleComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent, QObject *parent=nullptr)
void setupCompleteChanged()