diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-04-14 09:32:14 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-04-15 10:26:37 +0000 |
commit | 0f9a779f7214f22dfa4625b91dbc3e4d0fc1c122 (patch) | |
tree | ad16041f0f4e614e6212cf4c2cae8e34c6896c77 /src/imports/audioengine/qdeclarative_audiosample_p.cpp | |
parent | 51d6b5c811c0e55888ae2e8404bd92f94d5a5aac (diff) |
[QSoundBuffer] Replace isReady() with state() states
The two-state "isReady" is not enough for checking if loading was
already requested.
This also makes it abvious we're accepting load() after error.
Change-Id: I8181f99e8b36be484ec791862941b5b2ec78eb1f
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/imports/audioengine/qdeclarative_audiosample_p.cpp')
-rw-r--r-- | src/imports/audioengine/qdeclarative_audiosample_p.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/imports/audioengine/qdeclarative_audiosample_p.cpp b/src/imports/audioengine/qdeclarative_audiosample_p.cpp index e95840711..5a9a67b71 100644 --- a/src/imports/audioengine/qdeclarative_audiosample_p.cpp +++ b/src/imports/audioengine/qdeclarative_audiosample_p.cpp @@ -153,7 +153,7 @@ bool QDeclarativeAudioSample::isLoaded() const { if (!m_soundBuffer) return false; - return m_soundBuffer->isReady(); + return m_soundBuffer->state() == QSoundBuffer::Ready; } /*! @@ -163,13 +163,12 @@ bool QDeclarativeAudioSample::isLoaded() const */ void QDeclarativeAudioSample::load() { - if (isLoaded()) - return; if (!m_soundBuffer) { m_preloaded = true; return; } - m_soundBuffer->load(); + if (m_soundBuffer->state() != QSoundBuffer::Loading && m_soundBuffer->state() != QSoundBuffer::Ready) + m_soundBuffer->load(); } void QDeclarativeAudioSample::setPreloaded(bool preloaded) @@ -218,7 +217,7 @@ void QDeclarativeAudioSample::init() } else { m_soundBuffer = qobject_cast<QDeclarativeAudioEngine*>(parent())->engine()->getStaticSoundBuffer(m_url); - if (m_soundBuffer->isReady()) { + if (m_soundBuffer->state() == QSoundBuffer::Ready) { emit loadedChanged(); } else { connect(m_soundBuffer, SIGNAL(ready()), this, SIGNAL(loadedChanged())); |