diff options
author | Tim Blechmann <tim@klingt.org> | 2024-04-30 13:48:34 +0800 |
---|---|---|
committer | Tim Blechmann <tim@klingt.org> | 2024-05-03 15:55:59 +0800 |
commit | 1d962ce5193d9a79eb23010eaa72f6b7a6fd991e (patch) | |
tree | 305f2867e130e798c7d7fb78c462c7fe409bf818 /src/multimedia | |
parent | fc1f2b66466c47232292f5783d1528556bdb2d95 (diff) |
Pointer-to-member syntax is faster, has improved type safety and is more
tooling friendly.
Pick-to: 6.5 6.7
Change-Id: If629ba3fe29bfa88014ee07d9641b77e030e7de8
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/audio/qsamplecache_p.cpp | 11 | ||||
-rw-r--r-- | src/multimedia/audio/qwavedecoder.cpp | 8 | ||||
-rw-r--r-- | src/multimedia/camera/qcamera.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/camera/qimagecapture.cpp | 21 | ||||
-rw-r--r-- | src/multimedia/pulseaudio/qaudioengine_pulse.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/video/qvideooutputorientationhandler.cpp | 4 |
6 files changed, 24 insertions, 26 deletions
diff --git a/src/multimedia/audio/qsamplecache_p.cpp b/src/multimedia/audio/qsamplecache_p.cpp index 825c79685..b4be09f72 100644 --- a/src/multimedia/audio/qsamplecache_p.cpp +++ b/src/multimedia/audio/qsamplecache_p.cpp @@ -357,12 +357,13 @@ void QSample::load() Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread")); #endif qCDebug(qLcSampleCache) << "QSample: load [" << m_url << "]"; - m_stream = m_parent->networkAccessManager().get(QNetworkRequest(m_url)); - connect(m_stream, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), SLOT(loadingError(QNetworkReply::NetworkError))); + QNetworkReply *reply = m_parent->networkAccessManager().get(QNetworkRequest(m_url)); + m_stream = reply; + connect(reply, &QNetworkReply::errorOccurred, this, &QSample::loadingError); m_waveDecoder = new QWaveDecoder(m_stream); - connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady())); - connect(m_waveDecoder, SIGNAL(parsingError()), SLOT(decoderError())); - connect(m_waveDecoder, SIGNAL(readyRead()), SLOT(readSample())); + connect(m_waveDecoder, &QWaveDecoder::formatKnown, this, &QSample::decoderReady); + connect(m_waveDecoder, &QWaveDecoder::parsingError, this, &QSample::decoderError); + connect(m_waveDecoder, &QIODevice::readyRead, this, &QSample::readSample); m_waveDecoder->open(QIODevice::ReadOnly); } diff --git a/src/multimedia/audio/qwavedecoder.cpp b/src/multimedia/audio/qwavedecoder.cpp index 36ac3c779..452363ddc 100644 --- a/src/multimedia/audio/qwavedecoder.cpp +++ b/src/multimedia/audio/qwavedecoder.cpp @@ -56,7 +56,7 @@ bool QWaveDecoder::open(QIODevice::OpenMode mode) if (canOpen && enoughDataAvailable()) handleData(); else - connect(device, SIGNAL(readyRead()), SLOT(handleData())); + connect(device, &QIODevice::readyRead, this, &QWaveDecoder::handleData); return canOpen; } @@ -274,7 +274,7 @@ bool QWaveDecoder::writeDataLength() void QWaveDecoder::parsingFailed() { Q_ASSERT(device); - device->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); + disconnect(device, &QIODevice::readyRead, this, &QWaveDecoder::handleData); emit parsingError(); } @@ -386,7 +386,7 @@ void QWaveDecoder::handleData() if (state == QWaveDecoder::WaitingForDataState) { if (findChunk("data")) { - device->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); + disconnect(device, &QIODevice::readyRead, this, &QWaveDecoder::handleData); chunk descriptor; device->read(reinterpret_cast<char *>(&descriptor), sizeof(chunk)); @@ -400,7 +400,7 @@ void QWaveDecoder::handleData() dataSize = device->size() - headerLength(); haveFormat = true; - connect(device, SIGNAL(readyRead()), SIGNAL(readyRead())); + connect(device, &QIODevice::readyRead, this, &QIODevice::readyRead); emit formatKnown(); return; diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp index 527b14c25..a625fb96f 100644 --- a/src/multimedia/camera/qcamera.cpp +++ b/src/multimedia/camera/qcamera.cpp @@ -175,8 +175,8 @@ void QCameraPrivate::init(const QCameraDevice &device) if (cameraDevice.isNull()) _q_error(QCamera::CameraError, QStringLiteral("No camera detected")); control->setCamera(cameraDevice); - q->connect(control, SIGNAL(activeChanged(bool)), q, SIGNAL(activeChanged(bool))); - q->connect(control, SIGNAL(error(int,QString)), q, SLOT(_q_error(int,QString))); + q->connect(control, &QPlatformVideoSource::activeChanged, q, &QCamera::activeChanged); + q->connect(control, SIGNAL(error(int, QString)), q, SLOT(_q_error(int, QString))); } /*! diff --git a/src/multimedia/camera/qimagecapture.cpp b/src/multimedia/camera/qimagecapture.cpp index 9b92ce743..df3ddae3f 100644 --- a/src/multimedia/camera/qimagecapture.cpp +++ b/src/multimedia/camera/qimagecapture.cpp @@ -92,18 +92,15 @@ QImageCapture::QImageCapture(QObject *parent) } d->control = maybeControl.value(); - connect(d->control, SIGNAL(imageExposed(int)), - this, SIGNAL(imageExposed(int))); - connect(d->control, SIGNAL(imageCaptured(int,QImage)), - this, SIGNAL(imageCaptured(int,QImage))); - connect(d->control, SIGNAL(imageMetadataAvailable(int,QMediaMetaData)), - this, SIGNAL(imageMetadataAvailable(int,QMediaMetaData))); - connect(d->control, SIGNAL(imageAvailable(int,QVideoFrame)), - this, SIGNAL(imageAvailable(int,QVideoFrame))); - connect(d->control, SIGNAL(imageSaved(int,QString)), - this, SIGNAL(imageSaved(int,QString))); - connect(d->control, SIGNAL(readyForCaptureChanged(bool)), - this, SIGNAL(readyForCaptureChanged(bool))); + connect(d->control, &QPlatformImageCapture::imageExposed, this, &QImageCapture::imageExposed); + connect(d->control, &QPlatformImageCapture::imageCaptured, this, &QImageCapture::imageCaptured); + connect(d->control, &QPlatformImageCapture::imageMetadataAvailable, this, + &QImageCapture::imageMetadataAvailable); + connect(d->control, &QPlatformImageCapture::imageAvailable, this, + &QImageCapture::imageAvailable); + connect(d->control, &QPlatformImageCapture::imageSaved, this, &QImageCapture::imageSaved); + connect(d->control, &QPlatformImageCapture::readyForCaptureChanged, this, + &QImageCapture::readyForCaptureChanged); connect(d->control, SIGNAL(error(int,int,QString)), this, SLOT(_q_error(int,int,QString))); } diff --git a/src/multimedia/pulseaudio/qaudioengine_pulse.cpp b/src/multimedia/pulseaudio/qaudioengine_pulse.cpp index e54356404..5fac7234a 100644 --- a/src/multimedia/pulseaudio/qaudioengine_pulse.cpp +++ b/src/multimedia/pulseaudio/qaudioengine_pulse.cpp @@ -477,7 +477,7 @@ void QPulseAudioEngine::onContextFailed() release(); // Try to reconnect later - QTimer::singleShot(3000, this, SLOT(prepare())); + QTimer::singleShot(3000, this, &QPulseAudioEngine::prepare); } QPulseAudioEngine *QPulseAudioEngine::instance() diff --git a/src/multimedia/video/qvideooutputorientationhandler.cpp b/src/multimedia/video/qvideooutputorientationhandler.cpp index c34e9e92a..ff91bd7fb 100644 --- a/src/multimedia/video/qvideooutputorientationhandler.cpp +++ b/src/multimedia/video/qvideooutputorientationhandler.cpp @@ -18,8 +18,8 @@ QVideoOutputOrientationHandler::QVideoOutputOrientationHandler(QObject *parent) if (!screen) return; - connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), - this, SLOT(screenOrientationChanged(Qt::ScreenOrientation))); + connect(screen, &QScreen::orientationChanged, this, + &QVideoOutputOrientationHandler::screenOrientationChanged); screenOrientationChanged(screen->orientation()); } |