summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-11-27 11:14:59 +0100
committerLioncash <mathew1800@gmail.com>2018-11-27 22:37:18 +0100
commit0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7 (patch)
treeaedd1fee7c8d4ac5e14c58ed0291ab836a53fc0c
parentyuzu/configure_input_player: Use a lambda expression instead of std::bind (diff)
downloadyuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.tar
yuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.tar.gz
yuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.tar.bz2
yuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.tar.lz
yuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.tar.xz
yuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.tar.zst
yuzu-0782d3971bcc92f4c4e346f1cdf72ca13d64c2f7.zip
-rw-r--r--src/yuzu/configuration/configure_input.cpp34
-rw-r--r--src/yuzu/configuration/configure_input.h3
-rw-r--r--src/yuzu/configuration/configure_mouse_advanced.cpp4
3 files changed, 20 insertions, 21 deletions
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index e58c62c9a..ec46dc4e3 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -20,6 +20,19 @@
#include "yuzu/configuration/configure_input_player.h"
#include "yuzu/configuration/configure_mouse_advanced.h"
+namespace {
+template <typename Dialog, typename... Args>
+void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {
+ parent.applyConfiguration();
+ Dialog dialog(&parent, std::forward<Args>(args)...);
+
+ const auto res = dialog.exec();
+ if (res == QDialog::Accepted) {
+ dialog.applyConfiguration();
+ }
+}
+} // Anonymous namespace
+
ConfigureInput::ConfigureInput(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()) {
ui->setupUi(this);
@@ -59,31 +72,20 @@ ConfigureInput::ConfigureInput(QWidget* parent)
for (std::size_t i = 0; i < players_configure.size(); ++i) {
connect(players_configure[i], &QPushButton::pressed, this,
- [this, i]() { CallConfigureDialog<ConfigureInputPlayer>(i, false); });
+ [this, i] { CallConfigureDialog<ConfigureInputPlayer>(*this, i, false); });
}
connect(ui->handheld_configure, &QPushButton::pressed, this,
- [this]() { CallConfigureDialog<ConfigureInputPlayer>(8, false); });
+ [this] { CallConfigureDialog<ConfigureInputPlayer>(*this, 8, false); });
connect(ui->debug_configure, &QPushButton::pressed, this,
- [this]() { CallConfigureDialog<ConfigureInputPlayer>(9, true); });
+ [this] { CallConfigureDialog<ConfigureInputPlayer>(*this, 9, true); });
connect(ui->mouse_advanced, &QPushButton::pressed, this,
- [this]() { CallConfigureDialog<ConfigureMouseAdvanced>(); });
+ [this] { CallConfigureDialog<ConfigureMouseAdvanced>(*this); });
connect(ui->touchscreen_advanced, &QPushButton::pressed, this,
- [this]() { CallConfigureDialog<ConfigureTouchscreenAdvanced>(); });
-}
-
-template <typename Dialog, typename... Args>
-void ConfigureInput::CallConfigureDialog(Args&&... args) {
- this->applyConfiguration();
- Dialog dialog(this, std::forward<Args>(args)...);
-
- const auto res = dialog.exec();
- if (res == QDialog::Accepted) {
- dialog.applyConfiguration();
- }
+ [this] { CallConfigureDialog<ConfigureTouchscreenAdvanced>(*this); });
}
void ConfigureInput::OnDockedModeChanged(bool last_state, bool new_state) {
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h
index 0de442bf0..e8723dfcb 100644
--- a/src/yuzu/configuration/configure_input.h
+++ b/src/yuzu/configuration/configure_input.h
@@ -32,9 +32,6 @@ public:
private:
void updateUIEnabled();
- template <typename Dialog, typename... Args>
- void CallConfigureDialog(Args&&... args);
-
void OnDockedModeChanged(bool last_state, bool new_state);
/// Load configuration settings.
diff --git a/src/yuzu/configuration/configure_mouse_advanced.cpp b/src/yuzu/configuration/configure_mouse_advanced.cpp
index dab58fbaa..ef857035e 100644
--- a/src/yuzu/configuration/configure_mouse_advanced.cpp
+++ b/src/yuzu/configuration/configure_mouse_advanced.cpp
@@ -4,11 +4,11 @@
#include <algorithm>
#include <memory>
-#include <utility>
+
#include <QKeyEvent>
#include <QMenu>
-#include <QMessageBox>
#include <QTimer>
+
#include "common/assert.h"
#include "common/param_package.h"
#include "input_common/main.h"