Unverified Commit 1c328b9c authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8610 from booo/remove-trailing-white-spaces-joystickmanager

remove trailing whitespaces in JoystickManager.cc
parents 90941100 7079db9e
......@@ -106,14 +106,14 @@ void JoystickManager::_setActiveJoystickFromSettings(void)
}
QSettings settings;
settings.beginGroup(_settingsGroup);
QString name = settings.value(_settingsKeyActiveJoystick).toString();
if (name.isEmpty()) {
name = _name2JoystickMap.first()->name();
}
setActiveJoystick(_name2JoystickMap.value(name, _name2JoystickMap.first()));
settings.setValue(_settingsKeyActiveJoystick, _activeJoystick->name());
}
......@@ -139,9 +139,9 @@ void JoystickManager::setActiveJoystick(Joystick* joystick)
if (_activeJoystick) {
_activeJoystick->stopPolling();
}
_activeJoystick = joystick;
if (_activeJoystick != nullptr) {
qCDebug(JoystickManagerLog) << "Set active:" << _activeJoystick->name();
......@@ -156,11 +156,11 @@ void JoystickManager::setActiveJoystick(Joystick* joystick)
QVariantList JoystickManager::joysticks(void)
{
QVariantList list;
for (const QString &name: _name2JoystickMap.keys()) {
list += QVariant::fromValue(_name2JoystickMap[name]);
}
return list;
}
......@@ -180,7 +180,7 @@ void JoystickManager::setActiveJoystickName(const QString& name)
qCWarning(JoystickManagerLog) << "Set active not in map" << name;
return;
}
setActiveJoystick(_name2JoystickMap[name]);
}
......
......@@ -25,27 +25,27 @@ Q_DECLARE_LOGGING_CATEGORY(JoystickManagerLog)
class JoystickManager : public QGCTool
{
Q_OBJECT
public:
JoystickManager(QGCApplication* app, QGCToolbox* toolbox);
~JoystickManager();
Q_PROPERTY(QVariantList joysticks READ joysticks NOTIFY availableJoysticksChanged)
Q_PROPERTY(QStringList joystickNames READ joystickNames NOTIFY availableJoysticksChanged)
Q_PROPERTY(Joystick* activeJoystick READ activeJoystick WRITE setActiveJoystick NOTIFY activeJoystickChanged)
Q_PROPERTY(QString activeJoystickName READ activeJoystickName WRITE setActiveJoystickName NOTIFY activeJoystickNameChanged)
/// List of available joysticks
QVariantList joysticks();
/// List of available joystick names
QStringList joystickNames(void);
/// Get active joystick
Joystick* activeJoystick(void);
/// Set active joystick
void setActiveJoystick(Joystick* joystick);
QString activeJoystickName(void);
void setActiveJoystickName(const QString& name);
......@@ -65,15 +65,15 @@ signals:
private slots:
void _updateAvailableJoysticks(void);
private:
void _setActiveJoystickFromSettings(void);
private:
Joystick* _activeJoystick;
QMap<QString, Joystick*> _name2JoystickMap;
MultiVehicleManager* _multiVehicleManager;
static const char * _settingsGroup;
static const char * _settingsKeyActiveJoystick;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment