GUI: Add settings for keyboard mapping (#174)

This commit is contained in:
Felipe Lavratti 2020-02-29 11:38:03 -03:00 committed by GitHub
commit a605ba083d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 292 additions and 52 deletions

View file

@ -24,6 +24,19 @@
#include <QSettings>
enum class ControllerButtonExt
{
// must not overlap with ChiakiControllerButton and ChiakiControllerAnalogButton
ANALOG_STICK_LEFT_X_UP = (1 << 18),
ANALOG_STICK_LEFT_X_DOWN = (1 << 19),
ANALOG_STICK_LEFT_Y_UP = (1 << 20),
ANALOG_STICK_LEFT_Y_DOWN = (1 << 21),
ANALOG_STICK_RIGHT_X_UP = (1 << 22),
ANALOG_STICK_RIGHT_X_DOWN = (1 << 23),
ANALOG_STICK_RIGHT_Y_UP = (1 << 24),
ANALOG_STICK_RIGHT_Y_DOWN = (1 << 25),
};
class Settings : public QObject
{
Q_OBJECT
@ -90,6 +103,11 @@ class Settings : public QObject
bool GetManualHostExists(int id) { return manual_hosts.contains(id); }
ManualHost GetManualHost(int id) const { return manual_hosts[id]; }
static QString GetChiakiControllerButtonName(int);
void SetControllerButtonMapping(int, Qt::Key);
QMap<int, Qt::Key> GetControllerMapping();
QMap<Qt::Key, int> GetControllerMappingForDecoding();
signals:
void RegisteredHostsUpdated();
void ManualHostsUpdated();