From 046e6385d20dd4f8f720a835532efba519021beb Mon Sep 17 00:00:00 2001 From: Reg Tiangha Date: Mon, 16 Sep 2024 07:08:32 -0600 Subject: [PATCH] lime_qt: Use macros to detect QT version --- .../configuration/configure_camera.cpp | 5 ++++ .../configuration/configure_cheats.cpp | 5 ++++ .../configuration/configure_layout.cpp | 28 ++++++++++++++++++- src/lime_qt/debugger/ipc/recorder.cpp | 6 ++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/lime_qt/configuration/configure_camera.cpp b/src/lime_qt/configuration/configure_camera.cpp index d0dbd7c65..dcacaccfd 100644 --- a/src/lime_qt/configuration/configure_camera.cpp +++ b/src/lime_qt/configuration/configure_camera.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "common/settings.h" #include "core/frontend/camera/factory.h" #include "core/hle/service/cam/cam.h" @@ -86,7 +87,11 @@ void ConfigureCamera::ConnectEvents() { }); connect(ui->toolButton, &QToolButton::clicked, this, &ConfigureCamera::OnToolButtonClicked); connect(ui->preview_button, &QPushButton::clicked, this, [this] { StartPreviewing(); }); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect(ui->prompt_before_load, &QCheckBox::stateChanged, this, [this](int state) { +#else connect(ui->prompt_before_load, &QCheckBox::checkStateChanged, this, [this](int state) { +#endif ui->camera_file->setDisabled(state == Qt::Checked); ui->toolButton->setDisabled(state == Qt::Checked); if (state == Qt::Checked) { diff --git a/src/lime_qt/configuration/configure_cheats.cpp b/src/lime_qt/configuration/configure_cheats.cpp index 6e4b0d9a5..a4ba9c856 100644 --- a/src/lime_qt/configuration/configure_cheats.cpp +++ b/src/lime_qt/configuration/configure_cheats.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "configure_cheats.h" #include "core/cheats/cheat_base.h" #include "core/cheats/cheats.h" @@ -59,7 +60,11 @@ void ConfigureCheats::LoadCheats() { i, 2, new QTableWidgetItem(QString::fromStdString(cheats[i]->GetType()))); enabled->setProperty("row", static_cast(i)); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect(enabled, &QCheckBox::stateChanged, this, &ConfigureCheats::OnCheckChanged); +#else connect(enabled, &QCheckBox::checkStateChanged, this, &ConfigureCheats::OnCheckChanged); +#endif } } diff --git a/src/lime_qt/configuration/configure_layout.cpp b/src/lime_qt/configuration/configure_layout.cpp index e7a269bb6..a0109e4ec 100644 --- a/src/lime_qt/configuration/configure_layout.cpp +++ b/src/lime_qt/configuration/configure_layout.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include "common/settings.h" #include "lime_qt/configuration/configuration_shared.h" #include "lime_qt/configuration/configure_layout.h" @@ -48,22 +49,47 @@ ConfigureLayout::ConfigureLayout(QWidget* parent) }); ui->screen_top_leftright_padding->setEnabled(Settings::values.screen_top_stretch.GetValue()); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect(ui->screen_top_stretch, static_cast(&QCheckBox::stateChanged), + this, + [this](bool checkState) { ui->screen_top_leftright_padding->setEnabled(checkState); }); +#else connect(ui->screen_top_stretch, &QCheckBox::checkStateChanged, this, [this](bool checkState) { ui->screen_top_leftright_padding->setEnabled(checkState); }); +#endif ui->screen_top_topbottom_padding->setEnabled(Settings::values.screen_top_stretch.GetValue()); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect(ui->screen_top_stretch, static_cast(&QCheckBox::stateChanged), + this, + [this](bool checkState) { ui->screen_top_topbottom_padding->setEnabled(checkState); }); +#else connect(ui->screen_top_stretch, &QCheckBox::checkStateChanged, this, [this](bool checkState) { ui->screen_top_topbottom_padding->setEnabled(checkState); }); +#endif ui->screen_bottom_leftright_padding->setEnabled( Settings::values.screen_bottom_topbottom_padding.GetValue()); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect( + ui->screen_bottom_stretch, static_cast(&QCheckBox::stateChanged), + this, + [this](bool checkState) { ui->screen_bottom_leftright_padding->setEnabled(checkState); }); +#else connect( ui->screen_bottom_stretch, &QCheckBox::checkStateChanged, this, [this](bool checkState) { ui->screen_bottom_leftright_padding->setEnabled(checkState); }); +#endif ui->screen_bottom_topbottom_padding->setEnabled( Settings::values.screen_bottom_topbottom_padding.GetValue()); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect( + ui->screen_bottom_stretch, static_cast(&QCheckBox::stateChanged), + this, + [this](bool checkState) { ui->screen_bottom_topbottom_padding->setEnabled(checkState); }); +#else connect( ui->screen_bottom_stretch, &QCheckBox::checkStateChanged, this, [this](bool checkState) { ui->screen_bottom_topbottom_padding->setEnabled(checkState); }); - +#endif connect(ui->bg_button, &QPushButton::clicked, this, [this] { const QColor new_bg_color = QColorDialog::getColor(bg_color); if (!new_bg_color.isValid()) { diff --git a/src/lime_qt/debugger/ipc/recorder.cpp b/src/lime_qt/debugger/ipc/recorder.cpp index 0bbdc6eb9..5499a9128 100644 --- a/src/lime_qt/debugger/ipc/recorder.cpp +++ b/src/lime_qt/debugger/ipc/recorder.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "common/assert.h" #include "common/string_util.h" @@ -22,8 +23,13 @@ IPCRecorderWidget::IPCRecorderWidget(Core::System& system_, QWidget* parent) ui->setupUi(this); qRegisterMetaType(); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + connect(ui->enabled, &QCheckBox::stateChanged, this, + [this](int new_state) { SetEnabled(new_state == Qt::Checked); }); +#else connect(ui->enabled, &QCheckBox::checkStateChanged, this, [this](int new_state) { SetEnabled(new_state == Qt::Checked); }); +#endif connect(ui->clearButton, &QPushButton::clicked, this, &IPCRecorderWidget::Clear); connect(ui->filter, &QLineEdit::textChanged, this, &IPCRecorderWidget::ApplyFilterToAll); connect(ui->main, &QTreeWidget::itemDoubleClicked, this, &IPCRecorderWidget::OpenRecordDialog);