dolphin/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h

115 lines
2.3 KiB
C
Raw Normal View History

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;
2018-04-01 14:25:34 +00:00
class QCheckBox;
2017-05-20 15:53:17 +00:00
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,
MAPPING_GC_MICROPHONE,
2017-05-20 15:53:17 +00:00
// Wii
MAPPING_WIIMOTE_EMU,
// Hotkeys
MAPPING_HOTKEYS
2017-05-20 15:53:17 +00:00
};
explicit MappingWindow(QWidget* parent, Type type, int port_num);
2017-05-20 15:53:17 +00:00
int GetPort() const;
std::shared_ptr<ciface::Core::Device> GetDevice() const;
ControllerEmu::EmulatedController* GetController() const;
2018-04-01 14:25:34 +00:00
bool IsIterativeInput() const;
bool IsMappingAllDevices() const;
2018-04-01 14:25:34 +00:00
2017-05-20 15:53:17 +00:00
signals:
void Update();
void ClearFields();
void Save();
2017-05-20 15:53:17 +00:00
private:
void SetMappingType(Type type);
2017-05-20 15:53:17 +00:00
void CreateDevicesLayout();
void CreateProfilesLayout();
void CreateResetLayout();
void CreateMainLayout();
void ConnectWidgets();
void AddWidget(const QString& name, QWidget* widget);
void RefreshDevices();
void OnDeleteProfilePressed();
void OnLoadProfilePressed();
void OnSaveProfilePressed();
void OnDefaultFieldsPressed();
void OnDeviceChanged(int index);
void OnGlobalDevicesChanged();
2017-05-20 15:53:17 +00:00
ControllerEmu::EmulatedController* m_controller = nullptr;
// Main
2018-04-01 14:25:34 +00:00
QCheckBox* m_iterative_input;
2017-05-20 15:53:17 +00:00
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;
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;
QHBoxLayout* m_reset_layout;
2017-05-20 15:53:17 +00:00
QPushButton* m_reset_default;
QPushButton* m_reset_clear;
QTabWidget* m_tab_widget;
Type m_mapping_type;
const int m_port;
InputConfig* m_config;
};