2017-05-20 15:53:17 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QString>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "InputCommon/ControllerInterface/Device.h"
|
|
|
|
|
|
|
|
namespace ControllerEmu
|
|
|
|
{
|
|
|
|
class EmulatedController;
|
|
|
|
}
|
|
|
|
|
|
|
|
class InputConfig;
|
|
|
|
class QComboBox;
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QEvent;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QGroupBox;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QPushButton;
|
|
|
|
class QTabWidget;
|
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
class MappingWindow final : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum class Type
|
|
|
|
{
|
|
|
|
// GameCube
|
|
|
|
MAPPING_GC_BONGOS,
|
|
|
|
MAPPING_GC_DANCEMAT,
|
|
|
|
MAPPING_GC_KEYBOARD,
|
|
|
|
MAPPING_GCPAD,
|
|
|
|
MAPPING_GC_STEERINGWHEEL,
|
2018-01-04 18:38:09 +00:00
|
|
|
MAPPING_GC_MICROPHONE,
|
2017-05-20 15:53:17 +00:00
|
|
|
// Wii
|
|
|
|
MAPPING_WIIMOTE_EMU,
|
2017-06-06 11:49:49 +00:00
|
|
|
// Hotkeys
|
|
|
|
MAPPING_HOTKEYS
|
2017-05-20 15:53:17 +00:00
|
|
|
};
|
|
|
|
|
2017-11-03 21:31:17 +00:00
|
|
|
explicit MappingWindow(QWidget* parent, Type type, int port_num);
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
int GetPort() const;
|
2017-06-13 15:16:41 +00:00
|
|
|
ControllerEmu::EmulatedController* GetController() const;
|
2018-05-23 21:47:42 +00:00
|
|
|
bool IsMappingAllDevices() const;
|
2019-11-04 03:19:33 +00:00
|
|
|
void ShowExtensionMotionTabs(bool show);
|
2018-04-01 14:25:34 +00:00
|
|
|
|
2017-05-20 15:53:17 +00:00
|
|
|
signals:
|
2019-03-15 01:27:49 +00:00
|
|
|
// Emitted when config has changed so widgets can update to reflect the change.
|
|
|
|
void ConfigChanged();
|
|
|
|
// Emitted at 30hz for real-time indicators to be updated.
|
2017-05-20 15:53:17 +00:00
|
|
|
void Update();
|
2018-05-02 14:55:42 +00:00
|
|
|
void Save();
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
private:
|
2017-11-03 21:31:17 +00:00
|
|
|
void SetMappingType(Type type);
|
2017-05-20 15:53:17 +00:00
|
|
|
void CreateDevicesLayout();
|
|
|
|
void CreateProfilesLayout();
|
|
|
|
void CreateResetLayout();
|
|
|
|
void CreateMainLayout();
|
|
|
|
void ConnectWidgets();
|
|
|
|
|
2019-11-04 03:19:33 +00:00
|
|
|
QWidget* AddWidget(const QString& name, QWidget* widget);
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
void RefreshDevices();
|
|
|
|
|
2020-09-09 02:26:13 +00:00
|
|
|
void OnSelectProfile(int index);
|
|
|
|
void OnProfileTextChanged(const QString& text);
|
2017-05-20 15:53:17 +00:00
|
|
|
void OnDeleteProfilePressed();
|
|
|
|
void OnLoadProfilePressed();
|
|
|
|
void OnSaveProfilePressed();
|
2019-04-28 19:00:35 +00:00
|
|
|
void UpdateProfileIndex();
|
2020-09-09 02:26:13 +00:00
|
|
|
void UpdateProfileButtonState();
|
|
|
|
void PopulateProfileSelection();
|
2019-04-28 19:00:35 +00:00
|
|
|
|
2017-05-20 15:53:17 +00:00
|
|
|
void OnDefaultFieldsPressed();
|
2019-02-06 23:40:58 +00:00
|
|
|
void OnClearFieldsPressed();
|
2019-03-15 01:27:49 +00:00
|
|
|
void OnSelectDevice(int index);
|
2018-07-05 21:17:47 +00:00
|
|
|
void OnGlobalDevicesChanged();
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
ControllerEmu::EmulatedController* m_controller = nullptr;
|
|
|
|
|
|
|
|
// Main
|
|
|
|
QVBoxLayout* m_main_layout;
|
|
|
|
QHBoxLayout* m_config_layout;
|
|
|
|
QDialogButtonBox* m_button_box;
|
|
|
|
|
|
|
|
// Devices
|
|
|
|
QGroupBox* m_devices_box;
|
|
|
|
QHBoxLayout* m_devices_layout;
|
|
|
|
QComboBox* m_devices_combo;
|
|
|
|
QPushButton* m_devices_refresh;
|
|
|
|
|
|
|
|
// Profiles
|
|
|
|
QGroupBox* m_profiles_box;
|
2017-06-14 04:24:24 +00:00
|
|
|
QHBoxLayout* m_profiles_layout;
|
2017-05-20 15:53:17 +00:00
|
|
|
QComboBox* m_profiles_combo;
|
|
|
|
QPushButton* m_profiles_load;
|
|
|
|
QPushButton* m_profiles_save;
|
|
|
|
QPushButton* m_profiles_delete;
|
|
|
|
|
|
|
|
// Reset
|
|
|
|
QGroupBox* m_reset_box;
|
2017-06-14 04:24:24 +00:00
|
|
|
QHBoxLayout* m_reset_layout;
|
2017-05-20 15:53:17 +00:00
|
|
|
QPushButton* m_reset_default;
|
|
|
|
QPushButton* m_reset_clear;
|
|
|
|
|
|
|
|
QTabWidget* m_tab_widget;
|
2019-11-04 03:19:33 +00:00
|
|
|
QWidget* m_extension_motion_input_tab;
|
|
|
|
QWidget* m_extension_motion_simulation_tab;
|
|
|
|
const QString EXTENSION_MOTION_INPUT_TAB_NAME = tr("Extension Motion Input");
|
|
|
|
const QString EXTENSION_MOTION_SIMULATION_TAB_NAME = tr("Extension Motion Simulation");
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
Type m_mapping_type;
|
|
|
|
const int m_port;
|
|
|
|
InputConfig* m_config;
|
|
|
|
};
|