summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-06 14:29:20 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-03 03:21:43 +0100
commit78ffd1bc18ecaf5c989187f89fba82dd53503ecc (patch)
treed330232da42c89b3b16a2ad3ab58c76eb9c3c576 /src
parent4bbe267f303f379311a2d8f98aa8dfcf173b1ad6 (diff)
Remove QMediaImageViewer (SC break).
This class has turned out to be not very useful at this point in time. Change-Id: Ic07132bdcd01a912a6dd1160c867979fd1307b6a Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/multimedia/imageviewer/imageviewer.pri13
-rw-r--r--src/multimedia/imageviewer/qmediaimageviewer.cpp596
-rw-r--r--src/multimedia/imageviewer/qmediaimageviewer.h142
-rw-r--r--src/multimedia/imageviewer/qmediaimageviewerservice.cpp458
-rw-r--r--src/multimedia/imageviewer/qmediaimageviewerservice_p.h147
-rw-r--r--src/multimedia/multimedia.pro1
-rw-r--r--src/multimedia/playback/qmediaplaylist.cpp2
7 files changed, 1 insertions, 1358 deletions
diff --git a/src/multimedia/imageviewer/imageviewer.pri b/src/multimedia/imageviewer/imageviewer.pri
deleted file mode 100644
index 409615c7e..000000000
--- a/src/multimedia/imageviewer/imageviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-
-INCLUDEPATH += imageviewer
-
-PUBLIC_HEADERS += \
- imageviewer/qmediaimageviewer.h
-
-PRIVATE_HEADERS += \
- imageviewer/qmediaimageviewerservice_p.h
-
-SOURCES += \
- imageviewer/qmediaimageviewer.cpp \
- imageviewer/qmediaimageviewerservice.cpp
-
diff --git a/src/multimedia/imageviewer/qmediaimageviewer.cpp b/src/multimedia/imageviewer/qmediaimageviewer.cpp
deleted file mode 100644
index a965a74ac..000000000
--- a/src/multimedia/imageviewer/qmediaimageviewer.cpp
+++ /dev/null
@@ -1,596 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaimageviewer.h"
-
-#include "qmediaobject_p.h"
-#include "qmediaimageviewerservice_p.h"
-
-#include <qmediaplaylist.h>
-#include <qmediaplaylistsourcecontrol.h>
-#include <qmediacontent.h>
-#include <qmediaresource.h>
-#include "qvideosurfaceoutput_p.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qtextstream.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace
-{
- class QMediaImageViewerPrivateRegisterMetaTypes
- {
- public:
- QMediaImageViewerPrivateRegisterMetaTypes()
- {
- qRegisterMetaType<QMediaImageViewer::MediaStatus>();
- qRegisterMetaType<QMediaImageViewer::State>();
- }
- } _registerMetaTypes;
-}
-
-class QMediaImageViewerPrivate : public QMediaObjectPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaImageViewer)
-public:
- QMediaImageViewerPrivate():
- viewerControl(0), playlist(0),
- state(QMediaImageViewer::StoppedState), timeout(3000), pauseTime(0)
- {
- }
-
- void _q_mediaStatusChanged(QMediaImageViewer::MediaStatus status);
- void _q_playlistMediaChanged(const QMediaContent &content);
- void _q_playlistDestroyed();
-
- QMediaImageViewerControl *viewerControl;
- QMediaPlaylist *playlist;
- QPointer<QObject> videoOutput;
- QVideoSurfaceOutput surfaceOutput;
- QMediaImageViewer::State state;
- int timeout;
- int pauseTime;
- QTime time;
- QBasicTimer timer;
- QMediaContent media;
-};
-
-void QMediaImageViewerPrivate::_q_mediaStatusChanged(QMediaImageViewer::MediaStatus status)
-{
- switch (status) {
- case QMediaImageViewer::NoMedia:
- case QMediaImageViewer::LoadingMedia:
- emit q_func()->mediaStatusChanged(status);
- break;
- case QMediaImageViewer::LoadedMedia:
- if (state == QMediaImageViewer::PlayingState) {
- time.start();
- timer.start(qMax(0, timeout), q_func());
- q_func()->addPropertyWatch("elapsedTime");
- }
- emit q_func()->mediaStatusChanged(status);
- emit q_func()->elapsedTimeChanged(0);
- break;
- case QMediaImageViewer::InvalidMedia:
- emit q_func()->mediaStatusChanged(status);
-
- if (state == QMediaImageViewer::PlayingState) {
- playlist->next();
- if (playlist->currentIndex() < 0)
- emit q_func()->stateChanged(state = QMediaImageViewer::StoppedState);
- }
- break;
- }
-}
-
-void QMediaImageViewerPrivate::_q_playlistMediaChanged(const QMediaContent &content)
-{
- media = content;
- pauseTime = 0;
-
- viewerControl->showMedia(media);
-
- emit q_func()->mediaChanged(media);
-}
-
-void QMediaImageViewerPrivate::_q_playlistDestroyed()
-{
- playlist = 0;
- timer.stop();
-
- if (state != QMediaImageViewer::StoppedState)
- emit q_func()->stateChanged(state = QMediaImageViewer::StoppedState);
-
- q_func()->setMedia(QMediaContent());
-}
-
-/*!
- \class QMediaImageViewer
- \brief The QMediaImageViewer class provides a means of viewing image media.
- \inmodule QtMultimedia
- \ingroup multimedia
-
-
- QMediaImageViewer is used together with a media display object such as
- QVideoWidget to present an image. A display object is attached to the
- image viewer by means of the bind function.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Binding
-
- QMediaImageViewer can be paired with a QMediaPlaylist to create a slide
- show of images. Constructing a QMediaPlaylist with a pointer to an
- instance of QMediaImageViewer will attach it to the image viewer;
- changing the playlist's selection will then change the media displayed
- by the image viewer. With a playlist attached QMediaImageViewer's
- play(), pause(), and stop() slots can be control the progression of the
- playlist. The \l timeout property determines how long an image is
- displayed for before progressing to the next in the playlist, and the
- \l elapsedTime property holds how the duration the current image has
- been displayed for.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Playlist
-*/
-
-/*!
- \enum QMediaImageViewer::State
-
- Enumerates the possible control states an image viewer may be in. The
- control state of an image viewer determines whether the image viewer is
- automatically progressing through images in an attached playlist.
-
- \value StoppedState The image viewer is stopped, and will not automatically move to the next
- image. The \l elapsedTime is fixed at 0.
- \value PlayingState The slide show is playing, and will move to the next image when the
- \l elapsedTime reaches the \l timeout. The \l elapsedTime is being incremented.
- \value PausedState The image viewer is paused, and will not automatically move the to next
- image. The \l elapsedTime is fixed at the time the image viewer was paused.
-*/
-
-/*!
- \enum QMediaImageViewer::MediaStatus
-
- Enumerates the status of an image viewer's current media.
-
- \value NoMedia There is no current media.
- \value LoadingMedia The image viewer is loading the current media.
- \value LoadedMedia The image viewer has loaded the current media.
- \value InvalidMedia The current media cannot be loaded.
-*/
-
-/*!
- Constructs a new image viewer with the given \a parent.
-*/
-QMediaImageViewer::QMediaImageViewer(QObject *parent)
- : QMediaObject(*new QMediaImageViewerPrivate, parent, new QMediaImageViewerService)
-{
- Q_D(QMediaImageViewer);
-
- d->viewerControl = qobject_cast<QMediaImageViewerControl*>(
- d->service->requestControl(QMediaImageViewerControl_iid));
-
- connect(d->viewerControl, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- this, SLOT(_q_mediaStatusChanged(QMediaImageViewer::MediaStatus)));
-}
-
-/*!
- Destroys an image viewer.
-*/
-QMediaImageViewer::~QMediaImageViewer()
-{
- Q_D(QMediaImageViewer);
-
- delete d->service;
-}
-
-/*!
- \property QMediaImageViewer::state
- \brief the playlist control state of a slide show.
-*/
-
-QMediaImageViewer::State QMediaImageViewer::state() const
-{
- return d_func()->state;
-}
-
-/*!
- \fn QMediaImageViewer::stateChanged(QMediaImageViewer::State state)
-
- Signals that the playlist control \a state of an image viewer has changed.
-*/
-
-/*!
- \property QMediaImageViewer::mediaStatus
- \brief the status of the current media.
-*/
-
-QMediaImageViewer::MediaStatus QMediaImageViewer::mediaStatus() const
-{
- return d_func()->viewerControl->mediaStatus();
-}
-
-/*!
- \fn QMediaImageViewer::mediaStatusChanged(QMediaImageViewer::MediaStatus status)
-
- Signals the the \a status of the current media has changed.
-*/
-
-/*!
- \property QMediaImageViewer::media
- \brief the media an image viewer is presenting.
-*/
-
-QMediaContent QMediaImageViewer::media() const
-{
- Q_D(const QMediaImageViewer);
-
- return d->media;
-}
-
-void QMediaImageViewer::setMedia(const QMediaContent &media)
-{
- Q_D(QMediaImageViewer);
-
- if (d->playlist && d->playlist->currentMedia() != media) {
- disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_playlistMediaChanged(QMediaContent)));
- disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- d->playlist = 0;
- }
-
- d->media = media;
-
- if (d->timer.isActive()) {
- d->pauseTime = 0;
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- emit elapsedTimeChanged(0);
- }
-
- if (d->state != QMediaImageViewer::StoppedState)
- emit stateChanged(d->state = QMediaImageViewer::StoppedState);
-
- d->viewerControl->showMedia(d->media);
-
- emit mediaChanged(d->media);
-}
-
-/*!
- Use \a playlist as the source of images to be displayed in the viewer.
-*/
-void QMediaImageViewer::setPlaylist(QMediaPlaylist *playlist)
-{
- Q_D(QMediaImageViewer);
-
- if (d->playlist) {
- disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_playlistMediaChanged(QMediaContent)));
- disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- QMediaObject::unbind(d->playlist);
- }
-
- d->playlist = playlist;
-
- if (d->playlist) {
- connect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_playlistMediaChanged(QMediaContent)));
- connect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- QMediaObject::bind(d->playlist);
-
- setMedia(d->playlist->currentMedia());
- } else {
- setMedia(QMediaContent());
- }
-}
-
-/*!
- Returns the current playlist, or 0 if none.
-*/
-QMediaPlaylist *QMediaImageViewer::playlist() const
-{
- return d_func()->playlist;
-}
-
-/*!
- \fn QMediaImageViewer::mediaChanged(const QMediaContent &media)
-
- Signals that the \a media an image viewer is presenting has changed.
-*/
-
-/*!
- \property QMediaImageViewer::timeout
- \brief the amount of time in milliseconds an image is displayed for before moving to the next
- image.
-
- The timeout only applies if the image viewer has a playlist attached and is in the PlayingState.
-*/
-
-int QMediaImageViewer::timeout() const
-{
- return d_func()->timeout;
-}
-
-void QMediaImageViewer::setTimeout(int timeout)
-{
- Q_D(QMediaImageViewer);
-
- d->timeout = qMax(0, timeout);
-
- if (d->timer.isActive())
- d->timer.start(qMax(0, d->timeout - d->pauseTime - d->time.elapsed()), this);
-}
-
-/*!
- \property QMediaImageViewer::elapsedTime
- \brief the amount of time in milliseconds that has elapsed since the current image was loaded.
-
- The elapsed time only increases while the image viewer is in the PlayingState. If stopped the
- elapsed time will be reset to 0.
-*/
-
-int QMediaImageViewer::elapsedTime() const
-{
- Q_D(const QMediaImageViewer);
-
- int elapsedTime = d->pauseTime;
-
- if (d->timer.isActive())
- elapsedTime += d->time.elapsed();
-
- return elapsedTime;
-}
-
-/*!
- \fn QMediaImageViewer::elapsedTimeChanged(int time)
-
- Signals that the amount of \a time in milliseconds since the current
- image was loaded has changed.
-
- This signal is emitted at a regular interval when the image viewer is
- in the PlayingState and an image is loaded. The notification interval
- is controlled by the QMediaObject::notifyInterval property.
-
- \sa timeout, QMediaObject::notifyInterval
-*/
-
-/*!
- Sets a video \a widget as the current video output.
-
- This will unbind any previous video output bound with setVideoOutput().
-*/
-
-void QMediaImageViewer::setVideoOutput(QVideoWidget *widget)
-{
- Q_D(QMediaImageViewer);
-
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- // We don't know (in this library) that QVideoWidget inherits QObject
- QObject *widgetObject = reinterpret_cast<QObject*>(widget);
-
- d->videoOutput = widgetObject && bind(widgetObject) ? widgetObject : 0;
-}
-
-/*!
- Sets a video \a item as the current video output.
-
- This will unbind any previous video output bound with setVideoOutput().
-*/
-
-void QMediaImageViewer::setVideoOutput(QGraphicsVideoItem *item)
-{
- Q_D(QMediaImageViewer);
-
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject
- // but QObject inheritance depends on QObject coming first, so try this out.
- QObject *itemObject = reinterpret_cast<QObject*>(item);
-
- d->videoOutput = itemObject && bind(itemObject) ? itemObject : 0;
-}
-
-/*!
- Sets a video \a surface as the video output of a image viewer.
-
- If a video output has already been set on the image viewer the new surface
- will replace it.
-*/
-
-void QMediaImageViewer::setVideoOutput(QAbstractVideoSurface *surface)
-{
- Q_D(QMediaImageViewer);
-
- d->surfaceOutput.setVideoSurface(surface);
-
- if (d->videoOutput != &d->surfaceOutput) {
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- d->videoOutput = bind(&d->surfaceOutput) ? &d->surfaceOutput : 0;
- }
-}
-
-/*!
- \internal
-*/
-bool QMediaImageViewer::bind(QObject *object)
-{
- if (QMediaPlaylist *playlist = qobject_cast<QMediaPlaylist *>(object)) {
- setPlaylist(playlist);
-
- return true;
- } else {
- return QMediaObject::bind(object);
- }
-}
-
-/*!
- \internal
- */
-void QMediaImageViewer::unbind(QObject *object)
-{
- if (object == d_func()->playlist)
- setPlaylist(0);
- else
- QMediaObject::unbind(object);
-}
-
-/*!
- Starts a slide show.
-
- If the playlist has no current media this will start at the beginning of the playlist, otherwise
- it will resume from the current media.
-
- If no playlist is attached to an image viewer this will do nothing.
-*/
-void QMediaImageViewer::play()
-{
- Q_D(QMediaImageViewer);
-
- if (d->playlist && d->playlist->mediaCount() > 0 && d->state != PlayingState) {
- d->state = PlayingState;
-
- switch (d->viewerControl->mediaStatus()) {
- case NoMedia:
- case InvalidMedia:
- d->playlist->next();
- if (d->playlist->currentIndex() < 0)
- d->state = StoppedState;
- break;
- case LoadingMedia:
- break;
- case LoadedMedia:
- d->time.start();
- d->timer.start(qMax(0, d->timeout - d->pauseTime), this);
- break;
- }
-
- if (d->state == PlayingState)
- emit stateChanged(d->state);
- }
-}
-
-/*!
- Pauses a slide show.
-
- The current media and elapsed time are retained. If resumed, the current image will be
- displayed for the remainder of the time out period before the next image is loaded.
-*/
-void QMediaImageViewer::pause()
-{
- Q_D(QMediaImageViewer);
-
- if (d->state == PlayingState) {
- if (d->viewerControl->mediaStatus() == LoadedMedia) {
- d->pauseTime += d->timeout - d->time.elapsed();
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- }
-
- emit stateChanged(d->state = PausedState);
- emit elapsedTimeChanged(d->pauseTime);
- }
-}
-
-/*!
- Stops a slide show.
-
- The current media is retained, but the elapsed time is discarded. If resumed, the current
- image will be displayed for the full time out period before the next image is loaded.
-*/
-void QMediaImageViewer::stop()
-{
- Q_D(QMediaImageViewer);
-
- switch (d->state) {
- case PlayingState:
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- // fall through.
- case PausedState:
- d->pauseTime = 0;
- d->state = QMediaImageViewer::StoppedState;
-
- emit stateChanged(d->state);
- emit elapsedTimeChanged(0);
- break;
- case StoppedState:
- break;
- }
-}
-
-/*!
- \reimp
-
- \internal
-*/
-void QMediaImageViewer::timerEvent(QTimerEvent *event)
-{
- Q_D(QMediaImageViewer);
-
- if (event->timerId() == d->timer.timerId()) {
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- emit elapsedTimeChanged(d->pauseTime = d->timeout);
-
- d->playlist->next();
-
- if (d->playlist->currentIndex() < 0) {
- d->pauseTime = 0;
- emit stateChanged(d->state = StoppedState);
- emit elapsedTimeChanged(0);
- }
- } else {
- QMediaObject::timerEvent(event);
- }
-}
-
-#include "moc_qmediaimageviewer.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/imageviewer/qmediaimageviewer.h b/src/multimedia/imageviewer/qmediaimageviewer.h
deleted file mode 100644
index d853402c6..000000000
--- a/src/multimedia/imageviewer/qmediaimageviewer.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAIMAGEVIEWER_H
-#define QMEDIAIMAGEVIEWER_H
-
-#include "qmediaobject.h"
-#include "qmediacontent.h"
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractVideoSurface;
-class QGraphicsVideoItem;
-class QMediaPlaylist;
-class QVideoWidget;
-
-class QMediaImageViewerPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaImageViewer : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(State state READ state NOTIFY stateChanged)
- Q_PROPERTY(MediaStatus mediaStatus READ mediaStatus NOTIFY mediaStatusChanged)
- Q_PROPERTY(QMediaContent media READ media WRITE setMedia NOTIFY mediaChanged)
- Q_PROPERTY(int timeout READ timeout WRITE setTimeout)
- Q_PROPERTY(int elapsedTime READ elapsedTime NOTIFY elapsedTimeChanged)
- Q_ENUMS(State MediaStatus)
-
-public:
- enum State
- {
- StoppedState,
- PlayingState,
- PausedState
- };
-
- enum MediaStatus
- {
- NoMedia,
- LoadingMedia,
- LoadedMedia,
- InvalidMedia
- };
-
- explicit QMediaImageViewer(QObject *parent = 0);
- ~QMediaImageViewer();
-
- State state() const;
- MediaStatus mediaStatus() const;
-
- QMediaContent media() const;
- QMediaPlaylist *playlist() const;
-
- int timeout() const;
- int elapsedTime() const;
-
- void setVideoOutput(QVideoWidget *widget);
- void setVideoOutput(QGraphicsVideoItem *item);
- void setVideoOutput(QAbstractVideoSurface *surface);
-
- bool bind(QObject *);
- void unbind(QObject *);
-
-public Q_SLOTS:
- void setMedia(const QMediaContent &media);
- void setPlaylist(QMediaPlaylist *playlist);
-
- void play();
- void pause();
- void stop();
-
- void setTimeout(int timeout);
-
-Q_SIGNALS:
- void stateChanged(QMediaImageViewer::State state);
- void mediaStatusChanged(QMediaImageViewer::MediaStatus status);
- void mediaChanged(const QMediaContent &media);
- void elapsedTimeChanged(int time);
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- Q_DECLARE_PRIVATE(QMediaImageViewer)
- Q_PRIVATE_SLOT(d_func(), void _q_mediaStatusChanged(QMediaImageViewer::MediaStatus))
- Q_PRIVATE_SLOT(d_func(), void _q_playlistMediaChanged(const QMediaContent &))
- Q_PRIVATE_SLOT(d_func(), void _q_playlistDestroyed())
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaImageViewer::State)
-Q_DECLARE_METATYPE(QMediaImageViewer::MediaStatus)
-
-Q_MEDIA_ENUM_DEBUG(QMediaImageViewer, State)
-Q_MEDIA_ENUM_DEBUG(QMediaImageViewer, MediaStatus)
-
-QT_END_HEADER
-
-#endif
diff --git a/src/multimedia/imageviewer/qmediaimageviewerservice.cpp b/src/multimedia/imageviewer/qmediaimageviewerservice.cpp
deleted file mode 100644
index 21ef4e443..000000000
--- a/src/multimedia/imageviewer/qmediaimageviewerservice.cpp
+++ /dev/null
@@ -1,458 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaimageviewerservice_p.h"
-
-#include "qmediacontrol_p.h"
-#include "qmediaservice_p.h"
-
-#include <qmediacontent.h>
-#include <qmediaresource.h>
-#include "qmediaobject_p.h"
-#include <qvideorenderercontrol.h>
-
-#include <QtCore/qdebug.h>
-
-#include <QtCore/qurl.h>
-#include <QtGui/qimagereader.h>
-
-#include <QtNetwork/qnetworkaccessmanager.h>
-#include <QtNetwork/qnetworkreply.h>
-#include <QtNetwork/qnetworkrequest.h>
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMediaImageViewerServicePrivate : public QMediaServicePrivate
-{
-public:
- QMediaImageViewerServicePrivate()
- : viewerControl(0)
- , rendererControl(0)
- , network(0)
- , internalNetwork(0)
- {
- }
-
- bool load(QIODevice *device);
- void clear();
-
- QMediaImageViewerControl *viewerControl;
- QMediaImageViewerRenderer *rendererControl;
- QNetworkAccessManager *network;
- QNetworkAccessManager *internalNetwork;
- QImage m_image;
-};
-
-
-QMediaImageViewerRenderer::QMediaImageViewerRenderer(QObject *parent)
- : QVideoRendererControl(parent)
- , m_surface(0)
-{
-}
-
-QMediaImageViewerRenderer::~QMediaImageViewerRenderer()
-{
- if (m_surface)
- m_surface->stop();
-}
-
-QAbstractVideoSurface *QMediaImageViewerRenderer::surface() const
-{
- return m_surface;
-}
-
-void QMediaImageViewerRenderer::setSurface(QAbstractVideoSurface *surface)
-{
- if (m_surface)
- m_surface->stop();
-
- m_surface = surface;
-
- if (m_surface && !m_image.isNull())
- showImage(m_image);
-}
-
-void QMediaImageViewerRenderer::showImage(const QImage &image)
-{
- m_image = image;
-
- if (m_surface) {
- if (m_image.isNull()) {
- m_surface->stop();
- } else {
- QVideoSurfaceFormat format(
- image.size(), QVideoFrame::pixelFormatFromImageFormat(image.format()));
-
- if (!m_surface->isFormatSupported(format)) {
- foreach (QVideoFrame::PixelFormat pixelFormat, m_surface->supportedPixelFormats()) {
- const QImage::Format imageFormat
- = QVideoFrame::imageFormatFromPixelFormat(pixelFormat);
-
- if (imageFormat != QImage::Format_Invalid) {
- format = QVideoSurfaceFormat(image.size(), pixelFormat);
-
- if (m_surface->isFormatSupported(format) && m_surface->start(format)) {
- m_image = image.convertToFormat(imageFormat);
-
- m_surface->present(QVideoFrame(m_image));
-
- return;
- }
- }
- }
- } else if (m_surface->start(format)) {
- m_surface->present(QVideoFrame(image));
- }
- }
- }
-}
-
-bool QMediaImageViewerServicePrivate::load(QIODevice *device)
-{
- QImageReader reader(device);
-
- if (!reader.canRead()) {
- m_image = QImage();
- } else {
- m_image = reader.read();
- }
-
- if (rendererControl)
- rendererControl->showImage(m_image);
-
- return !m_image.isNull();
-}
-
-void QMediaImageViewerServicePrivate::clear()
-{
- m_image = QImage();
-
- if (rendererControl)
- rendererControl->showImage(m_image);
-}
-
-/*!
- \class QMediaImageViewerService
- \internal
-*/
-
-/*!
-*/
-QMediaImageViewerService::QMediaImageViewerService(QObject *parent)
- : QMediaService(*new QMediaImageViewerServicePrivate, parent)
-{
- Q_D(QMediaImageViewerService);
-
- d->viewerControl = new QMediaImageViewerControl(this);
-}
-
-/*!
-*/
-QMediaImageViewerService::~QMediaImageViewerService()
-{
- Q_D(QMediaImageViewerService);
-
- delete d->rendererControl;
- delete d->viewerControl;
-}
-
-/*!
-*/
-QMediaControl *QMediaImageViewerService::requestControl(const char *name)
-{
- Q_D(QMediaImageViewerService);
-
- if (qstrcmp(name, QMediaImageViewerControl_iid) == 0) {
- return d->viewerControl;
- } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
- if (!d->rendererControl) {
- d->rendererControl = new QMediaImageViewerRenderer;
- d->rendererControl->showImage(d->m_image);
-
- return d->rendererControl;
- }
- }
- return 0;
-}
-
-void QMediaImageViewerService::releaseControl(QMediaControl *control)
-{
- Q_D(QMediaImageViewerService);
-
- if (!control) {
- qWarning("QMediaService::releaseControl():"
- " Attempted release of null control");
- } else if (control == d->rendererControl) {
- delete d->rendererControl;
-
- d->rendererControl = 0;
- }
-}
-
-/*!
-*/
-QNetworkAccessManager *QMediaImageViewerService::networkManager() const
-{
- Q_D(const QMediaImageViewerService);
-
- if (!d->network) {
- QMediaImageViewerServicePrivate *_d = const_cast<QMediaImageViewerServicePrivate *>(d);
-
- if (!_d->internalNetwork)
- _d->internalNetwork = new QNetworkAccessManager(
- const_cast<QMediaImageViewerService *>(this));
-
- _d->network = d->internalNetwork;
- }
-
- return d->network;
-}
-
-
-void QMediaImageViewerService::setNetworkManager(QNetworkAccessManager *manager)
-{
- d_func()->network = manager;
-}
-
-class QMediaImageViewerControlPrivate : public QMediaControlPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaImageViewerControl)
-public:
- QMediaImageViewerControlPrivate()
- : service(0)
- , getReply(0)
- , headReply(0)
- , status(QMediaImageViewer::NoMedia)
- {
- foreach (const QByteArray &format, QImageReader::supportedImageFormats()) {
- supportedExtensions.append(
- QLatin1Char('.') + QString::fromLatin1(format.data(), format.size()));
- }
- }
-
- bool isImageType(const QUrl &url, const QString &mimeType) const;
-
- void loadImage();
- void cancelRequests();
-
- void _q_getFinished();
- void _q_headFinished();
-
- QMediaImageViewerService *service;
- QNetworkReply *getReply;
- QNetworkReply *headReply;
- QMediaImageViewer::MediaStatus status;
- QMediaContent media;
- QMediaResource currentMedia;
- QList<QMediaResource> possibleResources;
- QStringList supportedExtensions;
-};
-
-bool QMediaImageViewerControlPrivate::isImageType(const QUrl &url, const QString &mimeType) const
-{
- if (!mimeType.isEmpty()) {
- return mimeType.startsWith(QLatin1String("image/"))
- || mimeType == QLatin1String("application/xml+svg");
- } else if (url.scheme() == QLatin1String("file")) {
- QString path = url.path();
-
- foreach (const QString &extension, supportedExtensions) {
- if (path.endsWith(extension, Qt::CaseInsensitive))
- return true;
- }
- }
- return false;
-}
-
-void QMediaImageViewerControlPrivate::loadImage()
-{
- cancelRequests();
-
- QMediaImageViewer::MediaStatus currentStatus = status;
- status = QMediaImageViewer::InvalidMedia;
-
- QNetworkAccessManager *network = service->networkManager();
-
- while (!possibleResources.isEmpty() && !headReply && !getReply) {
- currentMedia = possibleResources.takeFirst();
-
- QUrl url = currentMedia.url();
- QString mimeType = currentMedia.mimeType();
-
- if (isImageType(url, mimeType)) {
- getReply = network->get(QNetworkRequest(url));
- QObject::connect(getReply, SIGNAL(finished()), q_func(), SLOT(_q_getFinished()));
-
- status = QMediaImageViewer::LoadingMedia;
- } else if (mimeType.isEmpty() && url.scheme() != QLatin1String("file")) {
- headReply = network->head(QNetworkRequest(currentMedia.url()));
- QObject::connect(headReply, SIGNAL(finished()), q_func(), SLOT(_q_headFinished()));
-
- status = QMediaImageViewer::LoadingMedia;
- }
- }
-
- if (status == QMediaImageViewer::InvalidMedia)
- currentMedia = QMediaResource();
-
- if (status != currentStatus)
- emit q_func()->mediaStatusChanged(status);
-}
-
-void QMediaImageViewerControlPrivate::cancelRequests()
-{
- if (getReply) {
- getReply->abort();
- getReply->deleteLater();
- getReply = 0;
- }
-
- if (headReply) {
- headReply->abort();
- headReply->deleteLater();
- headReply = 0;
- }
-}
-
-void QMediaImageViewerControlPrivate::_q_getFinished()
-{
- if (getReply != q_func()->sender())
- return;
-
- QImage image;
-
- if (service->d_func()->load(getReply)) {
- possibleResources.clear();
-
- status = QMediaImageViewer::LoadedMedia;
-
- emit q_func()->mediaStatusChanged(status);
- } else {
- loadImage();
- }
-}
-
-void QMediaImageViewerControlPrivate::_q_headFinished()
-{
- if (headReply != q_func()->sender())
- return;
-
- QString mimeType = headReply->header(QNetworkRequest::ContentTypeHeader)
- .toString().section(QLatin1Char(';'), 0, 0);
- QUrl url = headReply->url();
- if (url.isEmpty())
- url = headReply->request().url();
-
- headReply->deleteLater();
- headReply = 0;
-
- if (isImageType(url, mimeType) || mimeType.isEmpty()) {
- QNetworkAccessManager *network = service->networkManager();
-
- getReply = network->get(QNetworkRequest(url));
-
- QObject::connect(getReply, SIGNAL(finished()), q_func(), SLOT(_q_getFinished()));
- } else {
- loadImage();
- }
-}
-
-/*!
- \class QMediaImageViewerControl
- \internal
-*/
-QMediaImageViewerControl::QMediaImageViewerControl(QMediaImageViewerService *parent)
- : QMediaControl(*new QMediaImageViewerControlPrivate, parent)
-{
- Q_D(QMediaImageViewerControl);
-
- d->service = parent;
-}
-
-/*!
-*/
-QMediaImageViewerControl::~QMediaImageViewerControl()
-{
- Q_D(QMediaImageViewerControl);
-
- delete d->getReply;
-}
-
-/*!
-*/
-QMediaImageViewer::MediaStatus QMediaImageViewerControl::mediaStatus() const
-{
- return d_func()->status;
-}
-
-/*!
- \fn QMediaImageViewerControl::mediaStatusChanged(QMediaImageViewer::MediaStatus status);
-*/
-
-/*!
-*/
-void QMediaImageViewerControl::showMedia(const QMediaContent &media)
-{
- Q_D(QMediaImageViewerControl);
-
- d->media = media;
- d->currentMedia = QMediaResource();
- d->cancelRequests();
-
- if (media.isNull()) {
- d->service->d_func()->clear();
- if (d->status != QMediaImageViewer::NoMedia) {
- d->status = QMediaImageViewer::NoMedia;
- emit mediaStatusChanged(d->status);
- }
- } else {
- d->possibleResources = media.resources();
- d->loadImage();
- }
-}
-
-
-#include "moc_qmediaimageviewerservice_p.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/imageviewer/qmediaimageviewerservice_p.h b/src/multimedia/imageviewer/qmediaimageviewerservice_p.h
deleted file mode 100644
index 351721269..000000000
--- a/src/multimedia/imageviewer/qmediaimageviewerservice_p.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIASLIDESHOWSERVICE_P_H
-#define QMEDIASLIDESHOWSERVICE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediadefs.h>
-#include <qmediaservice.h>
-#include <qmediaimageviewer.h>
-#include <qvideorenderercontrol.h>
-
-#include <QtCore/qpointer.h>
-#include <QtGui/qimage.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QAbstractVideoSurface;
-class QNetworkAccessManager;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QMediaImageViewerServicePrivate;
-
-class Q_AUTOTEST_EXPORT QMediaImageViewerService : public QMediaService
-{
- Q_OBJECT
-public:
- explicit QMediaImageViewerService(QObject *parent = 0);
- ~QMediaImageViewerService();
-
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
-
- QNetworkAccessManager *networkManager() const;
- void setNetworkManager(QNetworkAccessManager *manager);
-
-private:
- Q_DECLARE_PRIVATE(QMediaImageViewerService)
- friend class QMediaImageViewerControl;
- friend class QMediaImageViewerControlPrivate;
-};
-
-class QMediaImageViewerControlPrivate;
-
-class QMediaImageViewerControl : public QMediaControl
-{
- Q_OBJECT
-public:
- explicit QMediaImageViewerControl(QMediaImageViewerService *parent);
- ~QMediaImageViewerControl();
-
- QMediaImageViewer::MediaStatus mediaStatus() const;
-
- void showMedia(const QMediaContent &media);
-
-Q_SIGNALS:
- void mediaStatusChanged(QMediaImageViewer::MediaStatus status);
-
-private:
- Q_DECLARE_PRIVATE(QMediaImageViewerControl)
- Q_PRIVATE_SLOT(d_func(), void _q_headFinished())
- Q_PRIVATE_SLOT(d_func(), void _q_getFinished())
-};
-
-#define QMediaImageViewerControl_iid "com.nokia.Qt.QMediaImageViewerControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaImageViewerControl, QMediaImageViewerControl_iid)
-
-class QMediaImageViewerRenderer : public QVideoRendererControl
-{
- Q_OBJECT
-public:
- QMediaImageViewerRenderer(QObject *parent = 0);
- ~QMediaImageViewerRenderer();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- void showImage(const QImage &image);
-
-Q_SIGNALS:
- void surfaceChanged(QAbstractVideoSurface *surface);
-
-private:
- QPointer<QAbstractVideoSurface> m_surface;
- QImage m_image;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 35193307b..ab883d97d 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -52,7 +52,6 @@ SOURCES += \
include(audio/audio.pri)
include(camera/camera.pri)
include(controls/controls.pri)
-include(imageviewer/imageviewer.pri)
include(playback/playback.pri)
include(radio/radio.pri)
include(recording/recording.pri)
diff --git a/src/multimedia/playback/qmediaplaylist.cpp b/src/multimedia/playback/qmediaplaylist.cpp
index 3767f8eac..67db7f554 100644
--- a/src/multimedia/playback/qmediaplaylist.cpp
+++ b/src/multimedia/playback/qmediaplaylist.cpp
@@ -85,7 +85,7 @@ namespace
\brief The QMediaPlaylist class provides a list of media content to play.
QMediaPlaylist is intended to be used with other media objects,
- like QMediaPlayer or QMediaImageViewer.
+ like QMediaPlayer.
QMediaPlaylist allows to access the service intrinsic playlist functionality
if available, otherwise it provides the the local memory playlist implementation.