summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgerman <german@thesoftwareartisans.com>2021-02-04 15:54:27 +0100
committergerman <german@thesoftwareartisans.com>2021-02-06 16:43:42 +0100
commit160341fcf8e22715e6156cbc73663bb5f8666e46 (patch)
treecc8b15e85bc637ad189feb123104359c393a07fe /src
parentRefresh controller only when necessary (diff)
downloadyuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.tar
yuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.tar.gz
yuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.tar.bz2
yuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.tar.lz
yuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.tar.xz
yuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.tar.zst
yuzu-160341fcf8e22715e6156cbc73663bb5f8666e46.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/debugger/controller.cpp16
-rw-r--r--src/yuzu/debugger/controller.h3
-rw-r--r--src/yuzu/main.cpp7
-rw-r--r--src/yuzu/main.h2
4 files changed, 18 insertions, 10 deletions
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp
index 23834f063..85724a8f3 100644
--- a/src/yuzu/debugger/controller.cpp
+++ b/src/yuzu/debugger/controller.cpp
@@ -18,12 +18,8 @@ ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog
setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) |
Qt::WindowMaximizeButtonHint);
- PlayerControlPreview* widget = new PlayerControlPreview(this);
- const auto& players = Settings::values.players.GetValue();
- constexpr std::size_t player = 0;
- widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
- widget->SetConnectedStatus(players[player].connected);
- widget->SetControllerType(players[player].controller_type);
+ widget = new PlayerControlPreview(this);
+ refreshConfiguration();
QLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(widget);
@@ -36,6 +32,14 @@ ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog
widget->setFocus();
}
+void ControllerDialog::refreshConfiguration() {
+ const auto& players = Settings::values.players.GetValue();
+ constexpr std::size_t player = 0;
+ widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
+ widget->SetConnectedStatus(players[player].connected);
+ widget->SetControllerType(players[player].controller_type);
+}
+
QAction* ControllerDialog::toggleViewAction() {
if (toggle_view_action == nullptr) {
toggle_view_action = new QAction(windowTitle(), this);
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h
index da389b6a2..c54750070 100644
--- a/src/yuzu/debugger/controller.h
+++ b/src/yuzu/debugger/controller.h
@@ -9,6 +9,7 @@
class QAction;
class QHideEvent;
class QShowEvent;
+class PlayerControlPreview;
class ControllerDialog : public QWidget {
Q_OBJECT
@@ -18,6 +19,7 @@ public:
/// Returns a QAction that can be used to toggle visibility of this dialog.
QAction* toggleViewAction();
+ void refreshConfiguration();
protected:
void showEvent(QShowEvent* ev) override;
@@ -25,4 +27,5 @@ protected:
private:
QAction* toggle_view_action = nullptr;
+ PlayerControlPreview* widget;
};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index f6f902fab..ef92c25bc 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -690,9 +690,9 @@ void GMainWindow::InitializeDebugWidgets() {
waitTreeWidget->hide();
debug_menu->addAction(waitTreeWidget->toggleViewAction());
- controllerDialog = new ControllerDialog(this);
- controllerDialog->hide();
- debug_menu->addAction(controllerDialog->toggleViewAction());
+ controller_dialog = new ControllerDialog(this);
+ controller_dialog->hide();
+ debug_menu->addAction(controller_dialog->toggleViewAction());
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
&WaitTreeWidget::OnEmulationStarting);
@@ -2342,6 +2342,7 @@ void GMainWindow::OnConfigure() {
}
configure_dialog.ApplyConfiguration();
+ controller_dialog->refreshConfiguration();
InitializeHotkeys();
if (UISettings::values.theme != old_theme) {
UpdateUITheme();
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index f4a71ea11..04d37d4ae 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -314,7 +314,7 @@ private:
ProfilerWidget* profilerWidget;
MicroProfileDialog* microProfileDialog;
WaitTreeWidget* waitTreeWidget;
- ControllerDialog* controllerDialog;
+ ControllerDialog* controller_dialog;
QAction* actions_recent_files[max_recent_files_item];