diff options
| author | 2022-08-31 03:10:34 -0700 | |
|---|---|---|
| committer | 2022-11-17 19:14:14 -0800 | |
| commit | ad3ee5c52bd26cfb123d0bc47c18d4a4d2fbb64d (patch) | |
| tree | 9144ac6918014541f2620343ac8d104c38ac599b | |
| parent | Merge pull request #9244 from liamwhite/lost-wakeup (diff) | |
| download | yuzu-ad3ee5c52bd26cfb123d0bc47c18d4a4d2fbb64d.tar.gz yuzu-ad3ee5c52bd26cfb123d0bc47c18d4a4d2fbb64d.tar.xz yuzu-ad3ee5c52bd26cfb123d0bc47c18d4a4d2fbb64d.zip | |
Qt6: Disable IR Sensor when compiling with Qt6
Gating the IR Sensor code behind a macro like so
`#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA`
The YUZU_USE_QT_MULTIMEDIA flag is implemented in later commit
Also the locale fix in src/yuzu/main.cpp is now gated against Qt6,
as it causes compilation error
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_camera.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_camera.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_advanced.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 2 |
6 files changed, 25 insertions, 0 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index d88efacd7..c934069dd 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -4,8 +4,10 @@ | |||
| 4 | #include <glad/glad.h> | 4 | #include <glad/glad.h> |
| 5 | 5 | ||
| 6 | #include <QApplication> | 6 | #include <QApplication> |
| 7 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 7 | #include <QCameraImageCapture> | 8 | #include <QCameraImageCapture> |
| 8 | #include <QCameraInfo> | 9 | #include <QCameraInfo> |
| 10 | #endif | ||
| 9 | #include <QHBoxLayout> | 11 | #include <QHBoxLayout> |
| 10 | #include <QMessageBox> | 12 | #include <QMessageBox> |
| 11 | #include <QPainter> | 13 | #include <QPainter> |
| @@ -707,6 +709,7 @@ void GRenderWindow::TouchEndEvent() { | |||
| 707 | } | 709 | } |
| 708 | 710 | ||
| 709 | void GRenderWindow::InitializeCamera() { | 711 | void GRenderWindow::InitializeCamera() { |
| 712 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 710 | constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz) | 713 | constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz) |
| 711 | if (!Settings::values.enable_ir_sensor) { | 714 | if (!Settings::values.enable_ir_sensor) { |
| 712 | return; | 715 | return; |
| @@ -760,18 +763,22 @@ void GRenderWindow::InitializeCamera() { | |||
| 760 | connect(camera_timer.get(), &QTimer::timeout, [this] { RequestCameraCapture(); }); | 763 | connect(camera_timer.get(), &QTimer::timeout, [this] { RequestCameraCapture(); }); |
| 761 | // This timer should be dependent of camera resolution 5ms for every 100 pixels | 764 | // This timer should be dependent of camera resolution 5ms for every 100 pixels |
| 762 | camera_timer->start(camera_update_ms); | 765 | camera_timer->start(camera_update_ms); |
| 766 | #endif | ||
| 763 | } | 767 | } |
| 764 | 768 | ||
| 765 | void GRenderWindow::FinalizeCamera() { | 769 | void GRenderWindow::FinalizeCamera() { |
| 770 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 766 | if (camera_timer) { | 771 | if (camera_timer) { |
| 767 | camera_timer->stop(); | 772 | camera_timer->stop(); |
| 768 | } | 773 | } |
| 769 | if (camera) { | 774 | if (camera) { |
| 770 | camera->unload(); | 775 | camera->unload(); |
| 771 | } | 776 | } |
| 777 | #endif | ||
| 772 | } | 778 | } |
| 773 | 779 | ||
| 774 | void GRenderWindow::RequestCameraCapture() { | 780 | void GRenderWindow::RequestCameraCapture() { |
| 781 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 775 | if (!Settings::values.enable_ir_sensor) { | 782 | if (!Settings::values.enable_ir_sensor) { |
| 776 | return; | 783 | return; |
| 777 | } | 784 | } |
| @@ -788,6 +795,7 @@ void GRenderWindow::RequestCameraCapture() { | |||
| 788 | 795 | ||
| 789 | pending_camera_snapshots++; | 796 | pending_camera_snapshots++; |
| 790 | camera_capture->capture(); | 797 | camera_capture->capture(); |
| 798 | #endif | ||
| 791 | } | 799 | } |
| 792 | 800 | ||
| 793 | void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) { | 801 | void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) { |
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index c45ebf1a2..4a01481cd 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h | |||
| @@ -241,8 +241,10 @@ private: | |||
| 241 | 241 | ||
| 242 | bool is_virtual_camera; | 242 | bool is_virtual_camera; |
| 243 | int pending_camera_snapshots; | 243 | int pending_camera_snapshots; |
| 244 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 244 | std::unique_ptr<QCamera> camera; | 245 | std::unique_ptr<QCamera> camera; |
| 245 | std::unique_ptr<QCameraImageCapture> camera_capture; | 246 | std::unique_ptr<QCameraImageCapture> camera_capture; |
| 247 | #endif | ||
| 246 | std::unique_ptr<QTimer> camera_timer; | 248 | std::unique_ptr<QTimer> camera_timer; |
| 247 | 249 | ||
| 248 | Core::System& system; | 250 | Core::System& system; |
diff --git a/src/yuzu/configuration/configure_camera.cpp b/src/yuzu/configuration/configure_camera.cpp index 2a61de2a1..d95e96696 100644 --- a/src/yuzu/configuration/configure_camera.cpp +++ b/src/yuzu/configuration/configure_camera.cpp | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | #include <QtCore> | ||
| 6 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 5 | #include <QCameraImageCapture> | 7 | #include <QCameraImageCapture> |
| 6 | #include <QCameraInfo> | 8 | #include <QCameraInfo> |
| 9 | #endif | ||
| 7 | #include <QStandardItemModel> | 10 | #include <QStandardItemModel> |
| 8 | #include <QTimer> | 11 | #include <QTimer> |
| 9 | 12 | ||
| @@ -33,6 +36,7 @@ ConfigureCamera::ConfigureCamera(QWidget* parent, InputCommon::InputSubsystem* i | |||
| 33 | ConfigureCamera::~ConfigureCamera() = default; | 36 | ConfigureCamera::~ConfigureCamera() = default; |
| 34 | 37 | ||
| 35 | void ConfigureCamera::PreviewCamera() { | 38 | void ConfigureCamera::PreviewCamera() { |
| 39 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 36 | const auto index = ui->ir_sensor_combo_box->currentIndex(); | 40 | const auto index = ui->ir_sensor_combo_box->currentIndex(); |
| 37 | bool camera_found = false; | 41 | bool camera_found = false; |
| 38 | const QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); | 42 | const QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); |
| @@ -101,6 +105,7 @@ void ConfigureCamera::PreviewCamera() { | |||
| 101 | }); | 105 | }); |
| 102 | 106 | ||
| 103 | camera_timer->start(250); | 107 | camera_timer->start(250); |
| 108 | #endif | ||
| 104 | } | 109 | } |
| 105 | 110 | ||
| 106 | void ConfigureCamera::DisplayCapturedFrame(int requestId, const QImage& img) { | 111 | void ConfigureCamera::DisplayCapturedFrame(int requestId, const QImage& img) { |
| @@ -133,11 +138,13 @@ void ConfigureCamera::LoadConfiguration() { | |||
| 133 | ui->ir_sensor_combo_box->clear(); | 138 | ui->ir_sensor_combo_box->clear(); |
| 134 | input_devices.push_back("Auto"); | 139 | input_devices.push_back("Auto"); |
| 135 | ui->ir_sensor_combo_box->addItem(tr("Auto")); | 140 | ui->ir_sensor_combo_box->addItem(tr("Auto")); |
| 141 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 136 | const auto cameras = QCameraInfo::availableCameras(); | 142 | const auto cameras = QCameraInfo::availableCameras(); |
| 137 | for (const QCameraInfo& cameraInfo : cameras) { | 143 | for (const QCameraInfo& cameraInfo : cameras) { |
| 138 | input_devices.push_back(cameraInfo.deviceName().toStdString()); | 144 | input_devices.push_back(cameraInfo.deviceName().toStdString()); |
| 139 | ui->ir_sensor_combo_box->addItem(cameraInfo.description()); | 145 | ui->ir_sensor_combo_box->addItem(cameraInfo.description()); |
| 140 | } | 146 | } |
| 147 | #endif | ||
| 141 | 148 | ||
| 142 | const auto current_device = Settings::values.ir_sensor_device.GetValue(); | 149 | const auto current_device = Settings::values.ir_sensor_device.GetValue(); |
| 143 | 150 | ||
diff --git a/src/yuzu/configuration/configure_camera.h b/src/yuzu/configuration/configure_camera.h index db9833b5c..9a90512b3 100644 --- a/src/yuzu/configuration/configure_camera.h +++ b/src/yuzu/configuration/configure_camera.h | |||
| @@ -46,8 +46,10 @@ private: | |||
| 46 | 46 | ||
| 47 | bool is_virtual_camera; | 47 | bool is_virtual_camera; |
| 48 | int pending_snapshots; | 48 | int pending_snapshots; |
| 49 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | ||
| 49 | std::unique_ptr<QCamera> camera; | 50 | std::unique_ptr<QCamera> camera; |
| 50 | std::unique_ptr<QCameraImageCapture> camera_capture; | 51 | std::unique_ptr<QCameraImageCapture> camera_capture; |
| 52 | #endif | ||
| 51 | std::unique_ptr<QTimer> camera_timer; | 53 | std::unique_ptr<QTimer> camera_timer; |
| 52 | std::vector<std::string> input_devices; | 54 | std::vector<std::string> input_devices; |
| 53 | std::unique_ptr<Ui::ConfigureCamera> ui; | 55 | std::unique_ptr<Ui::ConfigureCamera> ui; |
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index 10f841b98..235b813d9 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp | |||
| @@ -194,4 +194,8 @@ void ConfigureInputAdvanced::UpdateUIEnabled() { | |||
| 194 | ui->mouse_panning->setEnabled(!ui->mouse_enabled->isChecked()); | 194 | ui->mouse_panning->setEnabled(!ui->mouse_enabled->isChecked()); |
| 195 | ui->mouse_panning_sensitivity->setEnabled(!ui->mouse_enabled->isChecked()); | 195 | ui->mouse_panning_sensitivity->setEnabled(!ui->mouse_enabled->isChecked()); |
| 196 | ui->ring_controller_configure->setEnabled(ui->enable_ring_controller->isChecked()); | 196 | ui->ring_controller_configure->setEnabled(ui->enable_ring_controller->isChecked()); |
| 197 | #if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) || !defined(YUZU_USE_QT_MULTIMEDIA) | ||
| 198 | ui->enable_ir_sensor->setEnabled(false); | ||
| 199 | ui->camera_configure->setEnabled(false); | ||
| 200 | #endif | ||
| 197 | } | 201 | } |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 7ee2302cc..26c593fce 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -4194,10 +4194,12 @@ int main(int argc, char* argv[]) { | |||
| 4194 | // so we can see if we get \u3008 instead | 4194 | // so we can see if we get \u3008 instead |
| 4195 | // TL;DR all other number formats are consecutive in unicode code points | 4195 | // TL;DR all other number formats are consecutive in unicode code points |
| 4196 | // This bug is fixed in Qt6, specifically 6.0.0-alpha1 | 4196 | // This bug is fixed in Qt6, specifically 6.0.0-alpha1 |
| 4197 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) | ||
| 4197 | const QLocale locale = QLocale::system(); | 4198 | const QLocale locale = QLocale::system(); |
| 4198 | if (QStringLiteral("\u3008") == locale.toString(1)) { | 4199 | if (QStringLiteral("\u3008") == locale.toString(1)) { |
| 4199 | QLocale::setDefault(QLocale::system().name()); | 4200 | QLocale::setDefault(QLocale::system().name()); |
| 4200 | } | 4201 | } |
| 4202 | #endif | ||
| 4201 | 4203 | ||
| 4202 | // Qt changes the locale and causes issues in float conversion using std::to_string() when | 4204 | // Qt changes the locale and causes issues in float conversion using std::to_string() when |
| 4203 | // generating shaders | 4205 | // generating shaders |