From 8833e2a7fa35b5754eae1b18eab93d0515a4ae16 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 26 Oct 2019 17:50:54 +0200 Subject: [PATCH 1/2] DolphinQt: Call OnEmulationStateChanged when creating config window panes Otherwise UI elements won't be disabled correctly if the config window is first opened while a game is running. --- Source/Core/DolphinQt/Settings/AudioPane.cpp | 2 ++ Source/Core/DolphinQt/Settings/GeneralPane.cpp | 2 ++ Source/Core/DolphinQt/Settings/WiiPane.cpp | 1 + 3 files changed, 5 insertions(+) diff --git a/Source/Core/DolphinQt/Settings/AudioPane.cpp b/Source/Core/DolphinQt/Settings/AudioPane.cpp index 4d780a3e1b..8c3df4ec76 100644 --- a/Source/Core/DolphinQt/Settings/AudioPane.cpp +++ b/Source/Core/DolphinQt/Settings/AudioPane.cpp @@ -37,6 +37,8 @@ AudioPane::AudioPane() connect(&Settings::Instance(), &Settings::VolumeChanged, this, &AudioPane::OnVolumeChanged); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); }); + + OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized); } void AudioPane::CreateWidgets() diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp index c1140cf98f..1d8cc485a7 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp +++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp @@ -50,6 +50,8 @@ GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent) connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, &GeneralPane::OnEmulationStateChanged); + + OnEmulationStateChanged(Core::GetState()); } void GeneralPane::CreateLayout() diff --git a/Source/Core/DolphinQt/Settings/WiiPane.cpp b/Source/Core/DolphinQt/Settings/WiiPane.cpp index 87c44f793c..671808edc1 100644 --- a/Source/Core/DolphinQt/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt/Settings/WiiPane.cpp @@ -48,6 +48,7 @@ WiiPane::WiiPane(QWidget* parent) : QWidget(parent) LoadConfig(); ConnectLayout(); ValidateSelectionState(); + OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized); } void WiiPane::CreateLayout() From 10d972789abb76077a48070ece3f9a20bb243f9c Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 26 Oct 2019 17:51:43 +0200 Subject: [PATCH 2/2] DolphinQt: Make WiiPane connect itself to EmulationStateChanged --- Source/Core/DolphinQt/Config/SettingsWindow.cpp | 9 +-------- Source/Core/DolphinQt/Settings/WiiPane.cpp | 4 ++++ Source/Core/DolphinQt/Settings/WiiPane.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Source/Core/DolphinQt/Config/SettingsWindow.cpp b/Source/Core/DolphinQt/Config/SettingsWindow.cpp index 6318d216b8..912182d08c 100644 --- a/Source/Core/DolphinQt/Config/SettingsWindow.cpp +++ b/Source/Core/DolphinQt/Config/SettingsWindow.cpp @@ -39,14 +39,7 @@ SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent) m_tab_widget->addTab(GetWrappedWidget(new AudioPane, this, 125, 100), tr("Audio")); m_tab_widget->addTab(GetWrappedWidget(new PathPane, this, 125, 100), tr("Paths")); m_tab_widget->addTab(GetWrappedWidget(new GameCubePane, this, 125, 100), tr("GameCube")); - - auto* wii_pane = new WiiPane; - m_tab_widget->addTab(GetWrappedWidget(wii_pane, this, 125, 100), tr("Wii")); - - connect(&Settings::Instance(), &Settings::EmulationStateChanged, [wii_pane](Core::State state) { - wii_pane->OnEmulationStateChanged(state != Core::State::Uninitialized); - }); - + m_tab_widget->addTab(GetWrappedWidget(new WiiPane, this, 125, 100), tr("Wii")); m_tab_widget->addTab(GetWrappedWidget(new AdvancedPane, this, 125, 200), tr("Advanced")); // Dialog box buttons diff --git a/Source/Core/DolphinQt/Settings/WiiPane.cpp b/Source/Core/DolphinQt/Settings/WiiPane.cpp index 671808edc1..ba6df4d1c7 100644 --- a/Source/Core/DolphinQt/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt/Settings/WiiPane.cpp @@ -93,6 +93,10 @@ void WiiPane::ConnectLayout() connect(m_wiimote_ir_sensitivity, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig); connect(m_wiimote_speaker_volume, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig); connect(m_wiimote_motor, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig); + + // Emulation State + connect(&Settings::Instance(), &Settings::EmulationStateChanged, + [=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); }); } void WiiPane::CreateMisc() diff --git a/Source/Core/DolphinQt/Settings/WiiPane.h b/Source/Core/DolphinQt/Settings/WiiPane.h index 33907c87af..375ac99b81 100644 --- a/Source/Core/DolphinQt/Settings/WiiPane.h +++ b/Source/Core/DolphinQt/Settings/WiiPane.h @@ -19,7 +19,6 @@ class WiiPane : public QWidget Q_OBJECT public: explicit WiiPane(QWidget* parent = nullptr); - void OnEmulationStateChanged(bool running); private: void PopulateUSBPassthroughListWidget(); @@ -31,6 +30,7 @@ private: void LoadConfig(); void OnSaveConfig(); + void OnEmulationStateChanged(bool running); void ValidateSelectionState();