From e7a602fe1690f6cafc4a40987340bc852effd2d3 Mon Sep 17 00:00:00 2001 From: wwylele Date: Sun, 22 Jan 2017 21:02:29 +0200 Subject: Qt: rework input configuration for new input system --- src/citra_qt/configure_input.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/citra_qt/configure_input.h') diff --git a/src/citra_qt/configure_input.h b/src/citra_qt/configure_input.h index bc343db83..c950fbcb4 100644 --- a/src/citra_qt/configure_input.h +++ b/src/citra_qt/configure_input.h @@ -4,10 +4,14 @@ #pragma once +#include +#include #include +#include #include #include #include +#include "common/param_package.h" #include "core/settings.h" #include "ui_configure_input.h" @@ -31,15 +35,25 @@ public: private: std::unique_ptr ui; - /// This input is currently awaiting configuration. - /// (i.e.: its corresponding QPushButton has been pressed.) - boost::optional current_input_id; std::unique_ptr timer; - /// Each input is represented by a QPushButton. - std::map button_map; - /// Each input is configured to respond to the press of a Qt::Key. - std::map key_map; + /// This will be the the setting function when an input is awaiting configuration. + boost::optional> key_setter; + + std::array buttons_param; + std::array analogs_param; + + static constexpr int ANALOG_SUB_BUTTONS_NUM = 5; + + /// Each button input is represented by a QPushButton. + std::array button_map; + + /// Each analog input is represented by five QPushButtons which represents up, down, left, right + /// and modifier + std::array, Settings::NativeAnalog::NumAnalogs> + analog_map; + + static const std::array analog_sub_buttons; /// Load configuration settings. void loadConfiguration(); @@ -48,10 +62,8 @@ private: /// Update UI to reflect current configuration. void updateButtonLabels(); - /// Called when the button corresponding to input_id was pressed. - void handleClick(Settings::NativeInput::Values input_id); + /// Called when the button was pressed. + void handleClick(QPushButton* button, std::function new_key_setter); /// Handle key press events. void keyPressEvent(QKeyEvent* event) override; - /// Configure input input_id to respond to key key_pressed. - void setInput(Settings::NativeInput::Values input_id, Qt::Key key_pressed); }; -- cgit v1.2.3