2017-05-20 15:53:17 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class ControlGroupBox;
|
|
|
|
class InputConfig;
|
|
|
|
class MappingButton;
|
|
|
|
class MappingNumeric;
|
|
|
|
class MappingWindow;
|
2021-07-04 10:56:07 +00:00
|
|
|
class QFormLayout;
|
2020-01-18 17:19:32 +00:00
|
|
|
class QPushButton;
|
2017-05-20 15:53:17 +00:00
|
|
|
class QGroupBox;
|
|
|
|
|
|
|
|
namespace ControllerEmu
|
|
|
|
{
|
|
|
|
class Control;
|
|
|
|
class ControlGroup;
|
2017-06-13 15:16:41 +00:00
|
|
|
class EmulatedController;
|
2020-01-18 17:19:32 +00:00
|
|
|
class NumericSettingBase;
|
2022-05-20 03:47:30 +00:00
|
|
|
enum class SettingVisibility;
|
2018-05-02 14:55:42 +00:00
|
|
|
} // namespace ControllerEmu
|
2017-05-20 15:53:17 +00:00
|
|
|
|
2019-03-15 01:27:49 +00:00
|
|
|
constexpr int INDICATOR_UPDATE_FREQ = 30;
|
|
|
|
|
2017-05-20 15:53:17 +00:00
|
|
|
class MappingWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit MappingWidget(MappingWindow* window);
|
|
|
|
|
2017-06-13 15:16:41 +00:00
|
|
|
ControllerEmu::EmulatedController* GetController() const;
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
MappingWindow* GetParent() const;
|
|
|
|
|
|
|
|
virtual void LoadSettings() = 0;
|
|
|
|
virtual void SaveSettings() = 0;
|
|
|
|
virtual InputConfig* GetConfig() = 0;
|
|
|
|
|
2019-03-15 01:27:49 +00:00
|
|
|
signals:
|
2017-05-20 15:53:17 +00:00
|
|
|
void Update();
|
2019-03-15 01:27:49 +00:00
|
|
|
void ConfigChanged();
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int GetPort() const;
|
2019-04-20 17:53:13 +00:00
|
|
|
|
|
|
|
QGroupBox* CreateGroupBox(ControllerEmu::ControlGroup* group);
|
2017-05-20 15:53:17 +00:00
|
|
|
QGroupBox* CreateGroupBox(const QString& name, ControllerEmu::ControlGroup* group);
|
2021-07-04 10:56:07 +00:00
|
|
|
QGroupBox* CreateControlsBox(const QString& name, ControllerEmu::ControlGroup* group,
|
|
|
|
int columns);
|
|
|
|
void CreateControl(const ControllerEmu::Control* control, QFormLayout* layout, bool indicator);
|
2020-01-18 17:19:32 +00:00
|
|
|
QPushButton* CreateSettingAdvancedMappingButton(ControllerEmu::NumericSettingBase& setting);
|
2022-05-20 03:47:30 +00:00
|
|
|
void AddSettingWidgets(QFormLayout* layout, ControllerEmu::ControlGroup* group,
|
|
|
|
ControllerEmu::SettingVisibility visibility);
|
|
|
|
void ShowAdvancedControlGroupDialog(ControllerEmu::ControlGroup* group);
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
MappingWindow* m_parent;
|
|
|
|
};
|