From b2107023bae14ebba544d27bc4dfe42f1f1b60d4 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Mon, 27 Nov 2023 22:06:08 -0800 Subject: [PATCH] GeneralPane: Add BalloonTip to dualcore checkbox --- .../Core/DolphinQt/Settings/GeneralPane.cpp | 19 +++++++++++++++---- Source/Core/DolphinQt/Settings/GeneralPane.h | 4 +++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp index 4804c72102..8aabfdb9fe 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp +++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp @@ -24,6 +24,7 @@ #include "Core/PowerPC/PowerPC.h" #include "Core/System.h" +#include "DolphinQt/Config/ConfigControls/ConfigBool.h" #include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/NonDefaultQPushButton.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h" @@ -52,6 +53,7 @@ GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent) { CreateLayout(); LoadConfig(); + AddDescriptions(); ConnectLayout(); @@ -97,7 +99,6 @@ void GeneralPane::OnEmulationStateChanged(Core::State state) void GeneralPane::ConnectLayout() { - connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig); connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig); connect(m_checkbox_override_region_settings, &QCheckBox::stateChanged, this, &GeneralPane::OnSaveConfig); @@ -140,7 +141,7 @@ void GeneralPane::CreateBasic() basic_group->setLayout(basic_group_layout); m_main_layout->addWidget(basic_group); - m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speedhack)")); + m_checkbox_dualcore = new ConfigBool(tr("Enable Dual Core (speedhack)"), Config::MAIN_CPU_THREAD); basic_group_layout->addWidget(m_checkbox_dualcore); m_checkbox_cheats = new QCheckBox(tr("Enable Cheats")); @@ -261,7 +262,6 @@ void GeneralPane::LoadConfig() SignalBlocking(m_checkbox_enable_analytics) ->setChecked(Settings::Instance().IsAnalyticsEnabled()); #endif - SignalBlocking(m_checkbox_dualcore)->setChecked(Config::Get(Config::MAIN_CPU_THREAD)); SignalBlocking(m_checkbox_cheats)->setChecked(Settings::Instance().GetCheatsEnabled()); SignalBlocking(m_checkbox_override_region_settings) ->setChecked(Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS)); @@ -353,7 +353,6 @@ void GeneralPane::OnSaveConfig() Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked()); DolphinAnalytics::Instance().ReloadConfig(); #endif - Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked()); Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked()); Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS, m_checkbox_override_region_settings->isChecked()); @@ -378,3 +377,15 @@ void GeneralPane::GenerateNewIdentity() message_box.exec(); } #endif + +void GeneralPane::AddDescriptions() +{ + static constexpr char TR_DUALCORE_DESCRIPTION[] = + QT_TR_NOOP("Separates CPU and GPU emulation work to separate threads. Reduces single-thread " + "burden by spreading Dolphin's heaviest load across two cores, which usually " + "improves performance. However, it can result in glitches and crashes." + "

This setting cannot be changed while emulation is active." + "

If unsure, leave this checked."); + + m_checkbox_dualcore->SetDescription(tr(TR_DUALCORE_DESCRIPTION)); +} diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.h b/Source/Core/DolphinQt/Settings/GeneralPane.h index 476cc67510..2fc68ddc13 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.h +++ b/Source/Core/DolphinQt/Settings/GeneralPane.h @@ -5,6 +5,7 @@ #include +class ConfigBool; class QCheckBox; class QComboBox; class QLabel; @@ -30,6 +31,7 @@ private: void CreateBasic(); void CreateAutoUpdate(); void CreateFallbackRegion(); + void AddDescriptions(); void LoadConfig(); void OnSaveConfig(); @@ -40,7 +42,7 @@ private: QComboBox* m_combobox_speedlimit; QComboBox* m_combobox_update_track; QComboBox* m_combobox_fallback_region; - QCheckBox* m_checkbox_dualcore; + ConfigBool* m_checkbox_dualcore; QCheckBox* m_checkbox_cheats; QCheckBox* m_checkbox_override_region_settings; QCheckBox* m_checkbox_auto_disc_change;