From 2e4db14bc143fdb31db1ceadcf9db0740825e118 Mon Sep 17 00:00:00 2001
From: Zephyron <zephyron@citron-emu.org>
Date: Mon, 27 Jan 2025 15:36:29 +1000
Subject: [PATCH] qt: Replace deprecated stateChanged with checkStateChanged

Updates QCheckBox signal connections to use checkStateChanged instead of
the deprecated stateChanged signal. This change affects:

- qt_controller.cpp
- configure_filesystem.cpp
- configure_input.cpp
- configure_input_advanced.cpp
- configure_system.cpp
- configure_ui.cpp
- shared_widget.cpp

Also updates lambda signatures to use Qt::CheckState instead of int for
the state parameter where needed.
---
 src/citron/applets/qt_controller.cpp                  |  2 +-
 src/citron/configuration/configure_filesystem.cpp     |  4 ++--
 src/citron/configuration/configure_input.cpp          |  2 +-
 src/citron/configuration/configure_input_advanced.cpp |  8 ++++----
 src/citron/configuration/configure_system.cpp         |  2 +-
 src/citron/configuration/configure_ui.cpp             | 10 +++++-----
 src/citron/configuration/shared_widget.cpp            |  2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/citron/applets/qt_controller.cpp b/src/citron/applets/qt_controller.cpp
index ab8a9cab2..bcb48d2bd 100644
--- a/src/citron/applets/qt_controller.cpp
+++ b/src/citron/applets/qt_controller.cpp
@@ -184,7 +184,7 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
                     CheckIfParametersMet();
                 });
 
