From afe5bfd5127cda889dac46907c3b94b9641cfbee Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sat, 11 Nov 2023 16:04:50 -0800 Subject: [PATCH] InterfacePane: Add BalloonTip to debugging enabled checkbox --- .../Core/DolphinQt/Settings/InterfacePane.cpp | 29 ++++++++++++++----- .../Core/DolphinQt/Settings/InterfacePane.h | 1 + 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.cpp b/Source/Core/DolphinQt/Settings/InterfacePane.cpp index 198d0810e8..603e7a8447 100644 --- a/Source/Core/DolphinQt/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt/Settings/InterfacePane.cpp @@ -91,7 +91,7 @@ InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent) ConnectLayout(); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, - &InterfacePane::LoadConfig); + &InterfacePane::UpdateShowDebuggingCheckbox); } void InterfacePane::CreateLayout() @@ -228,7 +228,8 @@ void InterfacePane::ConnectLayout() &Settings::GameListRefreshRequested); connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, &Settings::Instance(), + &Settings::SetDebugModeEnabled); connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_combobox_theme, &QComboBox::currentIndexChanged, this, [this](int index) { Settings::Instance().TriggerThemeChanged(); }); @@ -253,24 +254,39 @@ void InterfacePane::ConnectLayout() &Settings::SetLockCursor); } -void InterfacePane::LoadConfig() +void InterfacePane::UpdateShowDebuggingCheckbox() { SignalBlocking(m_checkbox_show_debugging_ui) ->setChecked(Settings::Instance().IsDebugModeEnabled()); + static constexpr char TR_SHOW_DEBUGGING_UI_DESCRIPTION[] = QT_TR_NOOP( + "Shows Dolphin's debugging User Interface. This lets you view and modify a game's code and " + "memory contents, set debugging breakpoints, examine network requests, and more." + "

If unsure, leave this unchecked."); + static constexpr char TR_DISABLED_IN_HARDCORE_DESCRIPTION[] = + QT_TR_NOOP("Disabled in Hardcore Mode."); + #ifdef USE_RETRO_ACHIEVEMENTS bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive(); SignalBlocking(m_checkbox_show_debugging_ui)->setEnabled(!hardcore); if (hardcore) { - m_checkbox_show_debugging_ui->SetDescription( - tr("Disabled in Hardcore Mode.")); + m_checkbox_show_debugging_ui->SetDescription(tr("%1

%2") + .arg(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION)) + .arg(tr(TR_DISABLED_IN_HARDCORE_DESCRIPTION))); } else { - m_checkbox_show_debugging_ui->SetDescription({}); + m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION)); } +#else + m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION)); #endif // USE_RETRO_ACHIEVEMENTS +} + +void InterfacePane::LoadConfig() +{ + UpdateShowDebuggingCheckbox(); const Settings::StyleType style_type = Settings::Instance().GetStyleType(); const QString userstyle = Settings::Instance().GetUserStyleName(); @@ -306,7 +322,6 @@ void InterfacePane::LoadConfig() void InterfacePane::OnSaveConfig() { - Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked()); const auto selected_style = m_combobox_userstyle->currentData(); bool is_builtin_type = false; const int style_type_int = selected_style.toInt(&is_builtin_type); diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.h b/Source/Core/DolphinQt/Settings/InterfacePane.h index 2cdc9e1ebe..b1d0f11c2d 100644 --- a/Source/Core/DolphinQt/Settings/InterfacePane.h +++ b/Source/Core/DolphinQt/Settings/InterfacePane.h @@ -26,6 +26,7 @@ private: void CreateInGame(); void AddDescriptions(); void ConnectLayout(); + void UpdateShowDebuggingCheckbox(); void LoadConfig(); void OnSaveConfig(); void OnCursorVisibleMovement();