applets/controller: Change the input button to create input profiles
Co-authored-by: Its-Rei <kupfel@gmail.com>
This commit is contained in:
parent
30e0d1c973
commit
760a9e8693
@ -68,12 +68,12 @@ add_executable(yuzu
|
|||||||
configuration/configure_input_advanced.cpp
|
configuration/configure_input_advanced.cpp
|
||||||
configuration/configure_input_advanced.h
|
configuration/configure_input_advanced.h
|
||||||
configuration/configure_input_advanced.ui
|
configuration/configure_input_advanced.ui
|
||||||
configuration/configure_input_dialog.cpp
|
|
||||||
configuration/configure_input_dialog.h
|
|
||||||
configuration/configure_input_dialog.ui
|
|
||||||
configuration/configure_input_player.cpp
|
configuration/configure_input_player.cpp
|
||||||
configuration/configure_input_player.h
|
configuration/configure_input_player.h
|
||||||
configuration/configure_input_player.ui
|
configuration/configure_input_player.ui
|
||||||
|
configuration/configure_input_profile_dialog.cpp
|
||||||
|
configuration/configure_input_profile_dialog.h
|
||||||
|
configuration/configure_input_profile_dialog.ui
|
||||||
configuration/configure_motion_touch.cpp
|
configuration/configure_motion_touch.cpp
|
||||||
configuration/configure_motion_touch.h
|
configuration/configure_motion_touch.h
|
||||||
configuration/configure_motion_touch.ui
|
configuration/configure_motion_touch.ui
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "ui_controller.h"
|
#include "ui_controller.h"
|
||||||
#include "yuzu/applets/controller.h"
|
#include "yuzu/applets/controller.h"
|
||||||
#include "yuzu/configuration/configure_input_dialog.h"
|
#include "yuzu/configuration/configure_input.h"
|
||||||
|
#include "yuzu/configuration/configure_input_profile_dialog.h"
|
||||||
#include "yuzu/configuration/configure_vibration.h"
|
#include "yuzu/configuration/configure_vibration.h"
|
||||||
|
#include "yuzu/configuration/input_profiles.h"
|
||||||
#include "yuzu/main.h"
|
#include "yuzu/main.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -109,7 +111,8 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
|
|||||||
QWidget* parent, Core::Frontend::ControllerParameters parameters_,
|
QWidget* parent, Core::Frontend::ControllerParameters parameters_,
|
||||||
InputCommon::InputSubsystem* input_subsystem_)
|
InputCommon::InputSubsystem* input_subsystem_)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()),
|
: QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()),
|
||||||
parameters(std::move(parameters_)), input_subsystem(input_subsystem_) {
|
parameters(std::move(parameters_)), input_subsystem{input_subsystem_},
|
||||||
|
input_profiles(std::make_unique<InputProfiles>()) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
player_widgets = {
|
player_widgets = {
|
||||||
@ -230,7 +233,7 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
|
|||||||
&QtControllerSelectorDialog::CallConfigureVibrationDialog);
|
&QtControllerSelectorDialog::CallConfigureVibrationDialog);
|
||||||
|
|
||||||
connect(ui->inputConfigButton, &QPushButton::clicked, this,
|
connect(ui->inputConfigButton, &QPushButton::clicked, this,
|
||||||
&QtControllerSelectorDialog::CallConfigureInputDialog);
|
&QtControllerSelectorDialog::CallConfigureInputProfileDialog);
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this,
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this,
|
||||||
&QtControllerSelectorDialog::ApplyConfiguration);
|
&QtControllerSelectorDialog::ApplyConfiguration);
|
||||||
@ -299,20 +302,13 @@ void QtControllerSelectorDialog::CallConfigureVibrationDialog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtControllerSelectorDialog::CallConfigureInputDialog() {
|
void QtControllerSelectorDialog::CallConfigureInputProfileDialog() {
|
||||||
const auto max_supported_players = parameters.enable_single_mode ? 1 : parameters.max_players;
|
ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get());
|
||||||
|
|
||||||
ConfigureInputDialog dialog(this, max_supported_players, input_subsystem);
|
|
||||||
|
|
||||||
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
||||||
Qt::WindowSystemMenuHint);
|
Qt::WindowSystemMenuHint);
|
||||||
dialog.setWindowModality(Qt::WindowModal);
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
|
|
||||||
dialog.ApplyConfiguration();
|
|
||||||
|
|
||||||
LoadConfiguration();
|
|
||||||
CheckIfParametersMet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtControllerSelectorDialog::CheckIfParametersMet() {
|
bool QtControllerSelectorDialog::CheckIfParametersMet() {
|
||||||
|
@ -16,6 +16,8 @@ class QDialogButtonBox;
|
|||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
|
||||||
|
class InputProfiles;
|
||||||
|
|
||||||
namespace InputCommon {
|
namespace InputCommon {
|
||||||
class InputSubsystem;
|
class InputSubsystem;
|
||||||
}
|
}
|
||||||
@ -45,8 +47,8 @@ private:
|
|||||||
// Initializes the "Configure Vibration" Dialog.
|
// Initializes the "Configure Vibration" Dialog.
|
||||||
void CallConfigureVibrationDialog();
|
void CallConfigureVibrationDialog();
|
||||||
|
|
||||||
// Initializes the "Configure Input" Dialog.
|
// Initializes the "Create Input Profile" Dialog.
|
||||||
void CallConfigureInputDialog();
|
void CallConfigureInputProfileDialog();
|
||||||
|
|
||||||
// Checks the current configuration against the given parameters.
|
// Checks the current configuration against the given parameters.
|
||||||
// This sets and returns the value of parameters_met.
|
// This sets and returns the value of parameters_met.
|
||||||
@ -83,6 +85,8 @@ private:
|
|||||||
|
|
||||||
InputCommon::InputSubsystem* input_subsystem;
|
InputCommon::InputSubsystem* input_subsystem;
|
||||||
|
|
||||||
|
std::unique_ptr<InputProfiles> input_profiles;
|
||||||
|
|
||||||
// This is true if and only if all parameters are met. Otherwise, this is false.
|
// This is true if and only if all parameters are met. Otherwise, this is false.
|
||||||
// This determines whether the "OK" button can be clicked to exit the applet.
|
// This determines whether the "OK" button can be clicked to exit the applet.
|
||||||
bool parameters_met{false};
|
bool parameters_met{false};
|
||||||
|
@ -2402,7 +2402,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="inputConfigGroup">
|
<widget class="QGroupBox" name="inputConfigGroup">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Input Config</string>
|
<string>Profiles</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@ -2429,7 +2429,7 @@
|
|||||||
<string notr="true">min-width: 68px;</string>
|
<string notr="true">min-width: 68px;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open</string>
|
<string>Create</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
// Copyright 2020 yuzu Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include "ui_configure_input_dialog.h"
|
|
||||||
#include "yuzu/configuration/configure_input_dialog.h"
|
|
||||||
|
|
||||||
ConfigureInputDialog::ConfigureInputDialog(QWidget* parent, std::size_t max_players,
|
|
||||||
InputCommon::InputSubsystem* input_subsystem)
|
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::ConfigureInputDialog>()),
|
|
||||||
input_widget(new ConfigureInput(this)) {
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
input_widget->Initialize(input_subsystem, max_players);
|
|
||||||
|
|
||||||
ui->inputLayout->addWidget(input_widget);
|
|
||||||
|
|
||||||
RetranslateUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigureInputDialog::~ConfigureInputDialog() = default;
|
|
||||||
|
|
||||||
void ConfigureInputDialog::ApplyConfiguration() {
|
|
||||||
input_widget->ApplyConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigureInputDialog::changeEvent(QEvent* event) {
|
|
||||||
if (event->type() == QEvent::LanguageChange) {
|
|
||||||
RetranslateUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog::changeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigureInputDialog::RetranslateUI() {
|
|
||||||
ui->retranslateUi(this);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
// Copyright 2020 yuzu Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <QDialog>
|
|
||||||
#include "yuzu/configuration/configure_input.h"
|
|
||||||
|
|
||||||
class QPushButton;
|
|
||||||
|
|
||||||
namespace InputCommon {
|
|
||||||
class InputSubsystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ConfigureInputDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ConfigureInputDialog : public QDialog {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ConfigureInputDialog(QWidget* parent, std::size_t max_players,
|
|
||||||
InputCommon::InputSubsystem* input_subsystem);
|
|
||||||
~ConfigureInputDialog() override;
|
|
||||||
|
|
||||||
void ApplyConfiguration();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void changeEvent(QEvent* event) override;
|
|
||||||
void RetranslateUI();
|
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureInputDialog> ui;
|
|
||||||
|
|
||||||
ConfigureInput* input_widget;
|
|
||||||
};
|
|
@ -459,11 +459,14 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug || player_index == 9) {
|
||||||
|
ui->groupConnectedController->setCheckable(false);
|
||||||
|
}
|
||||||
|
|
||||||
// The Debug Controller can only choose the Pro Controller.
|
// The Debug Controller can only choose the Pro Controller.
|
||||||
if (debug) {
|
if (debug) {
|
||||||
ui->buttonScreenshot->setEnabled(false);
|
ui->buttonScreenshot->setEnabled(false);
|
||||||
ui->buttonHome->setEnabled(false);
|
ui->buttonHome->setEnabled(false);
|
||||||
ui->groupConnectedController->setCheckable(false);
|
|
||||||
QStringList debug_controller_types = {
|
QStringList debug_controller_types = {
|
||||||
tr("Pro Controller"),
|
tr("Pro Controller"),
|
||||||
};
|
};
|
||||||
|
36
src/yuzu/configuration/configure_input_profile_dialog.cpp
Normal file
36
src/yuzu/configuration/configure_input_profile_dialog.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright 2020 yuzu Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "ui_configure_input_profile_dialog.h"
|
||||||
|
#include "yuzu/configuration/configure_input_profile_dialog.h"
|
||||||
|
|
||||||
|
ConfigureInputProfileDialog::ConfigureInputProfileDialog(
|
||||||
|
QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles)
|
||||||
|
: QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()),
|
||||||
|
profile_widget(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, false)) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->controllerLayout->addWidget(profile_widget);
|
||||||
|
|
||||||
|
connect(ui->clear_all_button, &QPushButton::clicked, this,
|
||||||
|
[this] { profile_widget->ClearAll(); });
|
||||||
|
connect(ui->restore_defaults_button, &QPushButton::clicked, this,
|
||||||
|
[this] { profile_widget->RestoreDefaults(); });
|
||||||
|
|
||||||
|
RetranslateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigureInputProfileDialog::~ConfigureInputProfileDialog() = default;
|
||||||
|
|
||||||
|
void ConfigureInputProfileDialog::changeEvent(QEvent* event) {
|
||||||
|
if (event->type() == QEvent::LanguageChange) {
|
||||||
|
RetranslateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureInputProfileDialog::RetranslateUI() {
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
}
|
39
src/yuzu/configuration/configure_input_profile_dialog.h
Normal file
39
src/yuzu/configuration/configure_input_profile_dialog.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright 2020 yuzu Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <QDialog>
|
||||||
|
#include "yuzu/configuration/configure_input_player.h"
|
||||||
|
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
|
class InputProfiles;
|
||||||
|
|
||||||
|
namespace InputCommon {
|
||||||
|
class InputSubsystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ConfigureInputProfileDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConfigureInputProfileDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ConfigureInputProfileDialog(QWidget* parent,
|
||||||
|
InputCommon::InputSubsystem* input_subsystem,
|
||||||
|
InputProfiles* profiles);
|
||||||
|
~ConfigureInputProfileDialog() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void changeEvent(QEvent* event) override;
|
||||||
|
void RetranslateUI();
|
||||||
|
|
||||||
|
std::unique_ptr<Ui::ConfigureInputProfileDialog> ui;
|
||||||
|
|
||||||
|
ConfigureInputPlayer* profile_widget;
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ConfigureInputDialog</class>
|
<class>ConfigureInputProfileDialog</class>
|
||||||
<widget class="QDialog" name="ConfigureInputDialog">
|
<widget class="QDialog" name="ConfigureInputProfileDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Configure Input</string>
|
<string>Create Input Profile</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@ -30,10 +30,24 @@
|
|||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="inputLayout"/>
|
<layout class="QHBoxLayout" name="controllerLayout"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="clear_all_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="restore_defaults_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Defaults</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
@ -50,7 +64,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>ConfigureInputDialog</receiver>
|
<receiver>ConfigureInputProfileDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
Loading…
Reference in New Issue
Block a user