13 qCDebug(JoystickComponentLog) <<
this;
18 _activeJoystickChanged(JoystickManager::instance()->activeJoystick());
21JoystickComponent::~JoystickComponent()
23 qCDebug(JoystickComponentLog) <<
this;
26QString JoystickComponent::description()
const
28 return tr(
"Configure joystick input, calibrate axes, and manage button assignments.");
31bool JoystickComponent::setupComplete()
const
33 return !JoystickManager::instance()->activeJoystick() || JoystickManager::instance()->activeJoystick()->
settings()->
calibrated()->rawValue().toBool();
36QUrl JoystickComponent::setupSource()
const
38 return QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/VehicleSetup/JoystickComponent.qml"));
41QUrl JoystickComponent::summaryQmlSource()
const
43 return QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AutoPilotPlugins/Common/JoystickComponentSummary.qml"));
46QString JoystickComponent::joystickStatusText()
const
48 if (!_activeJoystick) {
49 return tr(
"No joystick detected");
53 return tr(
"Buttons only");
60 return _activeJoystick->
settings()->
calibrated()->rawValue().toBool() ? tr(
"Calibrated") : tr(
"Needs calibration");
63QString JoystickComponent::joystickFeaturesText()
const
65 if (!_activeJoystick) {
72 features.append(tr(
"Rumble"));
75 features.append(tr(
"Trigger Rumble"));
77 if (_activeJoystick->
hasLED()) {
78 features.append(tr(
"LED"));
81 features.append(tr(
"Gyro"));
84 features.append(tr(
"Accel"));
87 features.append(tr(
"Touchpad"));
90 return features.join(QStringLiteral(
", "));
93void JoystickComponent::_activeJoystickChanged(
Joystick *joystick)
95 if (_activeJoystick) {
99 _activeJoystick =
nullptr;
103 _activeJoystick = joystick;
113void JoystickComponent::_joystickCalibrationChanged()
118void JoystickComponent::_joystickBatteryChanged()
#define QGC_LOGGING_CATEGORY(name, categoryStr)
void rawValueChanged(const QVariant &value)
void joystickStatusChanged()
void activeJoystickChanged()
void activeJoystickChanged(Joystick *joystick)
Fact *calibrated READ calibrated CONSTANT Fact * calibrated()
virtual bool hasAccelerometer() const
virtual bool hasRumbleTriggers() const
virtual bool requiresCalibration() const
void batteryStateChanged()
virtual int touchpadCount() const
virtual bool hasGyroscope() const
QString name READ name int axisCount
virtual bool hasRumble() const
JoystickSettings * settings()
virtual bool hasLED() const
void setupCompleteChanged()