diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-02-05 01:11:29 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-02-05 01:11:29 (GMT) |
commit | e6c91eacfefcaf9cab83f5cb82d1487b8a870117 (patch) | |
tree | 64672c65e9ce1c90e8109a7d6cda0276bdc68278 /src/multimedia/qml | |
parent | 275d642215388013247e07d4b351be88422bff41 (diff) | |
download | Qt-e6c91eacfefcaf9cab83f5cb82d1487b8a870117.zip Qt-e6c91eacfefcaf9cab83f5cb82d1487b8a870117.tar.gz Qt-e6c91eacfefcaf9cab83f5cb82d1487b8a870117.tar.bz2 |
Propagate error signals from QMediaPlayerControl to media QML elements.
Diffstat (limited to 'src/multimedia/qml')
-rw-r--r-- | src/multimedia/qml/qmlaudio.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/qml/qmlaudio_p.h | 4 | ||||
-rw-r--r-- | src/multimedia/qml/qmlgraphicsvideo.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/qml/qmlgraphicsvideo_p.h | 4 | ||||
-rw-r--r-- | src/multimedia/qml/qmlmediabase.cpp | 9 | ||||
-rw-r--r-- | src/multimedia/qml/qmlmediabase_p.h | 4 |
6 files changed, 20 insertions, 9 deletions
diff --git a/src/multimedia/qml/qmlaudio.cpp b/src/multimedia/qml/qmlaudio.cpp index 713e36a..adff49b 100644 --- a/src/multimedia/qml/qmlaudio.cpp +++ b/src/multimedia/qml/qmlaudio.cpp @@ -58,9 +58,9 @@ QML_DEFINE_TYPE(Qt,4,6,Audio,QmlAudio); \brief The QmlAudio class provides a audio item that you can add to a QmlView. */ -void QmlAudio::_q_error(QMediaPlayer::Error errorCode, const QString &errorString) +void QmlAudio::_q_error(int errorCode, const QString &errorString) { - m_error = errorCode; + m_error = QMediaPlayer::Error(errorCode); m_errorString = errorString; emit error(Error(errorCode), errorString); diff --git a/src/multimedia/qml/qmlaudio_p.h b/src/multimedia/qml/qmlaudio_p.h index c6ab53d..f034518 100644 --- a/src/multimedia/qml/qmlaudio_p.h +++ b/src/multimedia/qml/qmlaudio_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE class QTimerEvent; -class QmlAudio : public QObject, public QmlMediaBase, public QmlParserStatus +class Q_AUTOTEST_EXPORT QmlAudio : public QObject, public QmlMediaBase, public QmlParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) @@ -142,7 +142,7 @@ Q_SIGNALS: void error(QmlAudio::Error error, const QString &errorString); private Q_SLOTS: - void _q_error(QMediaPlayer::Error, const QString &); + void _q_error(int, const QString &); private: Q_DISABLE_COPY(QmlAudio) diff --git a/src/multimedia/qml/qmlgraphicsvideo.cpp b/src/multimedia/qml/qmlgraphicsvideo.cpp index c96f7e9..784c7b6 100644 --- a/src/multimedia/qml/qmlgraphicsvideo.cpp +++ b/src/multimedia/qml/qmlgraphicsvideo.cpp @@ -59,9 +59,9 @@ void QmlGraphicsVideo::_q_nativeSizeChanged(const QSizeF &size) setImplicitHeight(size.height()); } -void QmlGraphicsVideo::_q_error(QMediaPlayer::Error errorCode, const QString &errorString) +void QmlGraphicsVideo::_q_error(int errorCode, const QString &errorString) { - m_error = errorCode; + m_error = QMediaPlayer::Error(errorCode); m_errorString = errorString; emit error(Error(errorCode), errorString); diff --git a/src/multimedia/qml/qmlgraphicsvideo_p.h b/src/multimedia/qml/qmlgraphicsvideo_p.h index d89de8c..4592e31 100644 --- a/src/multimedia/qml/qmlgraphicsvideo_p.h +++ b/src/multimedia/qml/qmlgraphicsvideo_p.h @@ -58,7 +58,7 @@ class QTimerEvent; class QVideoSurfaceFormat; -class QmlGraphicsVideo : public QmlGraphicsItem, public QmlMediaBase +class Q_AUTOTEST_EXPORT QmlGraphicsVideo : public QmlGraphicsItem, public QmlMediaBase { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) @@ -170,7 +170,7 @@ protected: private Q_SLOTS: void _q_nativeSizeChanged(const QSizeF &size); - void _q_error(QMediaPlayer::Error, const QString &); + void _q_error(int, const QString &); private: Q_DISABLE_COPY(QmlGraphicsVideo) diff --git a/src/multimedia/qml/qmlmediabase.cpp b/src/multimedia/qml/qmlmediabase.cpp index 4b42058..17ec8a6 100644 --- a/src/multimedia/qml/qmlmediabase.cpp +++ b/src/multimedia/qml/qmlmediabase.cpp @@ -270,6 +270,8 @@ void QmlMediaBase::setObject(QObject *object) object, SIGNAL(seekableChanged())); QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), object, SIGNAL(playbackRateChanged())); + QObject::connect(m_playerControl, SIGNAL(error(int,QString)), + object, SLOT(_q_error(int,QString))); m_animation = new QmlMediaBaseAnimation(this); } else { @@ -293,6 +295,13 @@ QUrl QmlMediaBase::source() const void QmlMediaBase::setSource(const QUrl &url) { + if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) { + m_error = QMediaPlayer::NoError; + m_errorString = QString(); + + emit errorChanged(); + } + m_playerControl->setMedia(QMediaContent(url), 0); } diff --git a/src/multimedia/qml/qmlmediabase_p.h b/src/multimedia/qml/qmlmediabase_p.h index 3b5c398..d6c0a00 100644 --- a/src/multimedia/qml/qmlmediabase_p.h +++ b/src/multimedia/qml/qmlmediabase_p.h @@ -57,7 +57,7 @@ class QMetaDataControl; class QMetaDataControlMetaObject; class QmlMediaBaseAnimation; -class QmlMediaBase +class Q_AUTOTEST_EXPORT QmlMediaBase { public: QmlMediaBase(); @@ -131,6 +131,8 @@ protected: virtual void seekableChanged() = 0; virtual void playbackRateChanged() = 0; + virtual void errorChanged() = 0; + QMediaService *m_mediaService; QMediaPlayerControl *m_playerControl; |