summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-09 00:38:03 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-09 00:38:03 (GMT)
commitc04a6e34b3d4da24d3cc26e192bebff2d3b79d19 (patch)
treee2a5299daa1e53668e7f9adeac002f8fdd286f8a
parent51900441b77df5cb4755aaf2cba8351bbfe15e71 (diff)
parentdb0c932bf816b76547798ec62336e25b453d29b8 (diff)
downloadQt-c04a6e34b3d4da24d3cc26e192bebff2d3b79d19.zip
Qt-c04a6e34b3d4da24d3cc26e192bebff2d3b79d19.tar.gz
Qt-c04a6e34b3d4da24d3cc26e192bebff2d3b79d19.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--demos/mainwindow/mainwindow.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp34
-rw-r--r--src/gui/egl/qegl_x11.cpp12
-rw-r--r--src/gui/kernel/qmime_win.cpp2
-rw-r--r--src/imports/multimedia/multimedia.pro4
-rw-r--r--src/imports/qimportbase.pri2
-rw-r--r--src/imports/webkit/webkit.pro4
-rw-r--r--src/imports/widgets/widgets.pro4
-rw-r--r--src/multimedia/effects/effects.pri4
-rw-r--r--src/multimedia/effects/qsoundeffect.cpp89
-rw-r--r--src/multimedia/effects/qsoundeffect_p.h18
-rw-r--r--src/multimedia/effects/qsoundeffect_pulse_p.cpp177
-rw-r--r--src/multimedia/effects/qsoundeffect_pulse_p.h37
-rw-r--r--src/multimedia/effects/qsoundeffect_qmedia_p.cpp99
-rw-r--r--src/multimedia/effects/qsoundeffect_qmedia_p.h32
-rw-r--r--src/multimedia/effects/qsoundeffect_qsound_p.cpp154
-rw-r--r--src/multimedia/effects/qsoundeffect_qsound_p.h53
-rw-r--r--src/multimedia/effects/wavedecoder_p.h4
-rw-r--r--src/opengl/qgl_x11egl.cpp1
-rw-r--r--src/src.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml2
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp10
25 files changed, 257 insertions, 507 deletions
diff --git a/demos/mainwindow/mainwindow.cpp b/demos/mainwindow/mainwindow.cpp
index 32066d7..3ddb74b 100644
--- a/demos/mainwindow/mainwindow.cpp
+++ b/demos/mainwindow/mainwindow.cpp
@@ -329,7 +329,7 @@ void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints)
BlueTitleBar *titlebar = new BlueTitleBar(swatch);
swatch->setTitleBarWidget(titlebar);
connect(swatch, SIGNAL(topLevelChanged(bool)), titlebar, SLOT(updateMask()));
- connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask()));
+ connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask()), Qt::QueuedConnection);
#ifdef Q_WS_QWS
QPalette pal = palette();
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index ff3a790..9d6b2a0 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2217,7 +2217,7 @@ void QDeclarativeItem::setKeepMouseGrab(bool keep)
\qmlmethod object Item::mapFromItem(Item item, int x, int y)
Maps the point (\a x, \a y), which is in \a item's coordinate system, to
- this item's coordinate system, and returns an object with \c x and \c y
+ this item's coordinate system, and returns an object with \c x and \c y
properties matching the mapped cooordinate.
If \a item is a \c null value, this maps the point from the coordinate
@@ -2576,9 +2576,9 @@ bool QDeclarativeItem::sceneEvent(QEvent *event)
!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
keyPressEvent(static_cast<QKeyEvent *>(event));
if (!event->isAccepted())
- QGraphicsItem::sceneEvent(event);
+ return QGraphicsItem::sceneEvent(event);
} else {
- QGraphicsItem::sceneEvent(event);
+ return QGraphicsItem::sceneEvent(event);
}
} else {
bool rv = QGraphicsItem::sceneEvent(event);
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 55f1c89..6bad4da 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -927,6 +927,8 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
if (inPackage) {
emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj));
} else {
+ if (item->hasFocus())
+ item->clearFocus();
item->setOpacity(0.0);
static_cast<QGraphicsItem*>(item)->setParentItem(0);
}
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 53e08b0..49dbb27 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -61,9 +61,6 @@
QT_BEGIN_NAMESPACE
-
-
-
typedef QPair<int, int> QDeclarativeXmlListRange;
/*!
@@ -114,9 +111,6 @@ class QDeclarativeXmlQuery : public QThread
{
Q_OBJECT
public:
- QDeclarativeXmlQuery(QObject *parent=0)
- : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) {
- }
~QDeclarativeXmlQuery() {
m_mutex.lock();
m_quit = true;
@@ -126,6 +120,11 @@ public:
wait();
}
+ static QDeclarativeXmlQuery *instance() {
+ static QDeclarativeXmlQuery *query = new QDeclarativeXmlQuery;
+ return query;
+ }
+
void abort() {
QMutexLocker locker(&m_mutex);
m_abort = true;
@@ -164,6 +163,11 @@ public:
return m_removedItemRanges;
}
+private:
+ QDeclarativeXmlQuery(QObject *parent=0)
+ : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) {
+ }
+
Q_SIGNALS:
void queryCompleted(int queryId, int size);
@@ -213,6 +217,8 @@ private:
QList<QDeclarativeXmlListRange> m_removedItemRanges;
};
+//Q_GLOBAL_STATIC(QDeclarativeXmlQuery, QDeclarativeXmlQuery::instance());
+
void QDeclarativeXmlQuery::doQueryJob()
{
QString r;
@@ -404,7 +410,6 @@ public:
QNetworkReply *reply;
QDeclarativeXmlListModel::Status status;
qreal progress;
- QDeclarativeXmlQuery qmlXmlQuery;
int queryId;
QList<QDeclarativeXmlListModelRole *> roleObjects;
static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role);
@@ -488,8 +493,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
: QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent)
{
- Q_D(QDeclarativeXmlListModel);
- connect(&d->qmlXmlQuery, SIGNAL(queryCompleted(int,int)),
+ connect(QDeclarativeXmlQuery::instance(), SIGNAL(queryCompleted(int,int)),
this, SLOT(queryCompleted(int,int)));
}
@@ -722,7 +726,7 @@ void QDeclarativeXmlListModel::reload()
if (!d->isComponentComplete)
return;
- d->qmlXmlQuery.abort();
+ QDeclarativeXmlQuery::instance()->abort();
d->queryId = -1;
int count = d->size;
@@ -754,7 +758,7 @@ void QDeclarativeXmlListModel::reload()
}
if (!d->xml.isEmpty()) {
- d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects);
+ d->queryId = QDeclarativeXmlQuery::instance()->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects);
d->progress = 1.0;
d->status = Ready;
emit progressChanged(d->progress);
@@ -785,7 +789,7 @@ void QDeclarativeXmlListModel::requestFinished()
} else {
d->status = Ready;
QByteArray data = d->reply->readAll();
- d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects);
+ d->queryId = QDeclarativeXmlQuery::instance()->doQuery(d->query, d->namespaces, data, &d->roleObjects);
disconnect(d->reply, 0, this, 0);
d->reply->deleteLater();
d->reply = 0;
@@ -811,10 +815,10 @@ void QDeclarativeXmlListModel::queryCompleted(int id, int size)
return;
bool sizeChanged = size != d->size;
d->size = size;
- d->data = d->qmlXmlQuery.modelData();
+ d->data = QDeclarativeXmlQuery::instance()->modelData();
- QList<QDeclarativeXmlListRange> removed = d->qmlXmlQuery.removedItemRanges();
- QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges();
+ QList<QDeclarativeXmlListRange> removed = QDeclarativeXmlQuery::instance()->removedItemRanges();
+ QList<QDeclarativeXmlListRange> inserted = QDeclarativeXmlQuery::instance()->insertedItemRanges();
for (int i=0; i<removed.count(); i++)
emit itemsRemoved(removed[i].first, removed[i].second);
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 8608523..53c4711 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -41,18 +41,19 @@
#include <QtCore/qdebug.h>
-#include <private/qt_x11_p.h>
+#include <QtGui/private/qt_x11_p.h>
#include <QtGui/qx11info_x11.h>
-#include <private/qpixmapdata_p.h>
-#include <private/qpixmap_x11_p.h>
+#include <QtGui/private/qpixmapdata_p.h>
+#include <QtGui/private/qpixmap_x11_p.h>
+#include <QtGui/private/qimagepixmapcleanuphooks_p.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
#include <QtGui/qcolormap.h>
-#include "qegl_p.h"
-#include "qeglcontext_p.h"
+#include "QtGui/private/qegl_p.h"
+#include "QtGui/private/qeglcontext_p.h"
QT_BEGIN_NAMESPACE
@@ -408,6 +409,7 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg
(EGLNativePixmapType) x11PixmapData->handle(),
surfaceAttribs.properties());
x11PixmapData->gl_surface = (Qt::HANDLE)surf;
+ QImagePixmapCleanupHooks::enableCleanupHooks(x11PixmapData);
return surf;
}
diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp
index 39633bf..2840843 100644
--- a/src/gui/kernel/qmime_win.cpp
+++ b/src/gui/kernel/qmime_win.cpp
@@ -952,6 +952,8 @@ bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeD
QDataStream s(&ba, QIODevice::WriteOnly);
s.setByteOrder(QDataStream::LittleEndian);// Intel byte order ####
if (cf == CF_DIB) {
+ if (img.format() > QImage::Format_ARGB32)
+ img = img.convertToFormat(QImage::Format_RGB32);
if (qt_write_dib(s, img))
return setData(ba, pmedium);
} else {
diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro
index 117aa9b..f7a1d1b 100644
--- a/src/imports/multimedia/multimedia.pro
+++ b/src/imports/multimedia/multimedia.pro
@@ -1,5 +1,5 @@
TARGET = multimedia
-TARGETPATH = $$[QT_INSTALL_IMPORTS]/Qt/multimedia
+TARGETPATH = Qt/multimedia
include(../qimportbase.pri)
QT += multimedia declarative
@@ -21,6 +21,6 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia
target.path = $$TARGETPATH
qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir
-qmldir.path += $$TARGETPATH
+qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
INSTALLS += target qmldir
diff --git a/src/imports/qimportbase.pri b/src/imports/qimportbase.pri
index 363dd88..5433059 100644
--- a/src/imports/qimportbase.pri
+++ b/src/imports/qimportbase.pri
@@ -12,7 +12,7 @@ isEmpty(TARGET) {
QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
copy2build.input = QMLDIRFILE
-copy2build.output = $$TARGETPATH/qmldir
+copy2build.output = $$QT_BUILD_TREE/imports/$$TARGETPATH/qmldir
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copy2build.name = COPY ${QMAKE_FILE_IN}
diff --git a/src/imports/webkit/webkit.pro b/src/imports/webkit/webkit.pro
index 76b46f1..fdc12cc 100644
--- a/src/imports/webkit/webkit.pro
+++ b/src/imports/webkit/webkit.pro
@@ -1,5 +1,5 @@
TARGET = webkitqmlplugin
-TARGETPATH = $$[QT_INSTALL_IMPORTS]/org/webkit
+TARGETPATH = org/webkit
include(../qimportbase.pri)
QT += webkit declarative
@@ -14,6 +14,6 @@ QTDIR_build:DESTDIR = $$TARGETPATH
target.path = $$TARGETPATH
qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir
-qmldir.path += $$TARGETPATH
+qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
INSTALLS += target qmldir
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
index b98be59..02223d7 100644
--- a/src/imports/widgets/widgets.pro
+++ b/src/imports/widgets/widgets.pro
@@ -1,5 +1,5 @@
TARGET = widgets
-TARGETPATH = $$[QT_INSTALL_IMPORTS]/Qt/widgets
+TARGETPATH = Qt/widgets
include(../qimportbase.pri)
QT += declarative
@@ -17,6 +17,6 @@ target.path = $$TARGETPATH
# install qmldir file
qmldir.files += qmldir
-qmldir.path = $$TARGETPATH
+qmldir.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
INSTALLS += target qmldir
diff --git a/src/multimedia/effects/effects.pri b/src/multimedia/effects/effects.pri
index ff762e8..be2b696 100644
--- a/src/multimedia/effects/effects.pri
+++ b/src/multimedia/effects/effects.pri
@@ -1,7 +1,7 @@
-unix {
- unix:contains(QT_CONFIG, pulseaudio) {
+unix:!mac {
+ contains(QT_CONFIG, pulseaudio) {
DEFINES += QT_MULTIMEDIA_PULSEAUDIO
HEADERS += $$PWD/qsoundeffect_pulse_p.h
SOURCES += $$PWD/qsoundeffect_pulse_p.cpp
diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp
index 2694023..f64d9ee 100644
--- a/src/multimedia/effects/qsoundeffect.cpp
+++ b/src/multimedia/effects/qsoundeffect.cpp
@@ -39,9 +39,6 @@
**
****************************************************************************/
-#include "qmediacontent.h"
-#include "qmediaplayer.h"
-
#include "qsoundeffect_p.h"
#if defined(QT_MULTIMEDIA_PULSEAUDIO)
@@ -103,12 +100,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty int SoundEffect::duration
-
- This property holds the duration in milliseconds of the current source audio.
-*/
-
-/*!
\qmlsignal SoundEffect::sourceChanged()
This handler is called when the source has changed.
@@ -132,24 +123,13 @@ QT_BEGIN_NAMESPACE
This handler is called when the mute state has changed.
*/
-/*!
- \qmlsignal SoundEffect::durationChanged()
-
- This handler is called when the duration has changed.
-*/
QSoundEffect::QSoundEffect(QObject *parent) :
- QObject(parent),
- m_loopCount(1),
- m_vol(100),
- m_muted(false),
- m_runningCount(0)
+ QObject(parent)
{
d = new QSoundEffectPrivate(this);
- connect(d, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged()));
- connect(d, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged()));
- connect(d, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged()));
- connect(d, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(repeat()));
+ connect(d, SIGNAL(volumeChanged()), SIGNAL(volumeChanged()));
+ connect(d, SIGNAL(mutedChanged()), SIGNAL(mutedChanged()));
}
QSoundEffect::~QSoundEffect()
@@ -159,97 +139,64 @@ QSoundEffect::~QSoundEffect()
QUrl QSoundEffect::source() const
{
- return d != 0 ? d->media().canonicalUrl() : QUrl();
+ return d->source();
}
void QSoundEffect::setSource(const QUrl &url)
{
- if (d != 0 && d->media().canonicalUrl() == url)
+ if (d->source() == url)
return;
- d->setVolume(m_vol);
- d->setMuted(m_muted);
- d->setMedia(url);
-
- if (url.isEmpty())
- return;
+ d->setSource(url);
emit sourceChanged();
}
int QSoundEffect::loopCount() const
{
- return m_loopCount;
+ return d->loopCount();
}
void QSoundEffect::setLoopCount(int loopCount)
{
- if (m_loopCount == loopCount)
+ if (d->loopCount() == loopCount)
return;
- m_loopCount = loopCount;
+ d->setLoopCount(loopCount);
emit loopCountChanged();
}
int QSoundEffect::volume() const
{
- return d != 0 ? d->volume() : m_vol;
+ return d->volume();
}
void QSoundEffect::setVolume(int volume)
{
- if (m_vol == volume)
+ if (d->volume() == volume)
return;
- m_vol = volume;
- if (d != 0)
- d->setVolume(volume);
- else
- emit volumeChanged();
+ d->setVolume(volume);
+ emit volumeChanged();
}
bool QSoundEffect::isMuted() const
{
- return d != 0 ? d->isMuted() : m_muted;
+ return d->isMuted();
}
void QSoundEffect::setMuted(bool muted)
{
- if (m_muted == muted)
+ if (d->isMuted() == muted)
return;
- m_muted = muted;
- if (d != 0)
- d->setMuted(muted);
- else
- emit mutedChanged();
-}
-
-int QSoundEffect::duration() const
-{
- return d != 0 ? d->duration() : 0;
+ d->setMuted(muted);
+ emit mutedChanged();
}
void QSoundEffect::play()
{
- m_runningCount = 0;
-
- if (d != 0)
- d->play();
-}
-
-void QSoundEffect::stop()
-{
- if (d != 0)
- d->stop();
-}
-
-void QSoundEffect::repeat()
-{
- if (d->state() == QMediaPlayer::StoppedState) {
- if (++m_runningCount < m_loopCount)
- d->play();
- }
+ d->play();
}
QT_END_NAMESPACE
diff --git a/src/multimedia/effects/qsoundeffect_p.h b/src/multimedia/effects/qsoundeffect_p.h
index c5554bf..ec6a2f7 100644
--- a/src/multimedia/effects/qsoundeffect_p.h
+++ b/src/multimedia/effects/qsoundeffect_p.h
@@ -70,7 +70,6 @@ class Q_MULTIMEDIA_EXPORT QSoundEffect : public QObject
Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount NOTIFY loopCountChanged)
Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
public:
explicit QSoundEffect(QObject *parent = 0);
@@ -88,30 +87,17 @@ public:
bool isMuted() const;
void setMuted(bool muted);
- int duration() const;
-
-signals:
+Q_SIGNALS:
void sourceChanged();
void loopCountChanged();
void volumeChanged();
void mutedChanged();
- void durationChanged();
-public slots:
+public Q_SLOTS:
void play();
- void stop();
-
-private slots:
- void repeat();
private:
Q_DISABLE_COPY(QSoundEffect)
-
- int m_loopCount;
- int m_vol;
- bool m_muted;
- int m_runningCount;
-
QSoundEffectPrivate* d;
};
diff --git a/src/multimedia/effects/qsoundeffect_pulse_p.cpp b/src/multimedia/effects/qsoundeffect_pulse_p.cpp
index d99bf4b..c322722 100644
--- a/src/multimedia/effects/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/effects/qsoundeffect_pulse_p.cpp
@@ -55,10 +55,6 @@
#include <QtNetwork>
#include <QTime>
-#include "qmediacontent.h"
-#include "qmediaplayer.h"
-#include "qsoundeffect_p.h"
-
#include "wavedecoder_p.h"
#include "qsoundeffect_pulse_p.h"
@@ -240,11 +236,12 @@ QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
QObject(parent),
m_muted(false),
m_playQueued(false),
- m_vol(100),
+ m_sampleLoaded(false),
+ m_volume(100),
m_duration(0),
m_dataUploaded(0),
- m_state(QMediaPlayer::StoppedState),
- m_status(QMediaPlayer::NoMedia),
+ m_loopCount(1),
+ m_runningCount(0),
m_reply(0),
m_stream(0),
m_networkAccessManager(0)
@@ -257,76 +254,53 @@ QSoundEffectPrivate::~QSoundEffectPrivate()
unloadSample();
}
-qint64 QSoundEffectPrivate::duration() const
+QUrl QSoundEffectPrivate::source() const
{
- return m_duration;
+ return m_source;
}
-int QSoundEffectPrivate::volume() const
+void QSoundEffectPrivate::setSource(const QUrl &url)
{
- return m_vol;
-}
+ if (url.isEmpty()) {
+ m_source = QUrl();
+ unloadSample();
+ return;
+ }
-bool QSoundEffectPrivate::isMuted() const
-{
- return m_muted;
-}
+ m_source = url;
-QMediaContent QSoundEffectPrivate::media() const
-{
- return m_media;
+ if (m_networkAccessManager == 0)
+ m_networkAccessManager = new QNetworkAccessManager(this);
+
+ m_stream = m_networkAccessManager->get(QNetworkRequest(m_source));
+
+ unloadSample();
+ loadSample();
}
-QMediaPlayer::State QSoundEffectPrivate::state() const
+int QSoundEffectPrivate::loopCount() const
{
- return m_state;
+ return m_loopCount;
}
-QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const
+void QSoundEffectPrivate::setLoopCount(int loopCount)
{
- return m_status;
+ m_loopCount = loopCount;
}
-void QSoundEffectPrivate::play()
+int QSoundEffectPrivate::volume() const
{
- if (m_status == QMediaPlayer::LoadingMedia) {
- m_playQueued = true;
- return;
- }
-
- if (m_status != QMediaPlayer::BufferedMedia ||
- m_state == QMediaPlayer::PlayingState)
- return;
-
- pa_volume_t m_vol = PA_VOLUME_NORM;
-
- daemon()->lock();
-#if defined(Q_WS_MAEMO_5)
- m_vol = PA_VOLUME_NORM/100*((daemon()->volume()+m_vol)/2);
-#endif
- pa_operation_unref(
- pa_context_play_sample(daemon()->context(),
- m_name.constData(),
- 0,
- m_vol,
- play_callback,
- this)
- );
- daemon()->unlock();
-
- m_playbackTime.start();
-
- emit stateChanged(m_state = QMediaPlayer::PlayingState);
+ return m_volume;
}
-void QSoundEffectPrivate::stop()
+void QSoundEffectPrivate::setVolume(int volume)
{
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
+ m_volume = volume;
}
-void QSoundEffectPrivate::setVolume(int volume)
+bool QSoundEffectPrivate::isMuted() const
{
- m_vol = volume;
+ return m_muted;
}
void QSoundEffectPrivate::setMuted(bool muted)
@@ -334,34 +308,23 @@ void QSoundEffectPrivate::setMuted(bool muted)
m_muted = muted;
}
-void QSoundEffectPrivate::setMedia(const QMediaContent &media)
+void QSoundEffectPrivate::play()
{
- if (media.isNull()) {
- m_media = QMediaContent();
- unloadSample();
+ if (!m_sampleLoaded) {
+ m_playQueued = true;
return;
}
- if (m_media == media)
- return;
- m_media = media;
-
- if (m_networkAccessManager == 0)
- m_networkAccessManager = new QNetworkAccessManager(this);
- m_stream = m_networkAccessManager->get(QNetworkRequest(m_media.canonicalUrl()));
+ m_runningCount += m_loopCount;
- unloadSample();
- loadSample();
-
- emit mediaChanged(m_media);
+ playSample();
}
void QSoundEffectPrivate::decoderReady()
{
if (m_waveDecoder->size() >= PA_SCACHE_ENTRY_SIZE_MAX) {
- m_status = QMediaPlayer::InvalidMedia;
- emit mediaStatusChanged(m_status);
- qWarning("QtPulseAudio: attempting to load to large a sample");
+ m_waveDecoder->deleteLater();
+ qWarning("QSoundEffect(pulseaudio): Attempting to load to large a sample");
return;
}
@@ -380,52 +343,65 @@ void QSoundEffectPrivate::decoderReady()
void QSoundEffectPrivate::decoderError()
{
- emit mediaStatusChanged(m_status = QMediaPlayer::InvalidMedia);
+ qWarning("QSoundEffect(pulseaudio): Error decoding source");
}
void QSoundEffectPrivate::checkPlayTime()
{
int elapsed = m_playbackTime.elapsed();
- if (elapsed >= m_duration) {
- m_state = QMediaPlayer::StoppedState;
- emit stateChanged(m_state);
- }
- else
+ if (elapsed < m_duration)
startTimer(m_duration - elapsed);
}
void QSoundEffectPrivate::loadSample()
{
+ m_sampleLoaded = false;
+ m_dataUploaded = 0;
m_waveDecoder = new WaveDecoder(m_stream);
connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady()));
connect(m_waveDecoder, SIGNAL(invalidFormat()), SLOT(decoderError()));
-
- m_status = QMediaPlayer::LoadingMedia;
- emit mediaStatusChanged(m_status);
}
void QSoundEffectPrivate::unloadSample()
{
- if (m_status != QMediaPlayer::BufferedMedia)
+ if (!m_sampleLoaded)
return;
- m_status = QMediaPlayer::NoMedia;
-
daemon()->lock();
pa_context_remove_sample(daemon()->context(), m_name.constData(), NULL, NULL);
daemon()->unlock();
m_duration = 0;
m_dataUploaded = 0;
+ m_sampleLoaded = false;
+}
+
+void QSoundEffectPrivate::playSample()
+{
+ pa_volume_t volume = PA_VOLUME_NORM;
+
+ daemon()->lock();
+#ifdef Q_WS_MAEMO_5
+ volume = PA_VOLUME_NORM / 100 * ((daemon()->volume() + m_volume) / 2);
+#endif
+ pa_operation_unref(
+ pa_context_play_sample(daemon()->context(),
+ m_name.constData(),
+ 0,
+ volume,
+ play_callback,
+ this)
+ );
+ daemon()->unlock();
+
+ m_playbackTime.start();
}
void QSoundEffectPrivate::timerEvent(QTimerEvent *event)
{
- if (m_state == QMediaPlayer::PlayingState) {
- m_state = QMediaPlayer::StoppedState;
- emit stateChanged(m_state);
- }
+ if (m_runningCount > 0)
+ playSample();
killTimer(event->timerId());
}
@@ -456,15 +432,11 @@ void QSoundEffectPrivate::stream_write_callback(pa_stream *s, size_t length, voi
pa_stream_finish_upload(s);
self->m_duration = self->m_waveDecoder->duration();
- emit self->durationChanged(self->m_duration);
-
- self->m_status = QMediaPlayer::BufferedMedia;
- emit self->mediaStatusChanged(self->m_status);
self->m_waveDecoder->deleteLater();
- if (!self->m_media.isNull())
- self->m_stream->deleteLater();
+ self->m_stream->deleteLater();
+ self->m_sampleLoaded = true;
if (self->m_playQueued) {
self->m_playQueued = false;
QMetaObject::invokeMethod(self, "play");
@@ -474,8 +446,6 @@ void QSoundEffectPrivate::stream_write_callback(pa_stream *s, size_t length, voi
void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata)
{
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-
switch (pa_stream_get_state(s)) {
case PA_STREAM_CREATING:
case PA_STREAM_READY:
@@ -484,8 +454,7 @@ void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata)
case PA_STREAM_FAILED:
default:
- self->m_status = QMediaPlayer::InvalidMedia;
- emit self->mediaStatusChanged(self->m_status);
+ qWarning("QSoundEffect(pulseaudio): Error in pulse audio stream");
break;
}
}
@@ -496,14 +465,10 @@ void QSoundEffectPrivate::play_callback(pa_context *c, int success, void *userda
QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
- if (success == 1)
+ if (success == 1) {
+ self->m_runningCount--;
QMetaObject::invokeMethod(self, "checkPlayTime", Qt::QueuedConnection);
- else {
- self->m_state = QMediaPlayer::StoppedState;
- emit self->stateChanged(self->m_state);
}
}
QT_END_NAMESPACE
-
-
diff --git a/src/multimedia/effects/qsoundeffect_pulse_p.h b/src/multimedia/effects/qsoundeffect_pulse_p.h
index 247f8a3..3aed018 100644
--- a/src/multimedia/effects/qsoundeffect_pulse_p.h
+++ b/src/multimedia/effects/qsoundeffect_pulse_p.h
@@ -77,30 +77,23 @@ public:
explicit QSoundEffectPrivate(QObject* parent);
~QSoundEffectPrivate();
- qint64 duration() const;
+ QUrl source() const;
+ void setSource(const QUrl &url);
+ int loopCount() const;
+ void setLoopCount(int loopCount);
int volume() const;
+ void setVolume(int volume);
bool isMuted() const;
- QMediaContent media() const;
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
+ void setMuted(bool muted);
public Q_SLOTS:
void play();
- void stop();
- void setVolume(int volume);
- void setMuted(bool muted);
- void setMedia(const QMediaContent &media);
Q_SIGNALS:
- void mediaChanged(const QMediaContent &media);
- void mediaStatusChanged(QMediaPlayer::MediaStatus status);
- void stateChanged(QMediaPlayer::State newState);
- void durationChanged(qint64 duration);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void error(QMediaPlayer::Error error);
-
-private slots:
+ void volumeChanged();
+ void mutedChanged();
+
+private Q_SLOTS:
void decoderReady();
void decoderError();
void checkPlayTime();
@@ -108,6 +101,7 @@ private slots:
private:
void loadSample();
void unloadSample();
+ void playSample();
void timerEvent(QTimerEvent *event);
@@ -117,14 +111,15 @@ private:
bool m_muted;
bool m_playQueued;
- int m_vol;
+ bool m_sampleLoaded;
+ int m_volume;
int m_duration;
int m_dataUploaded;
+ int m_loopCount;
+ int m_runningCount;
+ QUrl m_source;
QTime m_playbackTime;
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_status;
QByteArray m_name;
- QMediaContent m_media;
QNetworkReply *m_reply;
WaveDecoder *m_waveDecoder;
QIODevice *m_stream;
diff --git a/src/multimedia/effects/qsoundeffect_qmedia_p.cpp b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp
index 48fb257..43ba22f 100644
--- a/src/multimedia/effects/qsoundeffect_qmedia_p.cpp
+++ b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp
@@ -50,117 +50,84 @@
// We mean it.
//
-#include <QtCore/qcoreapplication.h>
+#include "qsoundeffect_qmedia_p.h"
-#include "qmediacontent.h"
-#include "qmediaplayer.h"
+#include <QtCore/qcoreapplication.h>
-#include "qsoundeffect_p.h"
-#include "qsoundeffect_qmedia_p.h"
+#include <QtMultimedia/qmediacontent.h>
+#include <QtMultimedia/qmediaplayer.h>
QT_BEGIN_NAMESPACE
QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
QObject(parent),
- m_muted(false),
- m_vol(100),
+ m_loopCount(1),
+ m_runningCount(0),
m_player(0)
{
+ m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);
+ connect(m_player, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged()));
+ connect(m_player, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged()));
+ connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(stateChanged(QMediaPlayer::State)));
}
QSoundEffectPrivate::~QSoundEffectPrivate()
{
- if (m_player) delete m_player;
}
-qint64 QSoundEffectPrivate::duration() const
+QUrl QSoundEffectPrivate::source() const
{
- if (m_player) return m_player->duration();
-
- return 0;
+ return m_player->media().canonicalUrl();
}
-int QSoundEffectPrivate::volume() const
+void QSoundEffectPrivate::setSource(const QUrl &url)
{
- if (m_player) return m_player->volume();
-
- return m_vol;
+ m_player->setMedia(url);
}
-bool QSoundEffectPrivate::isMuted() const
-{
- if (m_player) return m_player->isMuted();
-
- return m_muted;
-}
-
-QMediaContent QSoundEffectPrivate::media() const
+int QSoundEffectPrivate::loopCount() const
{
- if (m_player) return m_player->media();
-
- return QMediaContent();
+ return m_loopCount;
}
-QMediaPlayer::State QSoundEffectPrivate::state() const
+void QSoundEffectPrivate::setLoopCount(int loopCount)
{
- if (m_player) return m_player->state();
-
- return QMediaPlayer::StoppedState;
+ m_loopCount = loopCount;
}
-QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const
+int QSoundEffectPrivate::volume() const
{
- if (m_player) return m_player->mediaStatus();
-
- return QMediaPlayer::UnknownMediaStatus;
+ return m_player->volume();
}
-void QSoundEffectPrivate::play()
+void QSoundEffectPrivate::setVolume(int volume)
{
- if (m_player && !m_player->isMuted())
- m_player->play();
+ m_player->setVolume(volume);
}
-void QSoundEffectPrivate::stop()
+bool QSoundEffectPrivate::isMuted() const
{
- if (m_player)
- m_player->stop();
+ return m_player->isMuted();
}
-void QSoundEffectPrivate::setVolume(int volume)
+void QSoundEffectPrivate::setMuted(bool muted)
{
- m_vol = volume;
-
- if (m_player)
- m_player->setVolume(volume);
+ m_player->setMuted(muted);
}
-void QSoundEffectPrivate::setMuted(bool muted)
+void QSoundEffectPrivate::play()
{
- m_muted = muted;
-
- if (m_player)
- m_player->setMuted(muted);
+ m_runningCount += m_loopCount;
+ m_player->play();
}
-void QSoundEffectPrivate::setMedia(const QMediaContent &media)
+void QSoundEffectPrivate::stateChanged(QMediaPlayer::State state)
{
- if (media.isNull())
- return;
-
- if (m_player == 0) {
- m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);
- m_player->setVolume(m_vol);
- m_player->setMuted(m_muted);
-
- connect(m_player, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int)));
- connect(m_player, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- connect(m_player, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), SIGNAL(stateChanged(QMediaPlayer::State)));
+ if (state == QMediaPlayer::StoppedState) {
+ if (--m_runningCount > 0)
+ m_player->play();
}
-
- m_player->setMedia(media.canonicalUrl());
}
QT_END_NAMESPACE
diff --git a/src/multimedia/effects/qsoundeffect_qmedia_p.h b/src/multimedia/effects/qsoundeffect_qmedia_p.h
index 8267f79..6ad9d79 100644
--- a/src/multimedia/effects/qsoundeffect_qmedia_p.h
+++ b/src/multimedia/effects/qsoundeffect_qmedia_p.h
@@ -57,14 +57,12 @@
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
#include <QtMultimedia/qmediaplayer.h>
-#include "qsoundeffect_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class WaveDecoder;
class QSoundEffectPrivate : public QObject
{
@@ -73,32 +71,28 @@ public:
explicit QSoundEffectPrivate(QObject* parent);
~QSoundEffectPrivate();
- qint64 duration() const;
+ QUrl source() const;
+ void setSource(const QUrl &url);
+ int loopCount() const;
+ void setLoopCount(int loopCount);
int volume() const;
+ void setVolume(int volume);
bool isMuted() const;
- QMediaContent media() const;
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
+ void setMuted(bool muted);
public Q_SLOTS:
void play();
- void stop();
- void setVolume(int volume);
- void setMuted(bool muted);
- void setMedia(const QMediaContent &media);
Q_SIGNALS:
- void mediaChanged(const QMediaContent &media);
- void mediaStatusChanged(QMediaPlayer::MediaStatus status);
- void stateChanged(QMediaPlayer::State newState);
- void durationChanged(qint64 duration);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void error(QMediaPlayer::Error error);
+ void volumeChanged();
+ void mutedChanged();
+
+private Q_SLOTS:
+ void stateChanged(QMediaPlayer::State);
private:
- bool m_muted;
- int m_vol;
+ int m_loopCount;
+ int m_runningCount;
QMediaPlayer *m_player;
};
diff --git a/src/multimedia/effects/qsoundeffect_qsound_p.cpp b/src/multimedia/effects/qsoundeffect_qsound_p.cpp
index df160a9..ff30f67 100644
--- a/src/multimedia/effects/qsoundeffect_qsound_p.cpp
+++ b/src/multimedia/effects/qsoundeffect_qsound_p.cpp
@@ -50,102 +50,72 @@
// We mean it.
//
+#include "qsoundeffect_qsound_p.h"
+
#include <QtCore/qcoreapplication.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qfile.h>
#include <QtGui/qsound.h>
-#include <QtMultimedia/qaudioformat.h>
-#include <QDebug>
-#include "qmediacontent.h"
-#include "qmediaplayer.h"
-#include "qsoundeffect_p.h"
-
-#include "wavedecoder_p.h"
-
-#include "qsoundeffect_qsound_p.h"
QT_BEGIN_NAMESPACE
QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
QObject(parent),
- m_queued(false),
m_muted(false),
- m_state(QMediaPlayer::StoppedState),
- m_status(QMediaPlayer::NoMedia),
- m_file(0),
+ m_loopCount(1),
+ m_volume(100),
m_sound(0)
{
- m_timer = new QTimer(this);
- connect(m_timer,SIGNAL(timeout()),SLOT(checkPlayTime()));
- m_media = QMediaContent();
}
QSoundEffectPrivate::~QSoundEffectPrivate()
{
- if (m_sound) delete m_sound;
- if (m_waveDecoder) delete m_waveDecoder;
- m_file->close();
}
-qint64 QSoundEffectPrivate::duration() const
+QUrl QSoundEffectPrivate::source() const
{
- if (m_waveDecoder)
- return m_waveDecoder->size();
-
- return 0;
+ return m_source;
}
-int QSoundEffectPrivate::volume() const
+void QSoundEffectPrivate::setSource(const QUrl &url)
{
- return 100;
-}
+ if (url.isEmpty() || url.scheme() != QLatin1String("file")) {
+ m_source = QUrl();
+ return;
+ }
-bool QSoundEffectPrivate::isMuted() const
-{
- return m_muted;
-}
+ if (m_sound != 0)
+ delete m_sound;
-QMediaContent QSoundEffectPrivate::media() const
-{
- return m_media;
+ m_source = url;
+ m_sound = new QSound(m_source.toLocalFile(), this);
+ m_sound->setLoops(m_loopCount);
}
-QMediaPlayer::State QSoundEffectPrivate::state() const
+int QSoundEffectPrivate::loopCount() const
{
- return m_state;
+ return m_loopCount;
}
-QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const
+void QSoundEffectPrivate::setLoopCount(int lc)
{
- return m_status;
+ m_loopCount = lc;
+ if (m_sound)
+ m_sound->setLoops(lc);
}
-void QSoundEffectPrivate::play()
+int QSoundEffectPrivate::volume() const
{
- if (m_sound && !m_muted) {
- m_queued = false;
- m_timer->start(20);
- m_playbackTime.start();
- m_sound->play();
- emit stateChanged(m_state = QMediaPlayer::PlayingState);
- } else if (m_status == QMediaPlayer::LoadingMedia)
- m_queued = true;
+ return m_volume;
}
-void QSoundEffectPrivate::stop()
+void QSoundEffectPrivate::setVolume(int v)
{
- m_timer->stop();
-
- if (m_sound) {
- m_sound->stop();
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
- }
+ m_volume = v;
}
-void QSoundEffectPrivate::setVolume(int volume)
+bool QSoundEffectPrivate::isMuted() const
{
- Q_UNUSED(volume)
+ return m_muted;
}
void QSoundEffectPrivate::setMuted(bool muted)
@@ -153,73 +123,9 @@ void QSoundEffectPrivate::setMuted(bool muted)
m_muted = muted;
}
-void QSoundEffectPrivate::setMedia(const QMediaContent &media)
-{
- m_queued = false;
-
- if (media.isNull() || media.canonicalUrl().scheme() != QLatin1String("file")) {
- m_media = QMediaContent();
- return;
- }
- if (m_media == media)
- return;
-
- m_media = media;
- m_file = new QFile(m_media.canonicalUrl().toLocalFile());
- m_file->open(QIODevice::ReadOnly|QIODevice::Unbuffered);
-
- unloadSample();
- loadSample();
-
- emit mediaChanged(m_media);
-}
-
-void QSoundEffectPrivate::decoderReady()
-{
- m_file->close();
- m_sound = new QSound(m_media.canonicalUrl().toLocalFile());
- emit mediaStatusChanged(m_status = QMediaPlayer::LoadedMedia);
-
- if (m_queued)
- play();
-}
-
-void QSoundEffectPrivate::decoderError()
-{
- m_file->close();
- emit mediaStatusChanged(m_status = QMediaPlayer::InvalidMedia);
-}
-
-void QSoundEffectPrivate::checkPlayTime()
-{
- if (m_sound->isFinished()) {
- m_timer->stop();
- m_state = QMediaPlayer::StoppedState;
- emit stateChanged(m_state);
- }
-}
-
-void QSoundEffectPrivate::loadSample()
-{
- m_waveDecoder = new WaveDecoder(m_file);
- connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady()));
- connect(m_waveDecoder, SIGNAL(invalidFormat()), SLOT(decoderError()));
-
- m_status = QMediaPlayer::LoadingMedia;
- emit mediaStatusChanged(m_status);
-}
-
-void QSoundEffectPrivate::unloadSample()
+void QSoundEffectPrivate::play()
{
- if (m_sound == 0)
- return;
-
- m_status = QMediaPlayer::NoMedia;
-
- if (m_sound)
- delete m_sound;
-
- m_sound = 0;
+ m_sound->play();
}
QT_END_NAMESPACE
diff --git a/src/multimedia/effects/qsoundeffect_qsound_p.h b/src/multimedia/effects/qsoundeffect_qsound_p.h
index 45c0888..6fb3cfa 100644
--- a/src/multimedia/effects/qsoundeffect_qsound_p.h
+++ b/src/multimedia/effects/qsoundeffect_qsound_p.h
@@ -55,20 +55,14 @@
#include <QtCore/qobject.h>
-#include <QtCore/qdatetime.h>
-#include <QtMultimedia/qmediaplayer.h>
-
-#include "qsoundeffect_p.h"
+#include <QtCore/qurl.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QTimer;
class QSound;
-class QFile;
-class WaveDecoder;
class QSoundEffectPrivate : public QObject
{
@@ -77,49 +71,28 @@ public:
explicit QSoundEffectPrivate(QObject* parent);
~QSoundEffectPrivate();
- qint64 duration() const;
+ QUrl source() const;
+ void setSource(const QUrl &url);
+ int loopCount() const;
+ void setLoopCount(int loopCount);
int volume() const;
+ void setVolume(int volume);
bool isMuted() const;
- QMediaContent media() const;
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
+ void setMuted(bool muted);
public Q_SLOTS:
void play();
- void stop();
- void setVolume(int volume);
- void setMuted(bool muted);
- void setMedia(const QMediaContent &media);
Q_SIGNALS:
- void mediaChanged(const QMediaContent &media);
- void mediaStatusChanged(QMediaPlayer::MediaStatus status);
- void stateChanged(QMediaPlayer::State newState);
- void durationChanged(qint64 duration);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void error(QMediaPlayer::Error error);
-
-private slots:
- void decoderReady();
- void decoderError();
- void checkPlayTime();
+ void volumeChanged();
+ void mutedChanged();
private:
- void loadSample();
- void unloadSample();
-
- bool m_queued;
- bool m_muted;
- QTime m_playbackTime;
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_status;
- QFile *m_file;
- QByteArray m_name;
- QMediaContent m_media;
- WaveDecoder *m_waveDecoder;
+ bool m_muted;
+ int m_loopCount;
+ int m_volume;
QSound *m_sound;
- QTimer *m_timer;
+ QUrl m_source;
};
QT_END_NAMESPACE
diff --git a/src/multimedia/effects/wavedecoder_p.h b/src/multimedia/effects/wavedecoder_p.h
index fa1f77e..c1892bb 100644
--- a/src/multimedia/effects/wavedecoder_p.h
+++ b/src/multimedia/effects/wavedecoder_p.h
@@ -77,11 +77,11 @@ public:
bool isSequential() const;
qint64 bytesAvailable() const;
-signals:
+Q_SIGNALS:
void formatKnown();
void invalidFormat();
-private slots:
+private Q_SLOTS:
void handleData();
private:
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 5ffecc5..fdcc412 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -42,7 +42,6 @@
#include "qgl.h"
#include <private/qt_x11_p.h>
#include <private/qpixmap_x11_p.h>
-#include <private/qimagepixmapcleanuphooks_p.h>
#include <private/qgl_p.h>
#include <private/qpaintengine_opengl_p.h>
#include "qgl_egl_p.h"
diff --git a/src/src.pro b/src/src.pro
index 8c21ef7..403ffe1 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -112,7 +112,7 @@ src_declarative.target = sub-declarative
contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon
contains(QT_CONFIG, xmlpatterns): src_webkit.depends += src_xmlpatterns
contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit
- src_imports.depends += webkit
+ src_imports.depends += src_webkit
#exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore
}
contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
index 3f00e68..408ad87 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
@@ -10,7 +10,7 @@ Rectangle {
width: 100; height: 100
color: Qt.rgba(1,0,0)
Behavior on x {
- NumberAnimation { objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true}
+ NumberAnimation { id: myAnim; objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true}
}
}
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index 7ade309..aeefea1 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -659,9 +659,14 @@ void tst_QDeclarativeGridView::currentIndex()
QCOMPARE(gridview->contentY(), 0.0);
// Test keys
- qApp->setActiveWindow(canvas);
canvas->show();
- canvas->setFocus();
+ qApp->setActiveWindow(canvas);
+#ifdef Q_WS_X11
+ // to be safe and avoid failing setFocus with window managers
+ qt_x11_wait_for_window_manager(canvas);
+#endif
+ QVERIFY(canvas->hasFocus());
+ QVERIFY(canvas->scene()->hasFocus());
qApp->processEvents();
QTest::keyClick(canvas, Qt::Key_Down);
@@ -672,7 +677,6 @@ void tst_QDeclarativeGridView::currentIndex()
gridview->setFlow(QDeclarativeGridView::TopToBottom);
- QEXPECT_FAIL("", "QTBUG-8475", Abort);
QTest::keyClick(canvas, Qt::Key_Right);
QCOMPARE(gridview->currentIndex(), 5);
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 1df4448..75fbbf8 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1028,13 +1028,17 @@ void tst_QDeclarativeListView::currentIndex()
QCOMPARE(listview->contentY(), 0.0);
// Test keys
- qApp->setActiveWindow(canvas);
canvas->show();
- canvas->setFocus();
+ qApp->setActiveWindow(canvas);
+#ifdef Q_WS_X11
+ // to be safe and avoid failing setFocus with window managers
+ qt_x11_wait_for_window_manager(canvas);
+#endif
+ QVERIFY(canvas->hasFocus());
+ QVERIFY(canvas->scene()->hasFocus());
qApp->processEvents();
QTest::keyClick(canvas, Qt::Key_Down);
- QEXPECT_FAIL("", "QTBUG-8475", Abort);
QCOMPARE(listview->currentIndex(), 1);
QTest::keyClick(canvas, Qt::Key_Up);