From 10888061f86eef9a73fff548b6dc325471cbb809 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 5 Feb 2010 11:02:11 +1000 Subject: Round off volume when converting from real to int. And return a volume of 0 if there's no player control. --- src/multimedia/qml/qmlmediabase.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/multimedia/qml/qmlmediabase.cpp b/src/multimedia/qml/qmlmediabase.cpp index 0f0f1e4..e2a1832 100644 --- a/src/multimedia/qml/qmlmediabase.cpp +++ b/src/multimedia/qml/qmlmediabase.cpp @@ -78,7 +78,7 @@ public: qint64 duration() const { return 0; } qint64 position() const { return 0; } void setPosition(qint64) {} - int volume() const { return 100; } + int volume() const { return 0; } void setVolume(int) {} bool isMuted() const { return false; } void setMuted(bool) {} @@ -267,6 +267,8 @@ void QmlMediaBase::setObject(QObject *object) m_animation = new QmlMediaBaseAnimation(this); } else { + m_error = QMediaPlayer::ServiceMissingError; + m_playerControl = new QmlMediaBasePlayerControl(object); } @@ -337,7 +339,7 @@ qreal QmlMediaBase::volume() const void QmlMediaBase::setVolume(qreal volume) { - m_playerControl->setVolume(volume * 100); + m_playerControl->setVolume(qRound(volume * 100)); } bool QmlMediaBase::isMuted() const -- cgit v0.12