From a7abd7dba0221c786d5d3031f61ecf8583daca7f Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Thu, 27 Apr 2023 10:39:48 -0700 Subject: [PATCH] Qt: Rename GraphicsRadioInt to ConfigRadioInt GraphicsRadioInt is used by the panes in the Graphics config window to create radio buttons that change their associated config setting, and update their own state when something else changes the config setting. Despite its current name nothing about this class is particular to the Graphics window, so renaming it to ConfigRadioInt better reflects its purpose. This should also make it less confusing when ConfigRadioInts are added to other config panes. --- Source/Core/DolphinQt/CMakeLists.txt | 4 ++-- .../GraphicsRadio.cpp => ConfigControls/ConfigRadio.cpp} | 9 ++++----- .../GraphicsRadio.h => ConfigControls/ConfigRadio.h} | 4 ++-- .../DolphinQt/Config/Graphics/EnhancementsWidget.cpp | 2 +- Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp | 6 +++--- Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h | 4 ++-- Source/Core/DolphinQt/DolphinQt.vcxproj | 4 ++-- 7 files changed, 16 insertions(+), 17 deletions(-) rename Source/Core/DolphinQt/Config/{Graphics/GraphicsRadio.cpp => ConfigControls/ConfigRadio.cpp} (70%) rename Source/Core/DolphinQt/Config/{Graphics/GraphicsRadio.h => ConfigControls/ConfigRadio.h} (68%) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index e652ca5a4e..4fb33930a0 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -39,6 +39,8 @@ add_executable(dolphin-emu Config/ConfigControls/ConfigBool.h Config/ConfigControls/ConfigChoice.cpp Config/ConfigControls/ConfigChoice.h + Config/ConfigControls/ConfigRadio.cpp + Config/ConfigControls/ConfigRadio.h Config/ControllerInterface/ControllerInterfaceWindow.cpp Config/ControllerInterface/ControllerInterfaceWindow.h Config/ControllerInterface/DualShockUDPClientAddServerDialog.cpp @@ -73,8 +75,6 @@ add_executable(dolphin-emu Config/Graphics/GeneralWidget.h Config/Graphics/GraphicsInteger.cpp Config/Graphics/GraphicsInteger.h - Config/Graphics/GraphicsRadio.cpp - Config/Graphics/GraphicsRadio.h Config/Graphics/GraphicsSlider.cpp Config/Graphics/GraphicsSlider.h Config/Graphics/GraphicsWidget.h diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsRadio.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp similarity index 70% rename from Source/Core/DolphinQt/Config/Graphics/GraphicsRadio.cpp rename to Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp index 4a467510e5..98977dfdc9 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GraphicsRadio.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp @@ -1,7 +1,7 @@ // Copyright 2018 Dolphin Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "DolphinQt/Config/Graphics/GraphicsRadio.h" +#include "DolphinQt/Config/ConfigControls/ConfigRadio.h" #include @@ -9,12 +9,11 @@ #include "DolphinQt/Settings.h" -GraphicsRadioInt::GraphicsRadioInt(const QString& label, const Config::Info& setting, - int value) +ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info& setting, int value) : ToolTipRadioButton(label), m_setting(setting), m_value(value) { setChecked(Config::Get(m_setting) == m_value); - connect(this, &QRadioButton::toggled, this, &GraphicsRadioInt::Update); + connect(this, &QRadioButton::toggled, this, &ConfigRadioInt::Update); connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] { QFont bf = font(); @@ -26,7 +25,7 @@ GraphicsRadioInt::GraphicsRadioInt(const QString& label, const Config::Info }); } -void GraphicsRadioInt::Update() +void ConfigRadioInt::Update() { if (!isChecked()) return; diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsRadio.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h similarity index 68% rename from Source/Core/DolphinQt/Config/Graphics/GraphicsRadio.h rename to Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h index 6063982ea2..d3f5c7e258 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GraphicsRadio.h +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h @@ -7,11 +7,11 @@ #include "Common/Config/Config.h" -class GraphicsRadioInt : public ToolTipRadioButton +class ConfigRadioInt : public ToolTipRadioButton { Q_OBJECT public: - GraphicsRadioInt(const QString& label, const Config::Info& setting, int value); + ConfigRadioInt(const QString& label, const Config::Info& setting, int value); private: void Update(); diff --git a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp index fed400a577..48c78c9d9c 100644 --- a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp @@ -16,7 +16,7 @@ #include "DolphinQt/Config/ConfigControls/ConfigBool.h" #include "DolphinQt/Config/ConfigControls/ConfigChoice.h" -#include "DolphinQt/Config/Graphics/GraphicsRadio.h" +#include "DolphinQt/Config/ConfigControls/ConfigRadio.h" #include "DolphinQt/Config/Graphics/GraphicsSlider.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Config/Graphics/PostProcessingConfigWindow.h" diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp index 1911a3e9b9..8733419f60 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp @@ -20,7 +20,7 @@ #include "DolphinQt/Config/ConfigControls/ConfigBool.h" #include "DolphinQt/Config/ConfigControls/ConfigChoice.h" -#include "DolphinQt/Config/Graphics/GraphicsRadio.h" +#include "DolphinQt/Config/ConfigControls/ConfigRadio.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h" @@ -110,8 +110,8 @@ void GeneralWidget::CreateWidgets() }}; for (size_t i = 0; i < modes.size(); i++) { - m_shader_compilation_mode[i] = new GraphicsRadioInt( - tr(modes[i]), Config::GFX_SHADER_COMPILATION_MODE, static_cast(i)); + m_shader_compilation_mode[i] = + new ConfigRadioInt(tr(modes[i]), Config::GFX_SHADER_COMPILATION_MODE, static_cast(i)); shader_compilation_layout->addWidget(m_shader_compilation_mode[i], static_cast(i / 2), static_cast(i % 2)); } diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h index 0cf6e59b66..54b9437229 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.h @@ -8,7 +8,7 @@ class ConfigBool; class ConfigChoice; -class GraphicsRadioInt; +class ConfigRadioInt; class GraphicsWindow; class QCheckBox; class QComboBox; @@ -48,6 +48,6 @@ private: ConfigBool* m_autoadjust_window_size; ConfigBool* m_show_messages; ConfigBool* m_render_main_window; - std::array m_shader_compilation_mode{}; + std::array m_shader_compilation_mode{}; ConfigBool* m_wait_for_shaders; }; diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj index 42ea092069..874e9416d1 100644 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj +++ b/Source/Core/DolphinQt/DolphinQt.vcxproj @@ -56,6 +56,7 @@ + @@ -73,7 +74,6 @@ - @@ -257,6 +257,7 @@ + @@ -273,7 +274,6 @@ -