Browse Source
applets/controller: Change the input button to create input profiles
applets/controller: Change the input button to create input profiles
Co-authored-by: Its-Rei <kupfel@gmail.com>pull/15/merge
10 changed files with 117 additions and 100 deletions
-
6src/yuzu/CMakeLists.txt
-
20src/yuzu/applets/controller.cpp
-
8src/yuzu/applets/controller.h
-
4src/yuzu/applets/controller.ui
-
37src/yuzu/configuration/configure_input_dialog.cpp
-
38src/yuzu/configuration/configure_input_dialog.h
-
5src/yuzu/configuration/configure_input_player.cpp
-
36src/yuzu/configuration/configure_input_profile_dialog.cpp
-
39src/yuzu/configuration/configure_input_profile_dialog.h
-
24src/yuzu/configuration/configure_input_profile_dialog.ui
@ -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; |
|||
}; |
|||
@ -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); |
|||
} |
|||
@ -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; |
|||
}; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue