citra-qt: Add base support for hotkey reconfiguration + UI (whole of PR citra-emu/citra#3786)

* Adds a new Hotkeys tab in the Controls group.
* Right click to reconfigure.
* See the original PR for more details & screenshots.
This commit is contained in:
Adityarup Laha 2018-05-22 21:30:36 +02:00
parent 95a57a2fe3
commit 5fa25fcf13
No known key found for this signature in database
GPG key ID: 1B24048A1F78845F
22 changed files with 559 additions and 306 deletions

View file

@ -11,6 +11,7 @@
#include <string>
#include <unordered_map>
#include <QKeyEvent>
#include <QKeySequence>
#include <QWidget>
#include "common/param_package.h"
#include "core/settings.h"
@ -38,6 +39,13 @@ public:
/// Load configuration settings.
void loadConfiguration();
void EmitInputKeysChanged();
public slots:
void OnHotkeysChanged(QList<QKeySequence> new_key_list);
signals:
void InputKeysChanged(QList<QKeySequence> new_key_list);
// Save the current input profile index
void ApplyProfile();
@ -72,10 +80,16 @@ private:
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> device_pollers;
/// Keys currently registered as hotkeys
QList<QKeySequence> hotkey_list;
/// A flag to indicate if keyboard keys are okay when configuring an input. If this is false,
/// keyboard events are ignored.
bool want_keyboard_keys = false;
/// Generates list of all used keys
QList<QKeySequence> GetUsedKeyboardKeys();
/// Restore all buttons to their default values.
void restoreDefaults();
/// Clear all input configuration
@ -89,6 +103,9 @@ private:
std::function<void(const Common::ParamPackage&)> new_input_setter,
InputCommon::Polling::DeviceType type);
/// The key code of the previous state of the key being currently bound.
int previous_key_code;
/// Finish polling and configure input using the input_setter
void setPollingResult(const Common::ParamPackage& params, bool abort);