-        connect(connected_controller_checkboxes[i], &QCheckBox::stateChanged, [this, i](int state) {
+        connect(connected_controller_checkboxes[i], &QCheckBox::checkStateChanged, [this, i](Qt::CheckState state) {
             player_groupboxes[i]->setChecked(state == Qt::Checked);
             UpdateControllerIcon(i);
             UpdateControllerState(i);
diff --git a/src/citron/configuration/configure_filesystem.cpp b/src/citron/configuration/configure_filesystem.cpp
index 4b05562c7..f44f3416e 100644
--- a/src/citron/configuration/configure_filesystem.cpp
+++ b/src/citron/configuration/configure_filesystem.cpp
@@ -29,9 +29,9 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
     connect(ui->reset_game_list_cache, &QPushButton::pressed, this,
             &ConfigureFilesystem::ResetMetadata);
 
-    connect(ui->gamecard_inserted, &QCheckBox::stateChanged, this,
+    connect(ui->gamecard_inserted, &QCheckBox::checkStateChanged, this,
             &ConfigureFilesystem::UpdateEnabledControls);
-    connect(ui->gamecard_current_game, &QCheckBox::stateChanged, this,
+    connect(ui->gamecard_current_game, &QCheckBox::checkStateChanged, this,
             &ConfigureFilesystem::UpdateEnabledControls);
 }
 
diff --git a/src/citron/configuration/configure_input.cpp b/src/citron/configuration/configure_input.cpp
index 8b8850245..52098cabe 100644
--- a/src/citron/configuration/configure_input.cpp
+++ b/src/citron/configuration/configure_input.cpp
@@ -121,7 +121,7 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
                 &ConfigureInput::UpdateAllInputDevices);
         connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputProfiles, this,
                 &ConfigureInput::UpdateAllInputProfiles, Qt::QueuedConnection);
-        connect(connected_controller_checkboxes[i], &QCheckBox::stateChanged, [this, i](int state) {
+        connect(connected_controller_checkboxes[i], &QCheckBox::checkStateChanged, [this, i](Qt::CheckState state) {
             // Keep activated controllers synced with the "Connected Controllers" checkboxes
             player_controllers[i]->ConnectPlayer(state == Qt::Checked);
         });
diff --git a/src/citron/configuration/configure_input_advanced.cpp b/src/citron/configuration/configure_input_advanced.cpp
index 198719727..8d587d8c7 100644
--- a/src/citron/configuration/configure_input_advanced.cpp
+++ b/src/citron/configuration/configure_input_advanced.cpp
@@ -74,13 +74,13 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(Core::HID::HIDCore& hid_core_, QW
         }
     }
 
-    connect(ui->mouse_enabled, &QCheckBox::stateChanged, this,
+    connect(ui->mouse_enabled, &QCheckBox::checkStateChanged, this,
             &ConfigureInputAdvanced::UpdateUIEnabled);
-    connect(ui->debug_enabled, &QCheckBox::stateChanged, this,
+    connect(ui->debug_enabled, &QCheckBox::checkStateChanged, this,
             &ConfigureInputAdvanced::UpdateUIEnabled);
-    connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this,
+    connect(ui->touchscreen_enabled, &QCheckBox::checkStateChanged, this,
             &ConfigureInputAdvanced::UpdateUIEnabled);
-    connect(ui->enable_ring_controller, &QCheckBox::stateChanged, this,
+    connect(ui->enable_ring_controller, &QCheckBox::checkStateChanged, this,
             &ConfigureInputAdvanced::UpdateUIEnabled);
 
     connect(ui->debug_configure, &QPushButton::clicked, this,
diff --git a/src/citron/configuration/configure_system.cpp b/src/citron/configuration/configure_system.cpp
index 685772858..10a972acc 100644
--- a/src/citron/configuration/configure_system.cpp
+++ b/src/citron/configuration/configure_system.cpp
@@ -83,7 +83,7 @@ ConfigureSystem::ConfigureSystem(Core::System& system_,
 
     connect(combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
     connect(combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
-    connect(checkbox_rtc, qOverload<int>(&QCheckBox::stateChanged), this, update_rtc_date);
+    connect(checkbox_rtc, &QCheckBox::checkStateChanged, this, update_rtc_date);
     connect(date_rtc_offset, qOverload<int>(&QSpinBox::valueChanged), this, update_rtc_date);
     connect(date_rtc, &QDateTimeEdit::dateTimeChanged, this, update_date_offset);
 
diff --git a/src/citron/configuration/configure_ui.cpp b/src/citron/configuration/configure_ui.cpp
index 2faf25896..21c741471 100644
--- a/src/citron/configuration/configure_ui.cpp
+++ b/src/citron/configuration/configure_ui.cpp
@@ -119,11 +119,11 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
     SetConfiguration();
 
     // Force game list reload if any of the relevant settings are changed.
-    connect(ui->show_add_ons, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate);
-    connect(ui->show_compat, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate);
-    connect(ui->show_size, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate);
-    connect(ui->show_types, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate);
-    connect(ui->show_play_time, &QCheckBox::stateChanged, this,
+    connect(ui->show_add_ons, &QCheckBox::checkStateChanged, this, &ConfigureUi::RequestGameListUpdate);
+    connect(ui->show_compat, &QCheckBox::checkStateChanged, this, &ConfigureUi::RequestGameListUpdate);
+    connect(ui->show_size, &QCheckBox::checkStateChanged, this, &ConfigureUi::RequestGameListUpdate);
+    connect(ui->show_types, &QCheckBox::checkStateChanged, this, &ConfigureUi::RequestGameListUpdate);
+    connect(ui->show_play_time, &QCheckBox::checkStateChanged, this,
             &ConfigureUi::RequestGameListUpdate);
     connect(ui->game_icon_size_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
             &ConfigureUi::RequestGameListUpdate);
diff --git a/src/citron/configuration/shared_widget.cpp b/src/citron/configuration/shared_widget.cpp
index 5e1465a46..7e3bd11ae 100644
--- a/src/citron/configuration/shared_widget.cpp
+++ b/src/citron/configuration/shared_widget.cpp
@@ -699,7 +699,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
                 restore_func();
             }
         };
-        connect(checkbox, &QCheckBox::stateChanged, reset);
+        connect(checkbox, &QCheckBox::checkStateChanged, reset);
         reset(checkbox->checkState());
     }
 }