InterfacePane: Add BalloonTip to debugging enabled checkbox

This commit is contained in:
Dentomologist 2023-11-11 16:04:50 -08:00 committed by Admiral H. Curtiss
parent 7d704ca9ca
commit afe5bfd512
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 23 additions and 7 deletions

View File

@ -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."
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static constexpr char TR_DISABLED_IN_HARDCORE_DESCRIPTION[] =
QT_TR_NOOP("<dolphin_emphasis>Disabled in Hardcore Mode.</dolphin_emphasis>");
#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("<dolphin_emphasis>Disabled in Hardcore Mode.</dolphin_emphasis>"));
m_checkbox_show_debugging_ui->SetDescription(tr("%1<br><br>%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);

View File

@ -26,6 +26,7 @@ private:
void CreateInGame();
void AddDescriptions();
void ConnectLayout();
void UpdateShowDebuggingCheckbox();
void LoadConfig();
void OnSaveConfig();
void OnCursorVisibleMovement();