lime_qt: Use macros to detect QT version

This commit is contained in:
Reg Tiangha 2024-09-16 07:08:32 -06:00 committed by OpenSauce
parent 725d1eb90d
commit 046e6385d2
4 changed files with 43 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#include <QMediaDevices>
#include <QMessageBox>
#include <QWidget>
#include <QtGlobal>
#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) {

View File

@ -5,6 +5,7 @@
#include <QCheckBox>
#include <QMessageBox>
#include <QTableWidgetItem>
#include <QtGlobal>
#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<int>(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
}
}

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <QColorDialog>
#include <QtGlobal>
#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<void (QCheckBox::*)(int)>(&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<void (QCheckBox::*)(int)>(&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<void (QCheckBox::*)(int)>(&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<void (QCheckBox::*)(int)>(&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()) {

View File

@ -5,6 +5,7 @@
#include <QBrush>
#include <QString>
#include <QTreeWidgetItem>
#include <QtGlobal>
#include <fmt/format.h>
#include "common/assert.h"
#include "common/string_util.h"
@ -22,8 +23,13 @@ IPCRecorderWidget::IPCRecorderWidget(Core::System& system_, QWidget* parent)
ui->setupUi(this);
qRegisterMetaType<IPCDebugger::RequestRecord>();
#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);