Backport some functions to build properly on Qt 6.4 (#5)

This commit is contained in:
Essem 2024-06-06 17:05:39 -05:00 committed by GitHub
parent f6550f197e
commit fda2dae89c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View file

@ -33,6 +33,8 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
QMessageBox::critical(this, tr("SDL2 Error"), tr("SDL2 failed to initialize. Controller support will be unavailable.")); QMessageBox::critical(this, tr("SDL2 Error"), tr("SDL2 failed to initialize. Controller support will be unavailable."));
} }
qRegisterMetaType<uint16_t>("uint16_t");
QHBoxLayout *layout = new QHBoxLayout(this); QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
@ -282,7 +284,7 @@ void MainWindow::setConnectedState(bool on)
if (on) { if (on) {
m_connectBtn->setText(tr("Disconnect")); m_connectBtn->setText(tr("Disconnect"));
QMetaObject::invokeMethod(m_backend, &Backend::connectToConsole, Qt::QueuedConnection, m_wirelessInterfaceComboBox->currentText()); QMetaObject::invokeMethod(m_backend, "connectToConsole", Qt::QueuedConnection, Q_ARG(QString, m_wirelessInterfaceComboBox->currentText()));
} else { } else {
if (m_backend) { if (m_backend) {
m_backend->interrupt(); m_backend->interrupt();
@ -314,8 +316,8 @@ void MainWindow::exitFullScreen()
void MainWindow::volumeChanged(int v) void MainWindow::volumeChanged(int v)
{ {
qreal vol = v * 0.01; qreal vol = v * 0.01;
vol = QtAudio::convertVolume(vol, QtAudio::LinearVolumeScale, QtAudio::LogarithmicVolumeScale); vol = QAudio::convertVolume(vol, QAudio::LinearVolumeScale, QAudio::LogarithmicVolumeScale);
QMetaObject::invokeMethod(m_audioHandler, &AudioHandler::setVolume, vol); QMetaObject::invokeMethod(m_audioHandler, "setVolume", Q_ARG(qreal, vol));
} }
void MainWindow::showInputConfigDialog() void MainWindow::showInputConfigDialog()

View file

@ -14,6 +14,8 @@
#include "videodecoder.h" #include "videodecoder.h"
#include "viewer.h" #include "viewer.h"
Q_DECLARE_METATYPE(uint16_t)
class MainWindow : public QWidget class MainWindow : public QWidget
{ {
Q_OBJECT Q_OBJECT

View file

@ -53,7 +53,7 @@ SyncProgressDialog::SyncProgressDialog(Backend *backend, const QString &wireless
m_backend = backend; m_backend = backend;
connect(m_backend, &Backend::syncCompleted, this, &SyncProgressDialog::syncReturned); connect(m_backend, &Backend::syncCompleted, this, &SyncProgressDialog::syncReturned);
QMetaObject::invokeMethod(m_backend, &Backend::sync, wirelessInterface, code); QMetaObject::invokeMethod(m_backend, "sync", Q_ARG(QString, wirelessInterface), Q_ARG(uint16_t, code));
} }
void SyncProgressDialog::syncReturned(bool success) void SyncProgressDialog::syncReturned(bool success)