diff options
author | Jochen Seemann <seemann.jochen@gmail.com> | 2017-11-23 21:12:24 +0100 |
---|---|---|
committer | Jochen Seemann <seemann.jochen@gmail.com> | 2017-12-19 12:04:34 +0000 |
commit | 93630cd621b472d73fc8456ca396cda012a1aee0 (patch) | |
tree | bb42ea8fc88d5961493caccbd116c5b1748a089f /examples/multimedia/audiodecoder | |
parent | 5629823b05ca7d24924ac879b5a0469a3cb03e78 (diff) |
examples: use Qt5-style connects where possible
Additionally, remove obsolete CHECKED_CONNECT macro from
the spectrum example.
Change-Id: Id6fe01718679463c2b025d688c970583d64d60e9
Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'examples/multimedia/audiodecoder')
-rw-r--r-- | examples/multimedia/audiodecoder/audiodecoder.cpp | 26 | ||||
-rw-r--r-- | examples/multimedia/audiodecoder/main.cpp | 3 |
2 files changed, 19 insertions, 10 deletions
diff --git a/examples/multimedia/audiodecoder/audiodecoder.cpp b/examples/multimedia/audiodecoder/audiodecoder.cpp index 5145d529e..86904f7c9 100644 --- a/examples/multimedia/audiodecoder/audiodecoder.cpp +++ b/examples/multimedia/audiodecoder/audiodecoder.cpp @@ -67,15 +67,23 @@ AudioDecoder::AudioDecoder(bool isPlayback, bool isDelete) format.setSampleType(QAudioFormat::SignedInt); m_decoder.setAudioFormat(format); - connect(&m_decoder, SIGNAL(bufferReady()), this, SLOT(bufferReady())); - connect(&m_decoder, SIGNAL(error(QAudioDecoder::Error)), this, SLOT(error(QAudioDecoder::Error))); - connect(&m_decoder, SIGNAL(stateChanged(QAudioDecoder::State)), this, SLOT(stateChanged(QAudioDecoder::State))); - connect(&m_decoder, SIGNAL(finished()), this, SLOT(finished())); - connect(&m_decoder, SIGNAL(positionChanged(qint64)), this, SLOT(updateProgress())); - connect(&m_decoder, SIGNAL(durationChanged(qint64)), this, SLOT(updateProgress())); - - connect(&m_soundEffect, SIGNAL(statusChanged()), this, SLOT(playbackStatusChanged())); - connect(&m_soundEffect, SIGNAL(playingChanged()), this, SLOT(playingChanged())); + connect(&m_decoder, &QAudioDecoder::bufferReady, + this, &AudioDecoder::bufferReady); + connect(&m_decoder, QOverload<QAudioDecoder::Error>::of(&QAudioDecoder::error), + this, QOverload<QAudioDecoder::Error>::of(&AudioDecoder::error)); + connect(&m_decoder, &QAudioDecoder::stateChanged, + this, &AudioDecoder::stateChanged); + connect(&m_decoder, &QAudioDecoder::finished, + this, &AudioDecoder::finished); + connect(&m_decoder, &QAudioDecoder::positionChanged, + this, &AudioDecoder::updateProgress); + connect(&m_decoder, &QAudioDecoder::durationChanged, + this, &AudioDecoder::updateProgress); + + connect(&m_soundEffect, &QSoundEffect::statusChanged, + this, &AudioDecoder::playbackStatusChanged); + connect(&m_soundEffect, &QSoundEffect::playingChanged, + this, &AudioDecoder::playingChanged); m_progress = -1.0; } diff --git a/examples/multimedia/audiodecoder/main.cpp b/examples/multimedia/audiodecoder/main.cpp index 2b4b9dab4..c0947b83f 100644 --- a/examples/multimedia/audiodecoder/main.cpp +++ b/examples/multimedia/audiodecoder/main.cpp @@ -95,7 +95,8 @@ int main(int argc, char *argv[]) targetFile.setFile(sourceFile.dir().absoluteFilePath("out.wav")); AudioDecoder decoder(isPlayback, isDelete); - QObject::connect(&decoder, SIGNAL(done()), &app, SLOT(quit())); + QObject::connect(&decoder, &AudioDecoder::done, + &app, &QCoreApplication::quit); decoder.setSourceFilename(sourceFile.absoluteFilePath()); decoder.setTargetFilename(targetFile.absoluteFilePath()); decoder.start(); |