From d1ac66824ef332da5a71652d01cd559898cc0690 Mon Sep 17 00:00:00 2001
From: Dentomologist <dentomologist@gmail.com>
Date: Sat, 11 Nov 2023 23:29:16 -0800
Subject: [PATCH] InterfacePane: Add BalloonTip to disable screensaver checkbox

---
 Source/Core/DolphinQt/Settings/InterfacePane.cpp | 12 +++++++-----
 Source/Core/DolphinQt/Settings/InterfacePane.h   |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.cpp b/Source/Core/DolphinQt/Settings/InterfacePane.cpp
index 209ff336b6..8f522a50fe 100644
--- a/Source/Core/DolphinQt/Settings/InterfacePane.cpp
+++ b/Source/Core/DolphinQt/Settings/InterfacePane.cpp
@@ -164,7 +164,8 @@ void InterfacePane::CreateUI()
   m_checkbox_show_debugging_ui = new ToolTipCheckBox(tr("Enable Debugging UI"));
   m_checkbox_focused_hotkeys =
       new ConfigBool(tr("Hotkeys Require Window Focus"), Config::MAIN_FOCUSED_HOTKEYS);
-  m_checkbox_disable_screensaver = new QCheckBox(tr("Inhibit Screensaver During Emulation"));
+  m_checkbox_disable_screensaver =
+      new ConfigBool(tr("Inhibit Screensaver During Emulation"), Config::MAIN_DISABLE_SCREENSAVER);
 
   groupbox_layout->addWidget(m_checkbox_use_builtin_title_database);
   groupbox_layout->addWidget(m_checkbox_use_covers);
@@ -230,7 +231,6 @@ void InterfacePane::ConnectLayout()
           &Settings::GameListRefreshRequested);
   connect(m_checkbox_use_covers, &QCheckBox::toggled, &Settings::Instance(),
           &Settings::RefreshMetadata);
-  connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
   connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, &Settings::Instance(),
           &Settings::SetDebugModeEnabled);
   connect(m_combobox_theme, &QComboBox::currentIndexChanged, this,
@@ -316,8 +316,6 @@ void InterfacePane::LoadConfig()
       ->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never);
 
   SignalBlocking(m_checkbox_lock_mouse)->setChecked(Settings::Instance().GetLockCursor());
-  SignalBlocking(m_checkbox_disable_screensaver)
-      ->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
 }
 
 void InterfacePane::OnSaveConfig()
@@ -338,7 +336,6 @@ void InterfacePane::OnSaveConfig()
   Config::SetBase(Config::MAIN_OSD_MESSAGES, m_checkbox_enable_osd->isChecked());
   Config::SetBase(Config::MAIN_SHOW_ACTIVE_TITLE, m_checkbox_show_active_title->isChecked());
   Config::SetBase(Config::MAIN_PAUSE_ON_FOCUS_LOST, m_checkbox_pause_on_focus_lost->isChecked());
-  Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked());
 
   Config::Save();
 }
@@ -390,6 +387,9 @@ void InterfacePane::AddDescriptions()
                  "banner instead."
                  "<br><br>List View will always use the save file banners."
                  "<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
+  static constexpr char TR_DISABLE_SCREENSAVER_DESCRIPTION[] =
+      QT_TR_NOOP("Disables your screensaver while running a game."
+                 "<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
 
   m_checkbox_use_builtin_title_database->SetDescription(tr(TR_TITLE_DATABASE_DESCRIPTION));
 
@@ -404,4 +404,6 @@ void InterfacePane::AddDescriptions()
   m_checkbox_focused_hotkeys->SetDescription(tr(TR_FOCUSED_HOTKEYS_DESCRIPTION));
 
   m_checkbox_use_covers->SetDescription(tr(TR_USE_COVERS_DESCRIPTION));
+
+  m_checkbox_disable_screensaver->SetDescription(tr(TR_DISABLE_SCREENSAVER_DESCRIPTION));
 }
diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.h b/Source/Core/DolphinQt/Settings/InterfacePane.h
index e251b1157a..29e56ae049 100644
--- a/Source/Core/DolphinQt/Settings/InterfacePane.h
+++ b/Source/Core/DolphinQt/Settings/InterfacePane.h
@@ -45,7 +45,7 @@ private:
   ToolTipCheckBox* m_checkbox_show_debugging_ui;
   ConfigBool* m_checkbox_focused_hotkeys;
   ConfigBool* m_checkbox_use_covers;
-  QCheckBox* m_checkbox_disable_screensaver;
+  ConfigBool* m_checkbox_disable_screensaver;
 
   QCheckBox* m_checkbox_confirm_on_stop;
   QCheckBox* m_checkbox_use_panic_handlers;