Qt MappingWindow: move controller type into constructor
This commit is contained in:
parent
bb38b39952
commit
27e1577da9
|
@ -78,12 +78,6 @@ ControllersWindow::ControllersWindow(QWidget* parent) : QDialog(parent)
|
||||||
CreateMainLayout();
|
CreateMainLayout();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
|
||||||
for (size_t i = 0; i < m_gc_mappings.size(); i++)
|
|
||||||
m_gc_mappings[i] = new MappingWindow(this, static_cast<int>(i));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < m_wiimote_mappings.size(); i++)
|
|
||||||
m_wiimote_mappings[i] = new MappingWindow(this, static_cast<int>(i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllersWindow::CreateGamecubeLayout()
|
void ControllersWindow::CreateGamecubeLayout()
|
||||||
|
@ -440,8 +434,8 @@ void ControllersWindow::OnGCPadConfigure()
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_gc_mappings[index]->ChangeMappingType(type);
|
|
||||||
m_gc_mappings[index]->exec();
|
MappingWindow(this, type, static_cast<int>(index)).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllersWindow::OnWiimoteConfigure()
|
void ControllersWindow::OnWiimoteConfigure()
|
||||||
|
@ -468,8 +462,8 @@ void ControllersWindow::OnWiimoteConfigure()
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_wiimote_mappings[index]->ChangeMappingType(type);
|
|
||||||
m_wiimote_mappings[index]->exec();
|
MappingWindow(this, type, static_cast<int>(index)).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllersWindow::UnimplementedButton()
|
void ControllersWindow::UnimplementedButton()
|
||||||
|
|
|
@ -51,7 +51,6 @@ private:
|
||||||
QDialogButtonBox* m_button_box;
|
QDialogButtonBox* m_button_box;
|
||||||
|
|
||||||
// Gamecube
|
// Gamecube
|
||||||
std::array<MappingWindow*, 4> m_gc_mappings;
|
|
||||||
QGroupBox* m_gc_box;
|
QGroupBox* m_gc_box;
|
||||||
QGridLayout* m_gc_layout;
|
QGridLayout* m_gc_layout;
|
||||||
std::array<QComboBox*, 4> m_gc_controller_boxes;
|
std::array<QComboBox*, 4> m_gc_controller_boxes;
|
||||||
|
@ -59,7 +58,6 @@ private:
|
||||||
std::array<QHBoxLayout*, 4> m_gc_groups;
|
std::array<QHBoxLayout*, 4> m_gc_groups;
|
||||||
|
|
||||||
// Wii Remote
|
// Wii Remote
|
||||||
std::array<MappingWindow*, 4> m_wiimote_mappings;
|
|
||||||
QGroupBox* m_wiimote_box;
|
QGroupBox* m_wiimote_box;
|
||||||
QGridLayout* m_wiimote_layout;
|
QGridLayout* m_wiimote_layout;
|
||||||
std::array<QLabel*, 4> m_wiimote_labels;
|
std::array<QLabel*, 4> m_wiimote_labels;
|
||||||
|
|
|
@ -32,12 +32,12 @@
|
||||||
#include "DolphinQt2/Config/Mapping/WiimoteEmuMotionControl.h"
|
#include "DolphinQt2/Config/Mapping/WiimoteEmuMotionControl.h"
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||||
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
#include "InputCommon/ControllerInterface/Device.h"
|
#include "InputCommon/ControllerInterface/Device.h"
|
||||||
#include "InputCommon/InputConfig.h"
|
#include "InputCommon/InputConfig.h"
|
||||||
|
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
||||||
|
: QDialog(parent), m_port(port_num)
|
||||||
MappingWindow::MappingWindow(QWidget* parent, int port_num) : QDialog(parent), m_port(port_num)
|
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Port %1").arg(port_num + 1));
|
setWindowTitle(tr("Port %1").arg(port_num + 1));
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
@ -47,6 +47,7 @@ MappingWindow::MappingWindow(QWidget* parent, int port_num) : QDialog(parent), m
|
||||||
CreateResetLayout();
|
CreateResetLayout();
|
||||||
CreateMainLayout();
|
CreateMainLayout();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
SetMappingType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingWindow::CreateDevicesLayout()
|
void MappingWindow::CreateDevicesLayout()
|
||||||
|
@ -237,13 +238,8 @@ void MappingWindow::RefreshDevices()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingWindow::ChangeMappingType(MappingWindow::Type type)
|
void MappingWindow::SetMappingType(MappingWindow::Type type)
|
||||||
{
|
{
|
||||||
if (m_mapping_type == type)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ClearWidgets();
|
|
||||||
|
|
||||||
m_controller = nullptr;
|
m_controller = nullptr;
|
||||||
|
|
||||||
MappingWidget* widget;
|
MappingWidget* widget;
|
||||||
|
@ -297,8 +293,6 @@ void MappingWindow::ChangeMappingType(MappingWindow::Type type)
|
||||||
|
|
||||||
widget->LoadSettings();
|
widget->LoadSettings();
|
||||||
|
|
||||||
m_profiles_combo->clear();
|
|
||||||
|
|
||||||
m_config = widget->GetConfig();
|
m_config = widget->GetConfig();
|
||||||
|
|
||||||
if (m_config)
|
if (m_config)
|
||||||
|
@ -320,13 +314,6 @@ void MappingWindow::ChangeMappingType(MappingWindow::Type type)
|
||||||
|
|
||||||
if (m_controller != nullptr)
|
if (m_controller != nullptr)
|
||||||
RefreshDevices();
|
RefreshDevices();
|
||||||
|
|
||||||
m_mapping_type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MappingWindow::ClearWidgets()
|
|
||||||
{
|
|
||||||
m_tab_widget->clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingWindow::AddWidget(const QString& name, QWidget* widget)
|
void MappingWindow::AddWidget(const QString& name, QWidget* widget)
|
||||||
|
|
|
@ -46,8 +46,7 @@ public:
|
||||||
MAPPING_HOTKEYS
|
MAPPING_HOTKEYS
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit MappingWindow(QWidget* parent, int port_num);
|
explicit MappingWindow(QWidget* parent, Type type, int port_num);
|
||||||
void ChangeMappingType(Type type);
|
|
||||||
|
|
||||||
int GetPort() const;
|
int GetPort() const;
|
||||||
const ciface::Core::DeviceQualifier& GetDeviceQualifier() const;
|
const ciface::Core::DeviceQualifier& GetDeviceQualifier() const;
|
||||||
|
@ -59,6 +58,7 @@ signals:
|
||||||
void ClearFields();
|
void ClearFields();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetMappingType(Type type);
|
||||||
void CreateDevicesLayout();
|
void CreateDevicesLayout();
|
||||||
void CreateProfilesLayout();
|
void CreateProfilesLayout();
|
||||||
void CreateResetLayout();
|
void CreateResetLayout();
|
||||||
|
@ -67,7 +67,6 @@ private:
|
||||||
|
|
||||||
void SetLayoutComplex(bool is_complex);
|
void SetLayoutComplex(bool is_complex);
|
||||||
void AddWidget(const QString& name, QWidget* widget);
|
void AddWidget(const QString& name, QWidget* widget);
|
||||||
void ClearWidgets();
|
|
||||||
|
|
||||||
void RefreshDevices();
|
void RefreshDevices();
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,8 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
|
InitControllers();
|
||||||
|
|
||||||
CreateComponents();
|
CreateComponents();
|
||||||
|
|
||||||
ConnectGameList();
|
ConnectGameList();
|
||||||
|
@ -81,7 +83,6 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
|
||||||
ConnectStack();
|
ConnectStack();
|
||||||
ConnectMenuBar();
|
ConnectMenuBar();
|
||||||
|
|
||||||
InitControllers();
|
|
||||||
InitCoreCallbacks();
|
InitCoreCallbacks();
|
||||||
|
|
||||||
NetPlayInit();
|
NetPlayInit();
|
||||||
|
@ -154,7 +155,7 @@ void MainWindow::CreateComponents()
|
||||||
m_stack = new QStackedWidget(this);
|
m_stack = new QStackedWidget(this);
|
||||||
m_controllers_window = new ControllersWindow(this);
|
m_controllers_window = new ControllersWindow(this);
|
||||||
m_settings_window = new SettingsWindow(this);
|
m_settings_window = new SettingsWindow(this);
|
||||||
m_hotkey_window = new MappingWindow(this, 0);
|
m_hotkey_window = new MappingWindow(this, MappingWindow::Type::MAPPING_HOTKEYS, 0);
|
||||||
m_log_widget = new LogWidget(this);
|
m_log_widget = new LogWidget(this);
|
||||||
m_log_config_widget = new LogConfigWidget(this);
|
m_log_config_widget = new LogConfigWidget(this);
|
||||||
|
|
||||||
|
@ -570,7 +571,6 @@ void MainWindow::ShowAboutDialog()
|
||||||
|
|
||||||
void MainWindow::ShowHotkeyDialog()
|
void MainWindow::ShowHotkeyDialog()
|
||||||
{
|
{
|
||||||
m_hotkey_window->ChangeMappingType(MappingWindow::Type::MAPPING_HOTKEYS);
|
|
||||||
m_hotkey_window->show();
|
m_hotkey_window->show();
|
||||||
m_hotkey_window->raise();
|
m_hotkey_window->raise();
|
||||||
m_hotkey_window->activateWindow();
|
m_hotkey_window->activateWindow();
|
||||||
|
|
Loading…
Reference in New Issue