Fix some MediaPlayer properties returning wrong values.
Once the QML component is complete, don't cache any value anymore and always ask the backend for the actual value. Change-Id: I2c3ad55618e0532f713cfcc8258a70a1114fc975 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
f6e57f80a8
commit
a7b8872cd5
@@ -290,15 +290,15 @@ void QDeclarativeAudio::setVolume(qreal volume)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_vol == volume)
|
if (this->volume() == volume)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_vol = volume;
|
if (m_complete) {
|
||||||
|
|
||||||
if (m_complete)
|
|
||||||
m_player->setVolume(qRound(volume * 100));
|
m_player->setVolume(qRound(volume * 100));
|
||||||
else
|
} else {
|
||||||
|
m_vol = volume;
|
||||||
emit volumeChanged();
|
emit volumeChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeAudio::isMuted() const
|
bool QDeclarativeAudio::isMuted() const
|
||||||
@@ -308,15 +308,15 @@ bool QDeclarativeAudio::isMuted() const
|
|||||||
|
|
||||||
void QDeclarativeAudio::setMuted(bool muted)
|
void QDeclarativeAudio::setMuted(bool muted)
|
||||||
{
|
{
|
||||||
if (m_muted == muted)
|
if (isMuted() == muted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_muted = muted;
|
if (m_complete) {
|
||||||
|
|
||||||
if (m_complete)
|
|
||||||
m_player->setMuted(muted);
|
m_player->setMuted(muted);
|
||||||
else
|
} else {
|
||||||
|
m_muted = muted;
|
||||||
emit mutedChanged();
|
emit mutedChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QDeclarativeAudio::bufferProgress() const
|
qreal QDeclarativeAudio::bufferProgress() const
|
||||||
@@ -331,20 +331,20 @@ bool QDeclarativeAudio::isSeekable() const
|
|||||||
|
|
||||||
qreal QDeclarativeAudio::playbackRate() const
|
qreal QDeclarativeAudio::playbackRate() const
|
||||||
{
|
{
|
||||||
return m_playbackRate;
|
return m_complete ? m_player->playbackRate() : m_playbackRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeAudio::setPlaybackRate(qreal rate)
|
void QDeclarativeAudio::setPlaybackRate(qreal rate)
|
||||||
{
|
{
|
||||||
if (m_playbackRate == rate)
|
if (playbackRate() == rate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_complete) {
|
||||||
|
m_player->setPlaybackRate(rate);
|
||||||
|
} else {
|
||||||
m_playbackRate = rate;
|
m_playbackRate = rate;
|
||||||
|
|
||||||
if (m_complete)
|
|
||||||
m_player->setPlaybackRate(m_playbackRate);
|
|
||||||
else
|
|
||||||
emit playbackRateChanged();
|
emit playbackRateChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QDeclarativeAudio::errorString() const
|
QString QDeclarativeAudio::errorString() const
|
||||||
@@ -426,12 +426,12 @@ void QDeclarativeAudio::seek(int position)
|
|||||||
if (this->position() == position)
|
if (this->position() == position)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_complete) {
|
||||||
|
m_player->setPosition(position);
|
||||||
|
} else {
|
||||||
m_position = position;
|
m_position = position;
|
||||||
|
|
||||||
if (m_complete)
|
|
||||||
m_player->setPosition(m_position);
|
|
||||||
else
|
|
||||||
emit positionChanged();
|
emit positionChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ void tst_QDeclarativeAudio::playbackRate()
|
|||||||
audio.setPlaybackRate(2.0);
|
audio.setPlaybackRate(2.0);
|
||||||
QCOMPARE(audio.playbackRate(), qreal(2.0));
|
QCOMPARE(audio.playbackRate(), qreal(2.0));
|
||||||
QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
|
QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
|
||||||
QCOMPARE(spy.count(), 3);
|
QCOMPARE(spy.count(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDeclarativeAudio::status()
|
void tst_QDeclarativeAudio::status()
|
||||||
|
|||||||
Reference in New Issue
Block a user